Skip to content

Local Setup

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

Prerequisites

  • Docker and Docker Compose
  • SSH access to GitHub (for cloning)
  • SSH access configured for packagist.subscribed.build (for private Composer packages)

Verify Docker is installed:

docker -v
docker compose version

Steps

1. Clone the repository

git clone git@github.com:subscribed-aps/elome-com-bedrock.git
cd elome-com-bedrock

2. Configure the root .env

The root .env controls Docker (container names, ports, project name):

cp .env.example .env

Adjust values as needed — particularly PROJECT_NAME, PROJECT_URI, WP_HOME, and any port mappings if you have conflicts.

3. Install Composer dependencies

Dependencies are installed inside the container, but you can also run Composer locally if you have PHP 7.4+ available:

cd site
composer install

Make sure your SSH key is added to the agent (ssh-add ~/.ssh/your_key) so Composer can authenticate against packagist.subscribed.build.

4. Start Docker containers

From backend/, create the log files first, then start the stack:

sh devops/prepare-logs.sh
docker compose up -d

system/logs/ is gitignored. If its log files are missing when the containers start, Docker creates them as empty directories and nginx won't start. prepare-logs.sh creates them, and it's safe to run again.

This starts: - PHP-FPM — application container - Nginx — web server - Redis — object cache - MariaDB (if included in your local override)

5. Seed the database

cd site/docker/wp
./dev-setup.sh

This script: - Creates the database if it doesn't exist - Imports the dev schema (docker/wp/data/dev-schema.sql): all tables, plus products, pages, menus, categories and prices from staging. It holds no users, orders or keys. Re-running resets content, options and lookups to the seed, as before. That includes wp_posts and the comment tables, so legacy orders stored as posts, order notes and local reviews are reset too. The dump enables HPOS, so new orders live in wc_orders and survive, like users and other plugin tables. Local posts get IDs from 10,000,000, so they never collide with staging's. To refresh it from a new staging dump, run docker/wp/data/build-dev-schema.sh <staging-dump.sql>. - Installs WordPress via WP-CLI if not already installed - Activates required plugins and the theme - Runs database migrations

Default dev credentials (set in .env): - URL: value of WP_HOME in your .env - Username: DEV_EMAIL (default: dev@subscribed.local) - Password: ADMIN_PASSWORD (default: glatteboller)

6. Access the site

Open the URL defined in WP_HOME in your .env. The WordPress admin is at {WP_HOME}/wp/wp-admin/.

Environment Variables

The project uses a layered env setup:

File Purpose
.env Root env for Docker (ports, container names)
site/.env WordPress application env (loaded by Bedrock)
site/.env.vault Encrypted vault file (committed to repo)
site/.env.override Local overrides (gitignored)

The DOTENV_KEY secret is used to decrypt .env.vault at runtime. For local development, you can place values directly in site/.env or site/.env.override.

Useful Commands

# Run WP-CLI inside the PHP container
docker exec -it <php-container-name> wp <command> --allow-root

# Run tests
cd site && composer test

# Run code style checks
cd site && vendor/bin/phpcs

# Tail PHP logs
tail -f system/logs/bedrock-debug.log

Troubleshooting

  • Composer auth errors — Ensure your SSH key is loaded: ssh-add -l. The packagist server requires SSH access.
  • Port conflicts — Edit the port variables in .env (e.g. NGINX_CONTAINER_PORT, REDIS_CONTAINER_PORT).
  • Nginx keeps restarting — The log files in system/logs/ were probably created as directories (ls -la system/logs). docker logs shows nothing, because logging is set to none. Fix it and recreate the containers:
    sh devops/prepare-logs.sh
    docker compose up -d --force-recreate nginx php
    
    On Linux, Docker creates those directories as root. If so, the script stops and prints the sudo chown command that hands system/logs back to your user. Run it, then run the script again.
  • Database not found — Re-run dev-setup.sh, or manually create the DB: docker exec -it <mariadb-container> mariadb -uroot -p.