Skip to content

Deployment

Deployments are handled via GitHub Actions using the shared reusable workflow from subscribed-aps/workflows.

Workflow

The deployment workflow is defined in .github/workflows/deploy-bedrock.yml.

Deployments are manually triggered via workflow_dispatch from the GitHub Actions UI. You select the target branch/environment before running.

Environment Branch Description
develop develop Staging / QA environment
master master Production

How it works

  1. The workflow calls the shared deploy-bedrock.yml reusable workflow from subscribed-aps/workflows.
  2. The shared workflow handles SSH access, Composer installs, symlinking releases, and running WP-CLI migrations.
  3. Releases are stored under system/releases/ on the server. The deployment script submodule at devops/deployment-script provides the server-side logic.
  4. Shared persistent directories (web/app/uploads, web/app/languages) are symlinked from a shared location on the server rather than being included in each release.

Triggering a deployment

  1. Go to Actions → Deploy Bedrock in the GitHub repository.
  2. Click Run workflow.
  3. Select the target environment (develop or master).
  4. Click Run workflow.

Required secrets

The following secrets must be set in the GitHub repository settings:

Secret Description
SSH_PRIVATE_KEY SSH key with access to the production server
KNOWN_HOSTS SSH known_hosts entry for the server
Any secrets consumed by the shared workflow See subscribed-aps/workflows for the full list

Release structure on the server

/var/www/<project>/
├── current -> releases/<timestamp>/   # Symlink to active release
├── releases/
│   ├── 20250702-151830-15dbf32/
│   └── ...                            # Last 3 releases kept
└── shared/
    ├── .env
    ├── web/app/uploads/
    └── web/app/languages/

Deploy keys

php-entrypoint.sh reads 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 (ELEMENTOR_EMAIL=). The deploy then removes the stored Composer login. Clearing ELEMENTOR_EMAIL or ELEMENTOR_LICENSE stops the deploy, because nothing is installed without them, so the live release stays untouched.

The keys are only used for the Composer config during the deploy. WordPress loads its settings the same way as before.

Recreating the php container

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/barberklingen/current   # shows which release is live

Only php has to be recreated. nginx resolves the php hostname once at startup, so it needs a reload (no downtime), not a recreate. php-entrypoint.sh is built into the image, so changes to it need --build on the recreate.

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/barberklingen/current)/.release-complete"'

The entrypoint uses set -e, so a failing step (Composer, the asset build or a migration) stops the deploy instead of letting a half-built release go live.