Aptible deploys all resources in Containers.
Containers run the command specified by the Service they belong to:
- If the service is an Implicit Service, then that command is the Image's
- If the service is an Explicit Service, then that command is defined by the Procfile.
Containers run with three types of environment variables and if there is a name collision, Aptible Metadata takes precedence over App Configuration, which takes precedence over Docker Image Variables:
Docker Image Variables
Docker Images define these variables via the
ENV directive. They are present when your Containers start:
Aptible injects an App's Configuration as environment variables. For example, for the keys
aptible config:set --app "$APP_HANDLE" \ FOO=SOME BAR=OTHER
Aptible runs containers with the environment variables
BAR set respectively to
Finally, Aptible injects a set of metadata keys as environment variables.
These environment variables are accessible through the facilities exposed by the language, such as
ENV in Ruby,
process.env in Node, or
os.environ in Python.
Aptible (and Docker in general) sets the hostname for your Containers to the 12 first characters of the Container's ID and uses it in Logging and Metrics.
Containers on Aptible are isolated. Use one of the following options to allow multiple Containers to communicate:
- For web APIs or microservices, set up an Endpoint and direct your requests to the Endpoint.
Containers on Aptible are frequently recycled during Operations - meaning new Containers are created during an Operation, and the old ones are terminated. This happens within the following Operations:
- Redeploying an App
- Restarting an App or Database
- Scaling an App or Database
With the notable exception of Database data, the filesystem for your Containers is ephemeral. As a result, any data stored on the filesystem will be gone every time containers are recycled.
Never use the filesystem to retain long-term data. Instead, store this data in a Database or a third-party storage solution, such as AWS S3 (see How do I accept file uploads when using Aptible? for more information).