fleet Documentation

Deploying a Service Using fleet

The following is an example of how one might deploy a load-balanced web service using fleet.
This example deploys subgun, a simple subscription tool for mailgun.

subgun is deployed in two pieces: an application and a presence daemon. The application simply serves HTTP requests through an AWS load balancer, while the presence daemon updates the load balancer with backend information. The diagram below illustrates this model:

Containers

Both components are deployed in docker containers running on CoreOS. The following Dockerfiles were each built and their resulting images pushed to the public docker index:

Service Files

With the docker images available over the public internet, systemd can simply run the containers.

The following unit files are templates, which means they can be run multiple times by referencing them with full instance names. You can find these unit files in the unit-examples repository. To save time, clone the repo on the machine from which you are controlling fleet.

If you are going to modify these units, be sure you don't copy a docker run command that starts a container in detached mode (-d). Detached mode won't start the container as a child of the unit's pid. This will cause the unit to run for just a few seconds and then exit.