
1 Feuda 2010 年 10 月 9 日 顶起 |
2 xinzhi OP 之前就去过Heroku官网,地址是:http://heroku.com/ 看到左侧有快速入门的教程,一看就知道是终端运行的命令行。所以第一步就是打开gnome-terminal命令终端。 第一条命令是: sudo gem install heroku 命令形式和apt-get完全一样。不过我不知道gem是神马。先试探一下: xinzhi@xinzhi-laptop:~$ gem 程序“gem”已包含在下列软件包中: * rubygems1.8 * rubygems1.9.1 请尝试:sudo apt-get install <选定的软件包> xinzhi@xinzhi-laptop:~$ sudo apt-get install rubygems1.9.1 [sudo] password for xinzhi: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 注意,选取 ruby1.9.1 而非 rubygems1.9.1 将会安装下列额外的软件包: libruby1.9.1 ruby1.9.1 建议安装的软件包: ruby1.9.1-examples ri1.9.1 graphviz 下列【新】软件包将被安装: libruby1.9.1 ruby1.9.1 升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。 有 1 个软件包没有被完全安装或卸载。 需要下载 3,795kB 的软件包。 解压缩后会消耗掉 13.4MB 的额外空间。 您希望继续执行吗?[Y/n]y |
3 xinzhi OP 既然是ruby on rails,那么ruby和rails都要有。从上面看,安装gem的时候,ruby已经顺便安装好了。那还缺少rails。现在安装: xinzhi@xinzhi-laptop:~$ sudo apt-get install rails 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 将会安装下列额外的软件包: libactionmailer-ruby1.8 libactionpack-ruby1.8 libactiverecord-ruby1.8 libactiveresource-ruby1.8 libactivesupport-ruby1.8 libbreakpoint-ruby1.8 libbuilder-ruby1.8 libcmdparse2-ruby1.8 libdaemons-ruby1.8 libi18n-ruby1.8 libjs-prototype liblog4r-ruby1.8 libmemcache-client-ruby1.8 libmmap-ruby1.8 libmocha-ruby1.8 libncurses-ruby1.8 librack-ruby librack-ruby1.8 libredcloth-ruby1.8 libruby1.8-extras libsqlite3-ruby1.8 libtext-format-ruby1.8 libtmail-ruby1.8 libtzinfo-ruby1.8 rails-ruby1.8 rake rubygems1.8 建议安装的软件包: libtmail-ruby-doc thin1.8 libapache2-mod-ruby libapache2-mod-fcgid libfcgi-ruby1.8 ruby1.8-dev build-essential rubygems-doc 下列【新】软件包将被安装: libactionmailer-ruby1.8 libactionpack-ruby1.8 libactiverecord-ruby1.8 libactiveresource-ruby1.8 libactivesupport-ruby1.8 libbreakpoint-ruby1.8 libbuilder-ruby1.8 libcmdparse2-ruby1.8 libdaemons-ruby1.8 libi18n-ruby1.8 libjs-prototype liblog4r-ruby1.8 libmemcache-client-ruby1.8 libmmap-ruby1.8 libmocha-ruby1.8 libncurses-ruby1.8 librack-ruby librack-ruby1.8 libredcloth-ruby1.8 libruby1.8-extras libsqlite3-ruby1.8 libtext-format-ruby1.8 libtmail-ruby1.8 libtzinfo-ruby1.8 rails rails-ruby1.8 rake rubygems1.8 升级了 0 个软件包,新安装了 28 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。 有 1 个软件包没有被完全安装或卸载。 需要下载 2,648kB 的软件包。 解压缩后会消耗掉 20.4MB 的额外空间。 您希望继续执行吗?[Y/n]y |
4 lainuo 2010 年 10 月 9 日 ubuntu的依赖果然恐怖.... |
5 xinzhi OP 确保万无一失,这里确认下ruby是不是真的准备就绪: xinzhi@xinzhi-laptop:~$ sudo apt-get install ruby [sudo] password for xinzhi: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 ruby 已经是最新的版本了。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。 有 1 个软件包没有被完全安装或卸载。 解压缩后会消耗掉 0B 的额外空间。 您希望继续执行吗?[Y/n] |
6 xinzhi OP 现在,ruby on rails就绪,gem可用,可以正式开始吧。回到官方快速上手的第一条命令: xinzhi@xinzhi-laptop:~$ sudo gem install heroku Successfully installed mime-types-1.16 Successfully installed rest-client-1.6.1 Successfully installed rake-0.8.7 Successfully installed configuration-1.1.0 Successfully installed launchy-0.3.7 Successfully installed json_pure-1.4.6 Successfully installed heroku-1.10.14 7 gems installed Installing ri documentation for mime-types-1.16... Installing ri documentation for rest-client-1.6.1... Installing ri documentation for rake-0.8.7... Installing ri documentation for configuration-1.1.0... Installing ri documentation for launchy-0.3.7... Installing ri documentation for json_pure-1.4.6... Installing ri documentation for heroku-1.10.14... Installing RDoc documentation for mime-types-1.16... Installing RDoc documentation for rest-client-1.6.1... Installing RDoc documentation for rake-0.8.7... Installing RDoc documentation for configuration-1.1.0... Installing RDoc documentation for launchy-0.3.7... Installing RDoc documentation for json_pure-1.4.6... Installing RDoc documentation for heroku-1.10.14... xinzhi@xinzhi-laptop:~$ |
7 Paranoid 2010 年 10 月 9 日 sudo apt-get install rails ( 先前版本Ubuntu 对 apt-get 的rails 版本做过修改,不知道这个会不会对LZ后面部分有障碍) 接着做看~~ |
8 xinzhi OP 尝试第二条命令,应该是创建一个app id,我运行: xinzhi@xinzhi-laptop:~$ heroku create xinzhi heroku:找不到命令 xinzhi@xinzhi-laptop:~$ 我想创建一个ID为xinzhi的app,不过提示heroku找不到命令。大概是环境变量没有设置好。现在我去Google一下吧。 |
9 Feuda 2010 年 10 月 9 日 顶 |
10 xinzhi OP 通过Google查找这个http://stackoverflow.com/questions/2396004/heroku-gem-doesnt-work-are-installing-it 按部就班: xinzhi@xinzhi-laptop:~$ gem environment RubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [i686-linux] - INSTALLATION DIRECTORY: /var/lib/gems/1.8 - RUBY EXECUTABLE: /usr/bin/ruby1.8 - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin - RUBYGEMS PLATFORMS: - ruby - x86-linux - GEM PATHS: - /var/lib/gems/1.8 - /home/xinzhi/.gem/ruby/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ 也就是设置bin的位置: xinzhi@xinzhi-laptop: export PATH=$PATH:/var/lib/gems/1.8/bin 再次尝试: xinzhi@xinzhi-laptop:heroku create xinzhi Enter your Heroku credentials. Email: 至此,又回到正轨了。我先测试下我的账号,还有ssh验证。 |
11 xinzhi OP Email: xinzhiorg在gmail.com Password: Uploading ssh public key /home/xinzhi/.ssh/id_rsa.pub Creating xinzhi... done Created http://xinzhi.heroku.com/ | [email protected]:xinzhi.git fatal: Not a git repository (or any of the parent directories): .git xinzhi@xinzhi-laptop:/var/lib/gems/1.8/bin$ |
12 xinzhi OP 现在,已经创建了xinzhi这个app,通过 http://xinzhi.heroku.com/ 可以访问。接下来部署一个app吧,来个blog试试。 |
13 Feuda 2010 年 10 月 9 日 已经看到了,太棒了 |
14 xinzhi OP 试一下@huacnlee的personlab吧,项目地址和安装文档: http://github.com/huacnlee/personlab |
15 xinzhi OP 帮助文档中有Ubuntu环境下的方法: h2. Install on Ubuntu $ git clone git://github.com/huacnlee/personlab.git $ cd personlab $ cp config/database.yml.default config/database.yml $ vi config/database.yml $ cp config/twitter.yml.default config/twitter.yml $ vi config/twitter.yml $ vi config/application.rb $ bundle install $ RAILS_ENV=production rake db:create $ RAILS_ENV=production rake db:migrate $ RAILS_ENV=production rake db:seed |
16 xinzhi OP 我已经安装有git了。获得源码需要修改几个配置选项,我先看下。 xinzhi@xinzhi-laptop:~$ git clone git://github.com/huacnlee/personlab.git Initialized empty Git repository in /home/xinzhi/personlab/.git/ remote: Counting objects: 3588, done. remote: Compressing objects: 100% (2212/2212), done. remote: Total 3588 (delta 1622), reused 2986 (delta 1233) Receiving objects: 100% (3588/3588), 3.54 MiB | 43 KiB/s, done. Resolving deltas: 100% (1622/1622), done. xinzhi@xinzhi-laptop:~$ cd personlab xinzhi@xinzhi-laptop:~/personlab$ cp config/database.yml.default config/database.yml xinzhi@xinzhi-laptop:~/personlab$ |
17 xinzhi OP 看来我搞错了,Install on Ubuntu 是本机部署,应该是部署到Heroku的云上,回到: h2. Install on Heroku $ git clone git://github.com/huacnlee/personlab.git $ cd personlab $ vi config/application.rb $ heroku create --stack bamboo-ree-1.8.7 youappname $ heroku config:add HEROKU=true $ git push heroku master $ heroku rake db:create $ heroku rake db:migrate $ heroku rake db:seed 以上过程基本顺利,配置基本不用修改吧,我也暂时不知道要改神马。git push遇到点问题,我还不清楚push用法。先去了解一下。 |
18 Feuda 2010 年 10 月 9 日 @xinzhi 你直播的内容是怎么copy上来的,感觉好到位哦, xinzhi@xinzhi-laptop:~$ gem 程序“gem”已包含在下列软件包中: * rubygems1.8 * rubygems1.9.1 请尝试:sudo apt-get install <选定的软件包> xinzhi@xinzhi-laptop:~$ sudo apt-get install rubygems1.9.1 [sudo] password for xinzhi: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 等等是怎么弄的?怎么会这么详细? |
21 xinzhi OP 好吧,推倒重来,现在部署personlab到xinzhiblog这个app上: xinzhi@xinzhi-laptop:~$ git clone git://github.com/huacnlee/personlab.git Initialized empty Git repository in /home/xinzhi/personlab/.git/ remote: Counting objects: 3588, done. remote: Compressing objects: 100% (2212/2212), done. remote: Total 3588 (delta 1622), reused 2986 (delta 1233) Receiving objects: 100% (3588/3588), 3.54 MiB | 50 KiB/s, done. Resolving deltas: 100% (1622/1622), done. xinzhi@xinzhi-laptop:~$ cd personlab xinzhi@xinzhi-laptop:~/personlab$ heroku create --stack bamboo-ree-1.8.7 xinzhiblog Creating xinzhiblog... done Created http://xinzhiblog.heroku.com/ | [email protected]:xinzhiblog.git Git remote heroku added xinzhi@xinzhi-laptop:~/personlab$ heroku config:add HEROKU=true Adding config vars: HEROKU => true Restarting app...done. xinzhi@xinzhi-laptop:~/personlab$ git push heroku master The authenticity of host 'heroku.com (75.101.163.44)' can't be established. RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'heroku.com,75.101.163.44' (RSA) to the list of known hosts. Counting objects: 3588, done. Compressing objects: 100% (1823/1823), done. Writing objects: 100% (3588/3588), 3.57 MiB | 51 KiB/s, done. Total 3588 (delta 1622), reused 3588 (delta 1622) -----> Heroku receiving push -----> Rails app detected -----> Detected use of caches_page Installing caches_page_via_http plugin... done -----> Detected Rails is not set to serve static_assets Installing rails3_serve_static_assets... done -----> Installing gem rails 2.3.5 from http://rubygems.org Successfully installed activesupport-2.3.5 (此处省略一大堆服务器回馈信息) |
22 disinfeqt 2010 年 10 月 9 日 wth are you doing... |
23 xinzhi OP 接着上面的末段信息: Installing simple-rss (1.2.3) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. Your bundle was installed to `.bundle/gems` Compiled slug size is 14.0MB -----> Launching.... done http://xinzhiblog.heroku.com deployed to Heroku To [email protected]:xinzhiblog.git * [new branch] master -> master xinzhi@xinzhi-laptop:~/personlab$ |
25 xinzhi OP 最后3步,是数据库相关操作。 xinzhi@xinzhi-laptop:~/personlab$ heroku rake db:create DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from require at /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64) DEPRECATION WARNING: Rake tasks in /disk1/home/slugs/313715_da72fc3_b7c2/mnt/vendor/plugins/captcha/tasks/generate.rake are deprecated. Use lib/tasks instead. (called from /disk1/home/slugs/313715_da72fc3_b7c2/mnt/Rakefile:7) DEPRECATION WARNING: Rake tasks in /disk1/home/slugs/313715_da72fc3_b7c2/mnt/vendor/plugins/heroku_asset_cacher/tasks/heroku_asset_packager_tasks.rake are deprecated. Use lib/tasks instead. (called from /disk1/home/slugs/313715_da72fc3_b7c2/mnt/Rakefile:7) imffcdufmx already exists (in /disk1/home/slugs/313715_da72fc3_b7c2/mnt) xinzhi@xinzhi-laptop:~/personlab$ heroku rake db:migrate DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from require at /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64) (省略输出) /heroku_asset_packager_tasks.rake are deprecated. Use lib/tasks instead. (called from /disk1/home/slugs/313715_da72fc3_b7c2/mnt/Rakefile:7) (in /disk1/home/slugs/313715_da72fc3_b7c2/mnt) == CreatePosts: migrating ==================================================== -- create_table(:posts) (省略输出) ======================================== xinzhi@xinzhi-laptop:~/personlab$ heroku rake db:seed DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from require at /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64) DEPRECATION WARNING: Rake tasks in /disk1/home/slugs/313715_da72fc3_b7c2 (省略输出) Creating administrator, username:admin password:123123 Creating default menus Creating default pages Creating default categories Creating sample post xinzhi@xinzhi-laptop:~/personlab$ 现在看来,我要做的事情完成了。 |
26 AntiGameZ 2010 年 10 月 9 日 晕,好复杂,前段时间照着ruby on rails tutorial,在macbook上搞了一遍 |
27 xinzhi OP OK,打完收工,Heroku app:personlab blog部署成功! 测试地址: http://xinzhiblog.heroku.com/ 好了。全部过程就在上面了。 查看时间线: http://v2ex.appspot.com/t/3218?f=1 |
29 huacnlee 2010 年 10 月 10 日 via iPad 其实整个过程可以简化很多 |
30 ssword 2010 年 10 月 10 日 ,没必要把控制台输出的都贴过来吧 |
32 xinzhi OP |
33 Feuda 2010 年 10 月 10 日 @xinzhi 我就是想问问你昨晚最开始用什么运行这些的 xinzhi@xinzhi-laptop:~$ gem 程序“gem”已包含在下列软件包中: * rubygems1.8 * rubygems1.9.1 请尝试:sudo apt-get install <选定的软件包> xinzhi@xinzhi-laptop:~$ sudo apt-get install rubygems1.9.1 [sudo] password for xinzhi: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 注意,选取 ruby1.9.1 而非 rubygems1.9.1 怎么会出现:xinzhi@xinzhi-laptop:~$ gem 程序“gem”已包含在下列软件包中: * rubygems1.8 等等 |
34 fanix 2010 年 10 月 10 日 我觉得heroku是最好部署的了,在mac环境下我居然一次把一个很大的rails站部署成功。估计linux也差不多了,heroku站方考虑的其实非常周到。 |
35 xinzhi OP |
37 samt 2010 年 10 月 12 日 ok |
38 kendisk 2010 年 10 月 30 日 |
39 Sunyanzi 2010 年 10 月 30 日 |
40 lance 2010 年 11 月 24 日 ~0~ |
42 cswanghan 2011 年 3 月 16 日 好东西 收藏 周末也搞一个! |