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:
- Pulls the latest code from your repository
- Builds container images using your
docker-compose.yml - Deploys containers to Kubernetes
- 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
| Variable | Required | Default | Location | Description |
|---|---|---|---|---|
VORTEX_DEPLOY_LAGOON_PROJECT | Yes | Value of LAGOON_PROJECT | .env | Your Lagoon project name |
VORTEX_DEPLOY_LAGOON_INSTANCE | No | amazeeio | .env | Lagoon instance name |
VORTEX_DEPLOY_LAGOON_INSTANCE_GRAPHQL | No | https://api.lagoon.amazeeio.cloud/graphql | .env | Lagoon GraphQL endpoint |
VORTEX_DEPLOY_LAGOON_INSTANCE_HOSTNAME | No | ssh.lagoon.amazeeio.cloud | .env | Lagoon SSH hostname |
VORTEX_DEPLOY_LAGOON_INSTANCE_PORT | No | 32222 | .env | Lagoon SSH port |
VORTEX_DEPLOY_LAGOON_BRANCH | No | Value of VORTEX_DEPLOY_BRANCH | CI | Branch to deploy |
VORTEX_DEPLOY_LAGOON_SSH_FINGERPRINT | No | Value of VORTEX_DEPLOY_SSH_FINGERPRINT | CI | Fingerprint of the SSH key used to authenticate |
VORTEX_DEPLOY_LAGOON_LAGOONCLI_VERSION | No | v0.32.0 | CI | Lagoon CLI version to install |
VORTEX_DEPLOY_LAGOON_FAIL_ENV_LIMIT_EXCEEDED | No | 0 | CI | Fail 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
-
Add
lagoonto theVORTEX_DEPLOY_TYPESvariable in your.envfile:.envVORTEX_DEPLOY_TYPES=lagoon -
Configure your Lagoon project name:
.envLAGOON_PROJECT=your-project-name -
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
- Lagoon hosting - platform integration, environment detection, and routine operations
- Lagoon documentation - official Lagoon docs