Local Development Setup
This guide walks you through setting up the backend environment on your local machine using Docker.
Environment Setup
Section titled “Environment Setup”-
Create Docker Compose Override File
Create a file named
docker-compose.override.ymlin thebackenddirectory and add the following content. This file customizes the setup for local use, for example by mounting local volumes.services:caddy:volumes:- ./Caddyfile.local:/etc/caddy/Caddyfile- ./caddy_certs:/etc/caddy/certspostgres:volumes:- postgres_data:/var/lib/postgresql/data- ./db-init:/docker-entrypoint-initdb.dhealthcheck:test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]plausible_events_db:volumes:- clickhouse_data:/var/lib/clickhouse- ./clickhouse/users.xml:/etc/clickhouse-server/users.d/users.xml:ro -
Create Local Caddyfile
Create a file named
Caddyfile.localand copy the contents ofCaddyfileinto it. InCaddyfile.local, you must disable TLS for local development by commenting out thetlsdirective:# tls /etc/caddy/certs/cert.pem /etc/caddy/certs/key.pem -
Create Environment File
Create a
.envfile by copying the.env.example. Fill in all the required environment variables. -
Launch Services
Launch Docker Desktop, then run the following command from the
backenddirectory to start all the services in the background:Terminal window docker-compose up -dOnce the services are running, you can access them at:
- Directus:
http://localhost:8055 - Plausible:
http://localhost:8000
- Directus:
-
Export Schema Changes
Before committing any changes to the Git repository, if you have made any modifications to the Directus schema, you must export them by running the following script:
Terminal window ./snapshots/export.sh