This applications runs a simple express.js server which can listen github push webhooks.
You need to provide a couple of environment variables:
GITHUB_BRANCH
: Just listen push webhook events on this branch.GITHUB_SECRET
: Webhook secret to decrypt github payload.
When a webhook is received the applications runs the build-app.sh
script. This script perfoms the following steps:
- Clone the github repo and move the HEAD to the last branch commit.
- Build
decidim
docker image and push it to Docker Hub. - Use the previous image to run
decidim
generator and creates a test application. - Build decidim test application docker image and push it to Docker Hub.
- Use rancher CLI to upgrade the service running decidim test application.
The script itself is running Docker through a Rancher host and it can be highly configured using the script environment variables.
In order to build the docker image you need some credentials. Rancher credentials can be found on $HOME/.rancher/cli.json
and Docker credentials on $HOME/.docker/config.json
.
docker build --build-arg rancherAccessKey=xxxx
--build-arg rancherSecretKey=xxxx
--build-arg rancherUrl=xxxx
--build-arg dockerAuth=xxxx
-t codegram/decidim-app-builder .
Since the image is storing sensitive data it is recommended to use a private docker registry.
- Create some kind of queue in order to handle multiple webhooks.
- Support for multi-deployments.
MIT License, see LICENSE for details. Copyright 2012-2016 Codegram Technologies.