惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
S
Securelist
MyScale Blog
MyScale Blog
Jina AI
Jina AI
罗磊的独立博客
The Cloudflare Blog
美团技术团队
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
雷峰网
雷峰网
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
博客园 - 聂微东
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
T
Tailwind CSS Blog
Attack and Defense Labs
Attack and Defense Labs
博客园_首页
Latest news
Latest news
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Hacker News
The Hacker News
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
D
Docker
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
B
Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
V2EX - 技术
V2EX - 技术
N
News | PayPal Newsroom
Microsoft Security Blog
Microsoft Security Blog

Heroku

请教:用 Heroku 跑应用费用会比用普通的云服务器差多少? - V2EX 现在还有人在用 heroku 吗, 是不是已经凉凉了 - V2EX Heroku 不再有免费的了~ - V2EX Heroku 账号没了 - V2EX Heroku 是崩了吗? - V2EX Heroku 的 nodejs 如何将提交的表单信息写入文件? - V2EX Heroku 部署失败,提示 TemplateDoesNotExist at / Learning_logs/base.html - V2EX 求助: django 部署在 heroku , 数据库出问题, 想知道在 免费版的 heroku app 上 如何管理数据库 - V2EX 用了 heroku 的 PaaS,国内访问很慢,有什么解决方案,域名没备案! - V2EX 管理 heroku postgre - V2EX 开源类Heroku平台 - V2EX 有用heroku的么 - V2EX heroku 提交失败 - V2EX heroku postgresql 是否收费? - V2EX 玩了下 Heroku,掛了. 不關我事哈 - V2EX Heroku 首页的四次变迁 - V2EX heroku/aws有没有加速的办法?earbits.com国内电信很慢~~~ - V2EX Heroku现在非得付费才能用吗?有没有其他啥的免费的? - V2EX Heroku 支持 Python 和 PHP 了 - V2EX Matz joins Heroku - V2EX heroku 似乎给强了,histart.me 广东地区无法访问 - V2EX Salesforce.com Buys Heroku!!! - V2EX 头疼:如何安装heroku? - V2EX 这里有人用HEROKU吗? - V2EX heroku.com 的交互设计非常棒 - V2EX 来推荐我的开源独立博客程序,可以直接运行在 Heroku 上面(免费可绑定域名) - V2EX
直播:Linux下试玩Heroku - V2EX
xinzhi · 2010-10-09 · via Heroku

这是一个创建于 5727 天前的主题,其中的信息可能已经有所发展或是发生改变。

对heroku没太多兴趣,但看到V2EX有人正在折腾这个,我也随便看看。我不是程序猿,只是玩玩。

基本只是复制粘贴,遇到障碍即终止,不折腾了。如果顺利,那我将创建一个可以通过网络访问的heroku app。

系统环境:
Ubuntu 10.10(Linux)
Gnome Desktop + gnome-terminal

直播线(应该是这个地址吧):
http://v2ex.appspot.com/t/3218?f=1

Feuda

1

Feuda      2010 年 10 月 9 日

顶起

xinzhi

2

xinzhi      2010 年 10 月 9 日

之前就去过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

xinzhi

3

xinzhi      2010 年 10 月 9 日

既然是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

lainuo

4

lainuo      2010 年 10 月 9 日

ubuntu的依赖果然恐怖....

xinzhi

5

xinzhi      2010 年 10 月 9 日

确保万无一失,这里确认下ruby是不是真的准备就绪:
xinzhi@xinzhi-laptop:~$ sudo apt-get install ruby
[sudo] password for xinzhi:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
ruby 已经是最新的版本了。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
有 1 个软件包没有被完全安装或卸载。
解压缩后会消耗掉 0B 的额外空间。
您希望继续执行吗?[Y/n]

xinzhi

6

xinzhi      2010 年 10 月 9 日

现在,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:~$

Paranoid

7

Paranoid      2010 年 10 月 9 日

sudo apt-get install rails ( 先前版本Ubuntu 对 apt-get 的rails 版本做过修改,不知道这个会不会对LZ后面部分有障碍) 接着做看~~

xinzhi

8

xinzhi      2010 年 10 月 9 日

尝试第二条命令,应该是创建一个app id,我运行:
xinzhi@xinzhi-laptop:~$ heroku create xinzhi
heroku:找不到命令
xinzhi@xinzhi-laptop:~$

我想创建一个ID为xinzhi的app,不过提示heroku找不到命令。大概是环境变量没有设置好。现在我去Google一下吧。

Feuda

9

Feuda      2010 年 10 月 9 日

xinzhi

10

xinzhi      2010 年 10 月 9 日

通过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验证。

Feuda

13

Feuda      2010 年 10 月 9 日

已经看到了,太棒了

xinzhi

15

xinzhi      2010 年 10 月 9 日

帮助文档中有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

xinzhi

16

xinzhi      2010 年 10 月 9 日

我已经安装有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$

xinzhi

17

xinzhi      2010 年 10 月 9 日

看来我搞错了,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用法。先去了解一下。

Feuda

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:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成

等等是怎么弄的?怎么会这么详细?

xinzhi

21

xinzhi      2010 年 10 月 9 日

好吧,推倒重来,现在部署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
(此处省略一大堆服务器回馈信息)

disinfeqt

22

disinfeqt      2010 年 10 月 9 日

wth are you doing...

xinzhi

23

xinzhi      2010 年 10 月 9 日

接着上面的末段信息:
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$

xinzhi

25

xinzhi      2010 年 10 月 9 日

最后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$

现在看来,我要做的事情完成了。

AntiGameZ

26

AntiGameZ      2010 年 10 月 9 日

晕,好复杂,前段时间照着ruby on rails tutorial,在macbook上搞了一遍

huacnlee

29

huacnlee      2010 年 10 月 10 日 via iPad

其实整个过程可以简化很多

ssword

30

ssword      2010 年 10 月 10 日

囧,没必要把控制台输出的都贴过来吧

xinzhi

32

xinzhi      2010 年 10 月 10 日

@Feuda
我可能没空。我也不清楚怎么帮你呢。我也是第一次尝试(也许就这一次了),并不懂这个的。

@huacnlee 嗯。第一次玩呢,我说过了,只是复制粘贴,不做太多思考,不折腾~

@ssword 这是个过程,过程就是这样。。。这是个直播帖,不是总结。开始的时候我也不保证成功的。顺便其他人也可以帮忙看看哪里出问题了,这样才能进行下去。

算我侥幸成功了吧。其实就是复制粘贴,任何人都可以。如你所见。

Feuda

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 等等

fanix

34

fanix      2010 年 10 月 10 日

我觉得heroku是最好部署的了,在mac环境下我居然一次把一个很大的rails站部署成功。估计linux也差不多了,heroku站方考虑的其实非常周到。

xinzhi

35

xinzhi      2010 年 10 月 10 日

@Feuda

"
看到左侧有快速入门的教程,一看就知道是终端运行的命令行。所以第一步就是打开gnome-terminal命令终端。
"

命令终端

samt

37

samt      2010 年 10 月 12 日

ok

lance

40

lance      2010 年 11 月 24 日

~0~

cswanghan

42

cswanghan      2011 年 3 月 16 日

好东西 收藏 周末也搞一个!