This code is for usage with the Continuous Delivery Environments Tutorial. The completed example application for how you can integrating content migrations in your continous delivery pipeline can be found at https://github.com/contentful-labs/continous-delivery-environments-example.
To use this project project you need accounts for the following services:
- Python3
- Node 8.0+
- Contentful
- CircleCI
- Heroku
And to automate the Contentful operations install the Contentful CLI globally using npm.
npm install -g contentful-cli
Use the contentful login
command to authenticate the CLI with Contentful.
contentful login
- Fork and clone this repository
- Create a new space using the Contentful CLI
$ contentful space create --name "continuous delivery example"
- Set the newly created space as default space for all further CLI operations
$ contentful space use
(this will present you with a list of all available spaces – choose the one you just created)
- Import the provided content model (
./import/export.json
) into the newly created space$ contentful space import --content-file ./import/export.json
- Create a virtual environment
$ virtualenv env
- Activate the virtual environment
source env/bin/activate
- Install all Python dependencies
pip install -r requirements.txt
- Start the Flask app
python myapp.py
- Rename config file
.env.example
to.env
and add missing keys
- Implement Steps in the Continuous Delivery Environments Tutorial
- Add this repository as a project on CircleCI
- Create an API Key on Heroku
- Define the following environment variables on CircleCI:
- DELIVERY_API_KEY
- HEROKU_API_KEY
- MANGEMENT_API_KEY
- SPACE_ID
- Update the HEROKU_APP variable in the config.yml file with your heroku app name.
- Hit deploy on CircleCI
Copyright (c) 2018 Contentful GmbH. Code released under the MIT license. See LICENSE for further details.