This project is an example of an application that can be continuously delivered to Heroku through a pipeline based on staging and production environments.
Installing and running locally
- Clone the repo
pip install -r requirements.txt(preferably inside a virtualenv) to install the dependencies
foreman start [-p port]to run the “hello” app locally
noseteststo run the unit test
- Refer to the Heroku docs for information on deploying to Heroku from the command line
Deployment with CircleCI
First, sign up for CircleCI if you haven’t already, fork the repo, and follow it from CircleCI. There is a detailed doc in the CircleCI docs about deployment to Heroku. But the three simple steps you need to perform are:
- Enter your Heroku API key in the “Heroku” section of the settings for your project on CircleCI
- Setup an SSH key for deployment to Heroku (CircleCI makes this very easy)
- Configure your circle.yml file to deploy to Heroku. See circle.yml file in this project for an example (you will need to choose different app names depending on what your apps are called in Heroku).
The Continuous Delivery Pipeline
This project implements continuous delivery with a pipeline based on “staging” and “master” branches that correspond to “staging” and “prod” heroku environments respectively. Feature branches that are ready to merge can first go into staging, where they will built by CircleCI and automatically deployed to the Heroku staging environment. Once deployed to staging, any number of automated or even manual tests can be run before merging into master to push new features into production. Each merge is performed manually in this project, but the merge from staging to master, for example, could be automated.
- The virtualenv and virtualenvwrapper docs
- Getting Started with Python on Heroku and Managing Multiple Environments for an App articles from the Heroku Dev Center
- Testing Flask Applications from the Flask docs
- The nose documentation for more information about the nose test runner
- Continuous Deployment with Heroku from the CircleCI docs.