Subscribed unsubscribe Subscribe Subscribe

Augmented Usamimi

it { is_expected.to be_blog.written_by(izumin5210) }

【Rails】Herokuにstagingでぷろいめも

Ruby Ruby on Rails

毎回事故るので,手順を簡単にメモ(とくにassetsまわり).

# Gemfile
group :staging do
  gem 'pg'
  gem 'rails_12factor'
end
# config/database.yml
staging:
  adapter: postgresql
  encoding: unicode
  pool: 5
# config/secrets.yml
staging:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
  devise_secret_key: <%= ENV["DEVISE_SECRET_KEY"] %>
$ cp confing/environments/{production,staging}.rb
# config/environments/staging.rb
Rails.application.configure do
  config.assets.compile = true
end 
$ heroku create --remote staging
$ heroku config:set RAILS_ENV=staging
$ heroku config:set SECRET_KEY_BASE=`bin/rake secret`
$ heroku config:set DEVISE_SECRET_KEY=`bin/rake secret`
$ git push staging <CURRENT BRANCH>:master
$ heroku run rake db:migrate