Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save johnfmorton/09e6c88df46e37be8baea4546cf4139b to your computer and use it in GitHub Desktop.
Save johnfmorton/09e6c88df46e37be8baea4546cf4139b to your computer and use it in GitHub Desktop.
Plausible Analytics Docker Compose file for Laravel Forge using Traefik for routing traffic
version: "3.3"
services:
mail:
image: bytemark/smtp
networks:
- default
restart: always
plausible_db:
# supported versions are 12, 13, and 14
image: postgres:14-alpine
restart: always
networks:
- default
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=postgres
plausible_events_db:
image: clickhouse/clickhouse-server:22.8.13.20-alpine
restart: always
networks:
- default
volumes:
- event-data:/var/lib/clickhouse
- ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
- ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
ulimits:
nofile:
soft: 262144
hard: 262144
plausible:
image: plausible/analytics:latest
container_name: "analytics"
restart: always
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
depends_on:
- plausible_db
- plausible_events_db
- mail
ports:
- 8000:8000
env_file:
- .env
networks:
- default
- proxy
labels:
traefik.enable: "true"
# Relies on BASE_URL in .env file, i.e., BASE_URL=https://analytics.domain.com - note this includes https://
traefik.http.routers.plausible.rule: "Host(`${BASE_URL}`)" # change to your domain name
traefik.http.routers.plausible.entrypoints: "websecure"
traefik.http.routers.plausible.tls.certresolver: "leresolver"
# commented out because I don't want to use the port number on my URL
#traefik.http.services.plausible.loadbalancer.server.port: "8000"
traefik.docker.network: "proxy"
volumes:
db-data:
driver: local
event-data:
driver: local
geoip:
driver: local
networks:
default:
proxy:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment