Small server that listens to github deployment event and trigger related ansible playbook inside a docker container.
DEPLOYER_HIPCHAT_TOKEN(required): Hipchat API tokenDEPLOYER_HIPCHAT_ROOM(required): Hipchat room to notify deploymentDEPLOYER_RETHINK_HOST(required): RethinkDB (<host>:<port>)DEPLOYER_HOST(required): Host (https?://<domain>)DEPLOYER_SSHKEY_PATH(required): SSH key path allowed to clone the repository and access the target deployment hostsDEPLOYER_GITHUB_TOKEN(optional): Github API token (required for private repos)DEPLOYER_DOCKER_HOST(optional): Docker host (default to: unix:///var/run/docker.sock)DEPLOYER_BIND(optional): IP to bind to (default: 0.0.0.0)PORT(optional): Port to bind to (default: 4567)
Dependencies:
- Docker
- RethinkDB
See https://github.com/luxifer/deployer-ansible
$ docker pull luxifer/deployer-ansibleIf you want to run the deployer server directly on your host:
$ go build
$ ./deployerIf you want to run the deployer server inside a container:
$ docker build -t luxifer/deployer .
$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name deployer [OPTIONS] luxifer/deployerThe server does not need to be run as a privileged container because it will not create child container but sibling. That's why we have to share the docker socket (if only the target docker server listen on a socket).
Create a webhook on the github target you want to deploy who points to DEPLOYER_HOST/event_handler.
Create a shell script called deployer at the root of the repository. In this script you will have the following env var available:
DEPLOYER_ID: Github deployment IDDEPLOYER_REPO: SSH URL of the repositoryDEPLOYER_TASK: Task to run (default: deploy)DEPLOYER_ENV: Environment to deploy (default: production)DEPLOYER_REF: Ref to deploy (default: master)
In this shell script you may only call ansible modules and/or playbooks.