Skip to content

Instantly share code, notes, and snippets.

@halsk
Created April 9, 2014 06:07
Show Gist options
  • Save halsk/10230544 to your computer and use it in GitHub Desktop.
Save halsk/10230544 to your computer and use it in GitHub Desktop.
LocomotiveCMS で、複数の Heroku インスタンスを使う ref: http://qiita.com/hal_sk/items/aba8d324638d205b2ce1
(中略)
when :staging
# the following configuration works for Amazon S3
config.storage = :fog
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: ENV['S3_KEY_ID'],
aws_secret_access_key: ENV['S3_SECRET_KEY'],
region: ENV['S3_BUCKET_REGION']
}
config.fog_directory = ENV['S3_BUCKET']
when :production
# the following configuration works for Amazon S3
config.storage = :fog
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: ENV['S3_KEY_ID'],
aws_secret_access_key: ENV['S3_SECRET_KEY'],
region: ENV['S3_BUCKET_REGION']
}
config.fog_directory = ENV['S3_BUCKET']
..
git remote rename heroku staging
git remote add production git@yourappproduction.com:fivejcup.git
heroku addons:add mongohq --remote production
heroku addons:add sendgrid:starter --remote production
cp config/environments/production.rb config/environments/staging.rb
heroku config:set RACK_ENV=staging --app staging_app_name #旧環境の設定をstagingに変更
heroku config:set RAILS_ENV=staging --app staging_app_name #旧環境の設定をstagingに変更
heroku config:add BUNDLE_WITHOUT=development:test --app production_app_name #新環境の設定を追加
heroku config:add HEROKU_API_KEY=<YOUR HEROKU API KEY> --app production_app_name #新環境の設定を追加
heroku config:add HEROKU_APP_NAME=<YOUR APP NAME> --app production_app_name #新環境の設定を追加
heroku config:add S3_KEY_ID=<YOUR S3 KEY ID> --app production_app_name #新環境の設定を追加
heroku config:add S3_SECRET_KEY=<YOUR S3 SECRET KEY> --app production_app_name #新環境の設定を追加
heroku config:add S3_BUCKET=<YOUR S3 BUCKET NAME> --app production_app_name #新環境の設定を追加
heroku config:add S3_BUCKET_REGION=<YOUR S3 BUCKET REGION> --app production_app_name #新環境の設定を追加
git push staging master
git push production master
(省略)
staging:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment