Skip to content

Instantly share code, notes, and snippets.

@adamhundley
Last active April 19, 2016 18:24
Show Gist options
  • Save adamhundley/3908c81dffe1777130bea73d4425c117 to your computer and use it in GitHub Desktop.
Save adamhundley/3908c81dffe1777130bea73d4425c117 to your computer and use it in GitHub Desktop.
Running App Locally in Production

This is step by step instructions on how to run your app locally in the production environment.

  1. Add gem 'rails_12factor' to your Gemfile. This will add error logging to the command line and the ability for your app to serve static assets.
  2. run bundle
  3. run bundle exec rake secret and copy the output
  4. in application.yml set the secret_key to match what secret.yml is expecting (<%= ENV["SECRET_KEY_BASE"] %>)
  5. in database.yml under production: delete username and password
  6. run rake assets:precompile - This will create a folder public/assets that contains all of your assets.
  7. run RAILS_ENV=productions rake db:create db:migrate db:seed or db:setup
  8. fire up the server with http://localhost:3000
  • Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes to your assets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment