Defining Services

There are two ways to provide Enclave with the list of Services for your App:

Implicit Service (CMD)

If your App’s Image includes a CMD declaration, a single implicit cmd service will be created for it when you deploy your App.

Containers for the implicit cmd Service will simply execute the CMD your image defines. If you’ve started Containers for your image locally using docker run my-image, this does the exact same thing!

Typically, the CMD declaration is something you’d add in your Dockerfile, like so:

FROM alpine:3.5
ADD . /app
CMD ["/app/run"]

Tip

Using an implicit service is recommended if your App only has one Service.

Explicit Services (Procfiles)

Warning

As you’d expect, no Implicit Service (CMD) will be created for your App when you use Explicit Services.

If your App needs multiple Services, you can provide Enclave with a Procfile that indicates which services should be started when your App is deployed.

Broadly speaking, the Procfile contains a list of declarations, mapping service names to the commands the Containers for this service should run:

web: /app/run-web
worker: /app/run-worker

When your App Containers start, they’ll execute the command defined in your Procfile.

However, this command will be interpreted using a shell (/bin/sh, specifically). This has two implications:

First, this means you can use shell syntax in a Procfile line, like this:

web: /app/prepare && /app/run-web "$ENVIRONMENT"

Second, this means a shell will be running as PID 1 in container. Occasionally, this may not desirable.

Tip

Review Procfiles For Procfile syntax and examples.

Note

If you are using Direct Docker Image Deploy, you’ll need a Companion Git Repository to use a Procfile.