Skip to main content

Lagoon deployment

Lagoon deployment triggers a deployment on the Lagoon hosting platform using the Lagoon CLI.

How it works

When lagoon is included in $VORTEX_DEPLOY_TYPES, the deployment script downloads the Lagoon CLI, points it at the configured Lagoon instance, and requests a deployment for the current branch or pull request over SSH. Lagoon then:

  1. Pulls the latest code from your repository
  2. Builds container images using your docker-compose.yml
  3. Deploys containers to Kubernetes
  4. Runs post-rollout tasks defined in .lagoon.yml

Tag deployments are not supported by Lagoon - the script reports this and skips the deployment.

Configuration

Environment variables

VariableRequiredDefaultLocationDescription
VORTEX_DEPLOY_LAGOON_PROJECTYesValue of LAGOON_PROJECT.envYour Lagoon project name
VORTEX_DEPLOY_LAGOON_INSTANCENoamazeeio.envLagoon instance name
VORTEX_DEPLOY_LAGOON_INSTANCE_GRAPHQLNohttps://api.lagoon.amazeeio.cloud/graphql.envLagoon GraphQL endpoint
VORTEX_DEPLOY_LAGOON_INSTANCE_HOSTNAMENossh.lagoon.amazeeio.cloud.envLagoon SSH hostname
VORTEX_DEPLOY_LAGOON_INSTANCE_PORTNo32222.envLagoon SSH port
VORTEX_DEPLOY_LAGOON_BRANCHNoValue of VORTEX_DEPLOY_BRANCHCIBranch to deploy
VORTEX_DEPLOY_LAGOON_SSH_FINGERPRINTNoValue of VORTEX_DEPLOY_SSH_FINGERPRINTCIFingerprint of the SSH key used to authenticate
VORTEX_DEPLOY_LAGOON_LAGOONCLI_VERSIONNov0.32.0CILagoon CLI version to install
VORTEX_DEPLOY_LAGOON_FAIL_ENV_LIMIT_EXCEEDEDNo0CIFail the build when the Lagoon environment limit is exceeded (1) or pass it (0)

The full list of VORTEX_DEPLOY_LAGOON_* variables, including the pull request context variables set by CI, is in the Variables reference.

Setup

  1. Add lagoon to the VORTEX_DEPLOY_TYPES variable in your .env file:

    .env
    VORTEX_DEPLOY_TYPES=lagoon
  2. Configure your Lagoon project name:

    .env
    LAGOON_PROJECT=your-project-name
  3. Ensure your CI has the Lagoon SSH key configured for authentication - the CLI connects over SSH, so a missing key fails the deployment.

Post-deployment automation

Once Lagoon rolls out the new containers, the post-rollout tasks defined in .lagoon.yml provision the site and send notifications - see Lagoon hosting for what runs.

Environments

The shipped .lagoon.yml defines environment-specific settings (cron jobs, routes) for the main and develop branches, and treats an environment as production when Lagoon marks it as such or when the branch matches VORTEX_LAGOON_PRODUCTION_BRANCH (default: main).

Which branches get an environment, their types, and pull request (ephemeral) environments are configured per project in Lagoon itself - see Lagoon environment types.

See also