LoginSignup
36
31

More than 5 years have passed since last update.

Herokuステージング環境作成

Last updated at Posted at 2014-11-10

参考


Herokuアプリフォーク

heroku fork -a APPNAME APPNAME-staging

※アドオンも全てコピーされるため有料プランを使っている場合などは注意

git remote追加

git remote add staging git@heroku.com:APPNAME-staging.git

ステージングへ環境変更

heroku config:set RACK_ENV=staging RAILS_ENV=staging --remote staging

設定ファイルコピー

cp config/environments/production.rb config/environments/staging.rb

設定追加

  • シークレットキー設定

config/secrets.yml

staging:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
  • シークレットキーHeroku登録

キー作成

rake secret
----------
0304acfda4a421d8bc9761d691bf2c27ae4629d144f5eb78a228488c22d8dae737f945ac6c8f55beb563dbcf53c1a02eaedcb6b36cf7d0c5d80dce883231a5eb
----------

キー登録

heroku config:set SECRET_KEY_BASE='0304acfda4a421d8bc9761d691bf2c27ae4629d144f5eb78a228488c22d8dae737f945ac6c8f55beb563dbcf53c1a02eaedcb6b36cf7d0c5d80dce883231a5eb' --remote staging

ステージングデプロイ

  • stagingブランチをリモートのmasterブランチにpush
git push staging staging:master && heroku run rake db:migrate --remote staging

ステージングサイト確認

heroku open --remote staging
36
31
2

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
36
31