A service for autodiscovery and configuration of applications running in containers
Go Shell Makefile Nginx
Latest commit 2601882 Jan 4, 2017 @deitch deitch committed with tgross Add split and join to templates (#265)
* Add split and join to templates

* Add replace, regexReplace and regexpReplace functions to template

* replaceAll instead of replace, regexReplaceAll instead of regexReplace, remove regexpReplace
Permalink
Failed to load latest commit information.
backends Expand backend and service config parsing tests Aug 5, 2016
commands Fix null-pointer exception in error handling of RunAndWait (#256) Dec 2, 2016
config Add split and join to templates (#265) Jan 4, 2017
coprocesses Ensure coprocesses do not restart once stopped (#203) Aug 12, 2016
core add logging of config object when in debug mode (#259) Jan 3, 2017
discovery add logging of config object when in debug mode (#259) Jan 3, 2017
documentation setup ConsulConfig and ConsulExtras (#252) Dec 8, 2016
integration_tests add logging of config object when in debug mode (#259) Jan 3, 2017
scripts upgrade to consul ~0.7.0 (#248) Nov 21, 2016
services setup ConsulConfig and ConsulExtras (#252) Dec 8, 2016
tasks Refactoring to allow for pollable timeout (#184) Aug 2, 2016
telemetry Fix golint complaints about error messages Nov 16, 2016
utils Fix golint complaints about error messages Nov 16, 2016
.gitignore Fix descent into src directory error Apr 8, 2016
.travis.yml Add custom install section to TravisCI Feb 18, 2016
CONTRIBUTING.md Rename Containerbuddy to ContainerPilot Apr 12, 2016
Dockerfile Convert from Godep to Glide Aug 2, 2016
LICENSE Initial commit Oct 13, 2015
README.md Fixing broken blog link reported on Twitter Jul 20, 2016
glide.lock upgrade to consul ~0.7.0 (#248) Nov 21, 2016
glide.yaml upgrade to consul ~0.7.0 (#248) Nov 21, 2016
main.go discovery: Refactory backend registration May 5, 2016
makefile setup ConsulConfig and ConsulExtras (#252) Dec 8, 2016

README.md

ContainerPilot

An application-centric micro-orchestrator that automates the process of service discovery, configuration, and lifecycle management inside the container, so you can focus on your apps.

Build Status MPL licensed

What is ContainerPilot?

ContainerPilot is an application-centric micro-orchestrator that automates the process of service discovery, configuration, and lifecycle management inside the container.

Orchestration is the automation of the operations of an application. Most application require operational tasks like connecting them to related components (WordPress needs to know where it's MySQL and Memcached servers are, for example), and some applications require special attention as they start up or shut down to be sure they bootstrap correctly or persist their data. We can do all that by hand, but modern applications automate those tasks in code. That's called "orchestration."

To make this work, every application needs to do the following (at a minimum):

  • Register itself in a service catalog (like Consul or Etcd) for use by other apps
  • Look to the service catalog to find the apps it depends on
  • Configure itself when the container starts, and reconfigure itself over time

We can write our new applications to do that, but existing apps will need some help. We can wrap each application in a shell script that registers itself with the discovery service easily enough, but watching for changes to that service and ensuring that health checks are being made is more complicated. We can put a second process in the container, but unless we make a supervisor as PID1 then there's no way of knowing whether our shimmed process has died.

ContainerPilot to the rescue!

ContainerPilot is a helper written in Go to make it easier to containerize our applications. It can act as PID1 in the container and fork/exec the application. If the application exits then so does ContainerPilot. ContainerPilot reaps zombies, runs health checks, registers the app in the service catalog, watches the service catalog for changes, and runs your user-specified code at events in the lifecycle of the container to make it all work right.

ContainerPilot is explicitly not a supervisor process. Although it can act as PID1 inside a container, it can't manage multiple services. And, if the shimmed process dies, so does ContainerPilot (and therefore the container itself). ContainerPilot will return the exit code of its shimmed process back to the Docker Engine or Triton, so that it appears as expected when you run docker ps -a and look for your exit codes. ContainerPilot also attaches stdout/stderr from your application to stdout/stderr of the container, so that docker logs works as expected.

Getting started

See the ContainerPilot documentation to get started, or jump to specific sections:

You might also read our guide building self-operating applications with ContainerPilot and look at the examples below.

Examples

We've published a number of example applications demonstrating how ContainerPilot works.

Contributing

Please report any issues you encounter with ContainerPilot or its documentation by opening a Github issue. Roadmap items will be maintained as enhancements. PRs are welcome on any issue.

Details about contributing to documentation are in documentation/CONTRIBUTING.md