Skip to content

Deployment

CI/CD — Bitbucket Pipelines

Automated deployments are triggered via Bitbucket Pipelines (bitbucket-pipelines.yml at repo root). It imports a shared reusable pipeline:

Branch Pipeline Target
develop deploy-develop Staging
master deploy-master Production

Pipelines run on push to the respective branch. No manual action needed for routine deploys.

Manual deploy — GitHub Actions

A manual workflow is available at .github/workflows/deploy-bedrock.yml. Trigger it from the GitHub Actions UI:

  1. Go to Actions → Deploy Bedrock
  2. Click Run workflow
  3. Select develop (staging) or master (production)

This calls the shared reusable workflow at subscribed-aps/workflows.

What gets deployed

The deploy process: 1. Checks out the repo on the target server into a timestamped release directory under system/releases/ 2. Runs composer install (no dev dependencies). The licensed setasign/fpdi_pdf-parser needs a Setasign token in the Composer config of the account that runs the install (composer config --global bearer.www.setasign.com <SETASIGN_TOKEN>, or SETASIGN_TOKEN in the project root .env for the Docker entrypoints — see Deploy keys) 3. Symlinks shared files (.env) and directories (web/app/uploads, web/app/languages, web/app/cache, web/app/wp-rocket-config) 4. Atomically switches the current symlink to the new release 5. Runs post-deploy WP-CLI commands (wp core update-db, wp barberklingen database migrate) 6. Cleans up old releases (3 kept)

Deploy keys

php-entrypoint.sh reads SETASIGN_TOKEN, ELEMENTOR_EMAIL and ELEMENTOR_LICENSE from the project root .env on every deploy. The project root is mounted read-only in the php container at /run/project. To add or change one of these keys, edit the root .env and run the deploy. You don't need to recreate the container. To revoke a key, set it to an empty value (SETASIGN_TOKEN=). The deploy then removes the stored Composer login.

The keys are only used for the Composer config during the deploy. WordPress still loads its settings the same way as before (see environment-configuration.md).

Recreating the containers

The releases live in system/releases and survive a recreate. The current symlink lives inside the container and does not. When php or nginx starts without one, devops/restore-current.sh points current at the newest release where php-entrypoint.sh ran to the end. The entrypoint marks such a release with .release-complete. While a deploy is running, the release has .release-incomplete, so a release whose deploy failed is skipped, also by the fallback. Releases from before the marker existed fall back to the newest one that has vendor/ and WordPress core. The site keeps running on the last good release until the next deploy.

docker compose up -d --force-recreate php
docker compose exec nginx nginx -s reload                     # nginx looks up the new php container's IP
docker compose exec php readlink /var/www/<project>/current   # shows which release is live

The first time you recreate php after this change, mark the live release first. Run this while php still has its current symlink. Then a newer release that failed after Composer can't be picked by the fallback:

docker compose exec php sh -c 'touch "$(readlink -f /var/www/<project>/current)/.release-complete"'

Only php has to be recreated, for example to pick up a change to its mounts or env_file. nginx resolves the php hostname once at startup, so it needs a reload (no downtime), not a recreate.

Environment secrets

Production and staging secrets are stored encrypted in site/.env.vault. The DOTENV_KEY for each environment must be set as a server-side environment variable (or CI secret) for decryption to work at runtime.

See environment-configuration.md for details on how .env.vault works.

Sentry release tracking

On production deploys, a Sentry release is created automatically via the deploy pipeline, linking the deploy to the Git commit SHA in the barberklingen-aps / barberlingen-dk Sentry project.