Docker Compose for Plausible Analytics
Plausible Analytics with PostgreSQL and ClickHouse. Privacy-friendly web analytics.
plausible analytics postgres privacy
compose.yaml
services:
plausible:
image: ghcr.io/plausible/community-edition:latest
ports:
- target: 8000
mode: ingress
environment:
- BASE_URL=https://analytics.example.com
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/plausible
- CLICKHOUSE_DATABASE_URL=http://events:8123/plausible_events
healthcheck:
test:
- CMD
- curl
- -f
- http://localhost:8000/
interval: 30s
timeout: 5s
retries: 3
depends_on:
- db
- events
deploy:
resources:
reservations:
cpus: "0.5"
memory: 256M
restart: unless-stopped
db:
image: postgres:16
ports:
- target: 5432
mode: host
environment:
- POSTGRES_DB=plausible
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
reservations:
cpus: "0.5"
memory: 256M
restart: unless-stopped
x-defang-postgres: true
events:
image: clickhouse/clickhouse-server:latest
ports:
- target: 8123
mode: host
healthcheck:
test:
- CMD
- wget
- --spider
- -q
- http://localhost:8123/ping
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
reservations:
cpus: "0.5"
memory: 512M
restart: unless-stopped
Services
- plausible ghcr.io/plausible/community-edition:latest
- db postgres:16
- events clickhouse/clickhouse-server:latest