Skip to content

Local Development Setup

The stack runs entirely in Docker: PHP 7.4-FPM, Nginx, MariaDB, and Redis. The site/ directory is mounted as the WordPress document root.

Prerequisites

  • Docker Desktop (or Docker Engine + Compose v2)
  • SSH key configured for packagist.barberklingen.dk — required by Composer to pull private packages
  • Git (with submodule support)

1. Clone the repository

git clone --recurse-submodules git@github.com:subscribed-aps/barberklingen-se-bedrock.git
cd barberklingen-se-bedrock

If you already cloned without --recurse-submodules:

git submodule update --init --recursive

2. Configure environment variables

The root .env file controls Docker container names, ports, and WordPress config.

cp .env.example .env

Key variables to review in .env:

Variable Default Notes
PROJECT_ENV prod Set to local for local dev with SSL, dev for plain HTTP
NGINX_CONTAINER_PORT (set in env) Port Nginx binds on the host
WP_HOME http://barberklingen.se-local Must match your local hostname
DB_NAME / DB_USER / DB_PASSWORD barberklingen MariaDB credentials

3. Docker Compose override (local)

The docker-compose.override.yml mounts the site/ directory into the containers and adds the MariaDB service. Copy the example:

cp docker-compose.override.yml.example docker-compose.override.yml

The override file is git-ignored — it is machine-specific.

There are two sets of Dockerfiles under devops/:

  • devops/local/ — includes self-signed SSL certificates for barberklingen.se-local
  • devops/dev/ — plain HTTP, no certs

Set PROJECT_ENV=local or PROJECT_ENV=dev in .env accordingly.

4. Install Composer dependencies

SSH agent forwarding must be available inside the container so Composer can reach packagist.barberklingen.dk.

docker compose run --rm php composer install -d /var/www/barberklingen/current

Or, if you have Composer locally and SSH configured:

cd site && composer install

5. Start the stack

docker compose up -d

Check that all containers are healthy:

docker compose ps

6. WordPress setup

If starting from a fresh database, import a database dump or run the WP installer at http://barberklingen.se-local/wp/wp-admin/install.php.

WP-CLI is available inside the PHP container:

docker compose exec php wp --path=/var/www/barberklingen/current/web/wp <command>

For example, to run the Barberklingen database migrations after a deploy:

docker compose exec php wp barberklingen database migrate

7. Accessing the site

The URL depends on WP_HOME in your .env. The default is http://barberklingen.se-local. If using the local devops environment (with SSL), it will be https://barberklingen.se-local.

Add the hostname to /etc/hosts if needed:

127.0.0.1  barberklingen.se-local

Useful commands

# View logs
docker compose logs -f php
docker compose logs -f nginx

# Rebuild containers after Dockerfile changes
docker compose up -d --build

# Stop everything
docker compose down

# Stop and remove volumes (wipes database)
docker compose down -v

Submodules

The project has two Git submodules:

Path Purpose
system/shared-cronjobs Shared cron scripts across Barberklingen projects
devops/deployment-script Server-side deployment script used by GitHub Actions

Run git submodule update --remote to pull the latest submodule commits.