An example application for how you can integrating content migrations in your continuous delivery pipeline. This specfic example showcases using Contentful with CircleCI to manage content model changes.
This example deploys a simple flask site integrated with Contentful onto Heroku utilizing CircleCi.
You can read our tutorial that outlines showcases how to utilize this repository, our conceptual guide on how to broadly utilize Contentful Environments inside your continuous delivery pipeline, or checkout our GitHub Action example that takes advantage of GitHub Actions rather than CircleCI.
To use the continuous delivery pipeline of this 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
- 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
- HEROKU_LOGIN
- 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) 2019 Contentful GmbH. Code released under the MIT license. See LICENSE for further details.