Skip to main content

Lagoon

Variable definitions

Accessing private GitLab composer packages

In order to install the private packages used by Gesso Lagoon needs access to our private registry.

  1. We need to create a group access token for the Gesso group in GitLab. Ensure you give the token a good name so that it is easy to manage token rotation and expiry in the future. (e.g. Project Name - Lagoon Deploy).
Imporant
  • The access token must have the Reporter role.
  • The access token must have read_registry access.
  1. Once you have created your projects access token add it as a variable in lagoon:
lagoon -p PROJECT_NAME add variable -N GITLAB_REGISTRY_TOKEN -S build -V YOUR_TOKEN

  1. Ensure in your Dockerfile (likely cli.Dockerfile) you pass in the new Lagoon variable as an ARG. You can then use it in your composer config.

Example:

# cli.Dockerfile
FROM uselagoon/php-8.1-cli-drupal:latest

################
# Add this line!
#
ARG GITLAB_REGISTRY_TOKEN

COPY . /app

###################
# Add this as well!
#
RUN if [[ -n "${GITLAB_REGISTRY_TOKEN}" ]] ; then \
composer config gitlab-token.git.acromedia.com ${GITLAB_REGISTRY_TOKEN}; \
fi

RUN COMPOSER_MEMORY_LIMIT=-1 composer self-update
RUN COMPOSER_MEMORY_LIMIT=-1 composer install --no-dev

RUN mkdir -p -v -m775 /app/web/sites/default/files

# Define where the Drupal Root is located
ENV WEBROOT=web

If everything above was configured correctly deployments with your private composer packages should now succeed!