Skip to content

Local Setup

This guide walks you through running the project locally using Docker.

Prerequisites

  • Docker Desktop (with Compose v2)
  • mkcert for local SSL certificates
  • Composer (for installing PHP dependencies inside the container or locally)
  • Git (with access to the private Bitbucket/GitHub repositories and submodules)

1. Clone with submodules

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

If you already cloned without submodules:

git submodule update --init --recursive

2. Set up environment files

Copy the example env file and fill in your local values:

cp .env.example .env

Key values to set for local development:

PROJECT_ENV=local
WP_HOME=https://barberklingen.nl-local
WP_SITEURL=https://barberklingen.nl-local/wp

See Environment Variables for a full reference.

3. Set up local Docker config

Copy the example local devops config:

cp -r devops/local.example devops/local

This directory contains Nginx, PHP, and MySQL configs tuned for local use. You can customise them without affecting other environments.

4. Generate SSL certificates

mkcert -install
cd devops/local/nginx/certs
mkcert barberklingen.nl-local

The generated .pem files are referenced by the Nginx config in devops/local/nginx/default.conf.

5. Set up Docker Compose override

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

The override file mounts the site/ directory directly as current so code changes are reflected immediately without a deployment cycle.

6. Install Composer dependencies

cd site
composer install
cd ..

Note: You need access to the private Composer registry at packagist.barberklingen.dk and to Elementor's Composer repo. Make sure your credentials are configured in ~/.composer/auth.json.

7. Start the containers

docker compose up -d

This starts: - php — PHP-FPM container - nginx — serves the site over HTTPS - redis — object cache - mariadb — database (added via the override file)

8. Import a database

Use WP-CLI or a direct MySQL import to load a database dump:

# Via WP-CLI inside the PHP container
docker compose exec php wp db import /path/to/dump.sql --path=/var/www/barberklingen/current/web/wp

# Or via mysql client
docker compose exec mariadb mysql -u barberklingen -pbarberklingen barberklingen < dump.sql

9. Update the site URL (if importing from production)

docker compose exec php wp search-replace 'https://www.barberklingen.nl' 'https://barberklingen.nl-local' \
  --path=/var/www/barberklingen/current/web/wp --allow-root

Useful WP-CLI commands

# Run a WP-CLI command inside the PHP container
docker compose exec php wp <command> --path=/var/www/barberklingen/current/web/wp

# Flush object cache
docker compose exec php wp cache flush --path=/var/www/barberklingen/current/web/wp

# Run database migrations
docker compose exec php wp barberklingen database migrate --path=/var/www/barberklingen/current/web/wp

Stopping / resetting

# Stop containers
docker compose down

# Remove containers and volumes (full reset)
docker compose down -v