Agile development methodologies promote quick and iterative product releases. When rapidly prototyping and releasing software it is important to have a staging environment. This environment should be isolated and replicate the production server. It will give your project stakeholders a sandbox to test functionality, run performance tests, and use the application as if it were the “live” website.
If you’re familiar with Ruby on Rails then it’s safe to assume you’ve heard of Heroku. Heroku is a platform as a service (PaaS) for managing and rapidly deploying web applications to the cloud.
Here’s how the setup would work for a project “chunnel.”
Create staging and production apps on heroku:
heroku create --stack cedar --remote chunnel-staging
heroku create --stack cedar --remote chunnel-production
Validate that the
heroku command added two new remotes to your git config file:
# Note: I updated the remote names to "staging" and "production"
fetch = +refs/heads/*:refs/remotes/staging/*
url = firstname.lastname@example.org:chunnel-staging.git
fetch = +refs/heads/*:refs/remotes/production/*
url = email@example.com:chunnel-production.git
Push the application to staging environment:
git push staging master
Validate code changes are working as expected on staging. When codebase has been deemed stable we’re ready for the production release.
Push the application to production environment:
git push production master