Automated deploys for CKAN
Ansible roles for automating deploys and rollbacks for CKAN custom installations that need to manage several extensions on active development, and that need to be deployed into several environments.
Summary
This set of roles and scripts provides a framework when working on custom developments of CKAN which involve setting up, developing and deploying several extensions. The main issues it tries to solve are:
- Deploying releases of several CKAN extensions in a capistrano-like way. Each of them coming from different origins:
- Open source extensiones developed outisde your organization
- Forked open source extensions adapted for our use case
- Private extensions developed by your organization
- Ability to easily rollback a failed deploy
- Encapsulating Python packages dependencies for each of the deploys (we used virtualenv for this), avoiding possible conflicts when releasing a new version.
- Deploying some minor changes to the CKAN core we needed, without forking CKAN.
- Deploying to several environments (production and staging), without duplicating the tasks for each of this roles.
Repository organization
The repository is organized as follows:
bin/
# easy-to-run scripts for each action
production_deploy.sh
production_first_deploy.sh
staging_deploy.sh
staging_first_deploy.sh
sites/
ckan/
files/
tasks/
# tasks for cold deploy, deploy and rollback
deploy.yml
first_deploy.yml
main.yml
rollback.yml
templates/
# CKAN config file, parameterized for each environment
ckan_config.ini.j2
vars/
# encrypted vaults for each environment
production_secrets.yml
secrets.yml.example
staging_secrets.yml
ckan_production.yml
ckan_staging.yml
inventory.example
inventory
Assumed setup
We assume you have installed CKAN following the official guide. In our case, we did it with CKAN 2.7.2 on a **CentO