LoginSignup
93

More than 5 years have passed since last update.

RailsアプリをHerokuにデプロイする手順メモ

Last updated at Posted at 2014-02-02

*Herokuのアカウント登録、Gitのインストールは完了していること。

(0) Heroku側でデプロイの受け入れスペースを確保する

terminal
$ heroku create [<app_name>]

(1) デプロイしたリポジトリを初期化

terminal
$ git init

(2) コミットするファイルを追加

terminal
$ git add .

(3) コミット

terminal
$ git commit -m "first commit"

(3.5) remote.herokuの設定

  • 削除
terminal
$ git remote rm heroku
  • 登録
terminal
$ git remote add heroku git@heroku.com:<app_name>.git

(4) デプロイ

terminal
$ git push heroku master
// rejectなんたらでデプロイが完了できない場合
$ git push heroku master --force

(5) マイグレート(これを忘れてた)

terminal
$ heroku run rake db:migrate

(6) ブラウザで見る

terminal
$ heroku open

参考
* デプロイ手順
* mysqlがherokuでコンパイルできないから、デプロイではpgにする手順
* 全体的なherokuとrailsの操作

「解決できないこと」

assetsがHerokuにデプロイされなかったり、jQueryがローカルと違う動きをしたり、CSSが反映されていないなどのずれがある。どうすれば完全に同じ挙動をしてくれるのか?

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
93