FormStorm.co is a SaaS application to build marketing micro-sites and Salesforce-connected forms. Last week we launched the private beta and you’re invited to take part! FormStorm is hosted on Heroku and generates consumer-facing Heroku apps on the fly. During the development process Heroku has been used to host the TEST ENV then, when ready, both STAGING and PRODUCTION ENV. Here are some tips we’ve discovered along the way.
Running your app on various ENV:
A classical approach to maintaining any app is to have 3 or 4 different environments. Each environment is backed up by a specific Git Branch and you usually end up with something like :
- development env and branch, for local use and local work
- staging env and branch, for Production-like test
- Production env and branch, for the live app
This approach is common but it is not immediately obvious how to implement this on Heroku. By default you are in Production mode and only the master branch can be deployed. Here is how to recreate your various ENV on Heroku.
- First create your apps for staging and production ENV:
heroku create --remote staging heroku create --remote production
- Run your app with the correct ENV
Ruby Heroku apps respect the RACK_ENV variable value. Rails apps use the RAILS_ENV variable. To change them, run this in you terminal:
heroku config:add RACK_ENV=staging --remote staging heroku config:add RAILS_ENV=staging --remote staging
- Deploy your branches
After that, to push your staging or production branches to Heroku do (respectively):
git push staging staging:master git push production production:master
That command will push and merge either your staging/production branches on the corresponding remote master.
Next Pro tips on Ruby and Heroku:
- Ruby – Testing with databasedotcoom gem
- Heroku – Useful commands
- Ruby – Extending your SF objects
- Heroku – Use Thor to handle your VARS
- Ruby – Performance boost
- Heroku – Adding a SSL Certificate