deployer

command module
v0.0.0-...-2818a4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2017 License: MIT Imports: 31 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL