Skip to content

Instantly share code, notes, and snippets.

@julyytran
Created April 19, 2016 17:52
Show Gist options
  • Save julyytran/b9ebfb71d1f80255c6b450c7573149af to your computer and use it in GitHub Desktop.
Save julyytran/b9ebfb71d1f80255c6b450c7573149af to your computer and use it in GitHub Desktop.
How to run production locally in rails

Use a different API key for each environment: test, development, production

In secrets.yml, there are tokens for each environment

In application.yml (from figaro), can set keys for different environments using figaro

rake secret to get secret token, used to sign and decode cookies, put it in application.yml Access it in secrets.yml

Add gem 'rails_12factor to gemfile to get error messages tail -f log/development.log opens up any file, anytime something gets written to a file, it gets outputed in real time

In database.yml, delete username and password for production

Run rake assets:precompile to get assets

Run RAILS_ENV=production rails s to run production locally

Run rake assets:clobber to remove public assets when going back to development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment