Skip to content

Plausible is intuitive, lightweight and open source web analytics. No cookies and fully compliant with GDPR, CCPA and PECR. Made and hosted in the EU, powered by European-owned cloud infrastructure.

It can be self-hosted or use with their SaaS solution.

version: "3.3"
services:
plausible_db:
image: postgres:14-alpine
container_name: plausible_db
restart: unless-stopped
volumes:
- /data/apps/plausible/db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=plausible_db
- POSTGRES_PASSWORD=postgres
networks:
- homelab
plausible_events_db:
image: clickhouse/clickhouse-server
restart: unless-stopped
container_name: plausible_eventsdb
volumes:
- /data/apps/plausible/clickhouse/event-data:/var/lib/clickhouse
- /data/apps/plausible/clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
- /data/apps/plausible/clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
ulimits:
nofile:
soft: 262144
hard: 262144
networks:
- homelab
plausible:
image: plausible/analytics:latest
command: sh -c "sleep 10 && /entrypoint.sh db migrate && /entrypoint.sh run"
container_name: plausible_app
restart: unless-stopped
depends_on:
- plausible_events_db
environment:
- BASE_URL=https://plausible.raphael-catarino.fr
- SECRET_KEY_BASE=${SECRET_KEY_BASE}
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
- SMTP_HOST_ADDR=smtp.sendgrid.net
- SMTP_HOST_PORT=465
- SMTP_USER_NAME=apikey
- SMTP_USER_PWD=${SMTP_USER_PWD}
- SMTP_HOST_SSL_ENABLED=true
- DATABASE_URL=${DATABASE_URL}
ports:
- 8006:8000
networks:
- homelab
labels:
- traefik.enable=true
- traefik.http.routers.plausible.rule=Host(`plausible.raphael-catarino.fr`)
- traefik.http.services.plausible.loadbalancer.server.port=8006
- traefik.http.routers.plausible.tls=true
- traefik.http.routers.plausible.tls.certresolver=production
- traefik.http.routers.plausible.tls.domains[0].main=raphael-catarino.fr
- traefik.http.routers.plausible.tls.domains[0].sans=*.raphael-catarino.fr
networks:
homelab:
external: true

Once setuped, all you got to do is add a simple script to any applications you want to track !