Skip to content

🚀 Server to handle github deployment event and process deploy inside docker

License

Notifications You must be signed in to change notification settings

luxifer/deployer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deployer

Small server that listens to github deployment event and trigger related ansible playbook inside a docker container.

Configuration

  • DEPLOYER_HIPCHAT_TOKEN (required): Hipchat API token
  • DEPLOYER_HIPCHAT_ROOM (required): Hipchat room to notify deployment
  • DEPLOYER_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 hosts
  • DEPLOYER_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)

Run

Dependencies:

  • Docker
  • RethinkDB

Runner

See https://github.com/luxifer/deployer-ansible

$ docker pull luxifer/deployer-ansible

Local

If you want to run the deployer server directly on your host:

$ go build
$ ./deployer

Docker

If 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/deployer

The 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).

Target

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 ID
  • DEPLOYER_REPO: SSH URL of the repository
  • DEPLOYER_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.

About

🚀 Server to handle github deployment event and process deploy inside docker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published