Introduction to Stacks

A stack is a definition file that describe an environment as code, written in JSON or YAML.

They are similar to a Docker compose file or Helm chart, in that they describe the deployment of multiple containers and their configurations, volumes, etc. but go beyond either of those formats by describing everything available within an environment on Cycle.

The Stack File

Stacks are written using JSON or YAML, and can either be uploaded directly using the Portal or Platform API , or by creating a cycle.json or cycle.yaml file in a git repository and using it as the stack source.

The stack file can describe every aspect of an environment, from the containers and their configurations, to the scoped variables, load balancer configurations and other service configurations in a single file.

Stacks can be used to deploy the same 'application' multiple times, or as deployments multiple times to the same environment.

Stack Spec

The stack spec defines what fields are available within a stack file.

Stack Builds

A stack build is a deployable snapshot of a stack. It contains all the built images and configurations, and is deployed directly to an environment, or as a deployment within an existing environment. Stack builds are atomic and should hold everything they need to run correctly.

Deploying Stack Builds

When deploying a stack build, there are a few options available for how containers are treated in the target environment:

  • Reimage: If a container in the target environment matches a container in the stack and this option is enabled, the target container will be reimaged to the stack container's image.
  • Reconfigure: If a container in the target environment matches a container in the stack and this option is enabled, the target container's settings will be updated to match the settings defined in the stack.

These options can be set on a per-container basis.

There are a few options for scoped variables when deploying a stack build as well:

  • Add New: If a scoped variable is not found in the target environment and this option is enabled, it will be created.
  • Replace Existing: If a scoped variable defined in the stack matches the identifier of a scoped variable in the target environment and this option is enabled, the scoped variable will be updated to match the stack value.

Deployments

A stack build can be deployed as a new deployment within the environment. Using this pattern, as applications are updated, new builds can be generated and the build deployed, tested, and verified before promoting to production.

Build Logs

Every build will generate a build log that contains all the output generated when building the images associated with the stack.

Stack File Examples

Access Control Lists

Stacks support ACLs.

Get Started with Stacks

Get started by creating and deploying stacks using one of the interface-specific guides: