Aptible PaaS logoDocs

Containers

Aptible deploys all resources in Containers.

Container Command

Containers run the command specified by the Service they belong to:

Container Environment

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:

ENV FOO=BAR

App Configuration

Aptible injects an App's Configuration as environment variables. For example, for the keys FOO and BAR:

aptible config:set --app "$APP_HANDLE" \
  FOO=SOME BAR=OTHER

Aptible runs containers with the environment variables FOO and BAR set respectively to SOME and OTHER.

Aptible Metadata

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.

Container Hostname

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.

Container Isolation

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.
  • For background workers, use a Database as a message queue. Aptible supports Redis and RabbitMQ, which are well-suited for this use case.

Container Lifecycle

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

Filesystem Implications

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).

Learn More About Containers