Herokuでアプリを作る

- - posted in Git, Heroku, Rails

heroku

Heroku
http://www.heroku.com/

ユーザー登録後、Herokuのgemをインストールする。

$ gem install heroku

herokuの利用に必要なコマンドがインストールされる。

作成したアプリ一覧を確認

$ heroku list

新規Railsアプリを作成

$ rails new newApp

アプリの起動確認

$ cd newApp
$ rails s

git初期化

$ git init
$ git add .
$ git commit -m "initialize"

Herokuで動かす

$ heroku create appname

macを買って、今すぐherokuでruby1.9.3 + rails3.2しよう! から引用させていただきます。
必要最低限のgemを記述。

$ curl https://raw.github.com/gist/1970532/376b6a26ed936ac43cad0b17a64512f5c0216a50/Gemifile > Gemfile
$ rm -f Gemfile.lock
$ bundle install --without production
$ git add -A
$ git commit -m 'Update Gemfile'

中身はこんな感じ。
herokuでは、PostgreSQL使うので、pgを指定したり、developmentでしか使わないものはそこに移動とかです。

source 'https://rubygems.org'

gem 'rails', '3.2.2'
gem 'jquery-rails'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

group :test, :development do
  gem 'sqlite3'
  gem 'heroku'
end

group :production do
  gem 'pg'
  gem 'thin'
end

Herokuにデプロイ

$ git push heroku master
$ heroku open

参考URL
macを買って、今すぐherokuでruby1.9.3 + rails3.2しよう!
Herokuで作るFacebookアプリ

Comments