A note to myself for everytime I have to do this
Consider you already have a rails app on Heroku but you now want to incorporate a staging environment with your workflow
Local changes first:
Copy the config/environment/production.rb file to config/environment/staging.rb Change the action mailer setup for Exception Notification so you know the email is coming from your staging app.
Add a staging group to your gemfile (this can normally be a copy of the production group)
Change the config/newrelic.yml file to uncomment the app_name under staging
Heroku changes:
From your console in you project directory on your development machine:
This creates a new heroku app that is also linked to this project.
This adds the git handle of staging to this app. You can see the different git remotes with:
So when you want to push your development branch to your staging environment you do:
You also have to run your migrations (from now on you have to specify the app name):
Your staging app will be set to production by default so you have to set it to staging environment:
You can now check if it done by doing:
Dont forget to change the default password on Active Admin!
You can now do new feature testing, automated cross browser testing, automated db population and load testing to your hearts content without affecting your real app, its data or its users.
Your staging environment is now complete
When you are happy that the staging app is behaving as intended you can first merge the development branch into master and then delete the development branch:
Now you can push master to heroku (production app)
Your production app is now updated!
No comments:
Post a Comment