###参考
heroku fork コマンドで作成
$ heroku fork -a hoge hoge-staging
で アプリケーションhogeがhoge-stagingにコピーされます。
heroku info で git remoteの情報を取得、追加
heroku fork コマンドでは自動でgit remote は追加されないので自分で行います。
$ heroku info -a hoge-staging
で表示される GIt URL の部分を追加
$ git remote add staging git@heroku.com:hoge-staging.git
これで
$ git push staging master
でステージング環境にpushすることができる。
###Staging用にRACK_ENVとRAILS_ENVを設定
$ heroku config:set RACK_ENV=staging RAILS_ENV=staging --remote staging
これでステージングのログ見るときとか、ステージングに反映させたい環境変数とか設定するときは
bash
$ heroku logs -t --remote staging
既存のやつをみたいときは
bash
$ heroku logs -t --remote heroku
で出来たりする
###ステージング環境設定を本番と同じにする
シンボリックリンクをはる。
$ ln -s config/environments/production.rb config/environments/staging.rb
###heroku forkでつくったアプリケーションの削除
$ heroku destroy -a hoge-staging
で削除することが可能。