Herokuにデプロイ

今日は
Ruby on Rails Tutorial: Learn Rails by Example | Ruby on Rails 3 Tutorial book and screencasts | by Michael Hartl
をやってみる。
HerokuというRailsホスティングサービスにアカウントを作って、自分のアプリを動作させるところまでをやる。デプロイをこの初期段階にもってくるところがアジャイルっぽくていい。

$ heroku keys:add

のところでnet/httpsが呼べないとかreadlineがないだとかエラーが出た
Linux弱者の僕はDebianetchなのがいけない(aptのlibopenssl-rubyが古すぎるのだと思った)と決め付け2時間かけてetchからlennyにアップグレードしたが原因はRVMだった

でやっとemailとpasswordを入力できたが今度はrejectされる

$ heroku keys:add
 !   Contents Your public key has been rejected because it was generated by a weak random number generator.
 !   See http://www.ubuntu.com/usn/usn-612-2 for more information.

よくわらからなったが、githubのために作った鍵を使ったらできた。同じrsaのはずなんだけど

で、Herokuに新しいアプリケーションを作る

$ heroku create
Creating stormy-waterfall-47.... done
Created http://stormy-waterfall-47.heroku.com/ | git@heroku.com:stormy-waterfall-47.git
Git remote heroku added

できた。このアプリはhttp://stormy-waterfall-47.heroku.com/ホスティングされるということだ

そしてコミット

$ git push heroku master
Warning: Permanently added the RSA host key for IP address '174.129.212.2' to the list of known hosts.
Counting objects: 66, done.
Compressing objects: 100% (52/52), done.
Writing objects: 100% (66/66), 90.10 KiB, done.
Total 66 (delta 3), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.3
       Unresolved dependencies detected; Installing...
       Fetching source index for http://rubygems.org/
       Installing rake (0.8.7)
       Installing abstract (1.0.0)
       Installing activesupport (3.0.3)
       Installing builder (2.1.2)
       Installing i18n (0.5.0)
       Installing activemodel (3.0.3)
       Installing erubis (2.6.6)
       Installing rack (1.2.1)
       Installing rack-mount (0.6.13)
       Installing rack-test (0.5.6)
       Installing tzinfo (0.3.23)
       Installing actionpack (3.0.3)
       Installing mime-types (1.16)
       Installing polyglot (0.3.1)
       Installing treetop (1.4.9)
       Installing mail (2.2.12)
       Installing actionmailer (3.0.3)
       Installing arel (2.0.6)
       Installing activerecord (3.0.3)
       Installing activeresource (3.0.3)
       Using bundler (1.0.3)
       Installing thor (0.14.6)
       Installing railties (3.0.3)
       Installing rails (3.0.3)
       Installing sqlite3-ruby (1.2.5) with native extensions
       Your bundle is complete! It was installed into ./.bundle/gems
       Compiled slug size is 3.8MB
-----> Launching... done
       http://stormy-waterfall-47.heroku.com deployed to Heroku

To git@heroku.com:stormy-waterfall-47.git
 * [new branch]      master -> master

gemまで勝手にインストールされる天才的

無事にデプロイできました