web/docker-compose/docker-compose.plausible.yml

110 lines
3.9 KiB
YAML

version: '3.7'
# Based on: https://github.com/plausible/community-edition/blob/v2.1.4/compose.yml
services:
plausible_db:
image: postgres:16.3-alpine3.20
profiles: [ prod ]
restart: always
networks:
- plausible_net
volumes:
- plausible-db-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=postgres
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
start_period: 1m
plausible_events_db:
image: clickhouse/clickhouse-server:24.3.3.102-alpine
restart: always
profiles: [ prod ]
networks:
- plausible_net
volumes:
- plausible-event-data:/var/lib/clickhouse
- plausible-event-logs:/var/log/clickhouse-server
- ../plausible/clickhouse/logs.xml:/etc/clickhouse-server/config.d/logs.xml:ro
- ../plausible/clickhouse/docker.xml:/etc/clickhouse-server/config.d/docker.xml:ro
# This makes ClickHouse bind to IPv4 only, since Docker doesn't enable IPv6 in bridge networks by default.
# Fixes "Listen [::]:9000 failed: Address family for hostname not supported" warnings.
- ../plausible/clickhouse/ipv4-only.xml:/etc/clickhouse-server/config.d/ipv4-only.xml:ro
ulimits:
nofile:
soft: 262144
hard: 262144
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 -O - http://127.0.0.1:8123/ping || exit 1" ]
start_period: 1m
freedium_plausible:
image: ghcr.io/plausible/community-edition:v2.1.4
restart: always
profiles: [ prod ]
command: sh -c "/entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
networks:
- plausible_net
- caddy_freedium_net
- freedium_net
depends_on:
plausible_db:
condition: service_healthy
plausible_events_db:
condition: service_healthy
volumes:
- plausible-data:/var/lib/plausible
ulimits:
nofile:
soft: 65535
hard: 65535
environment:
- TMPDIR=/var/lib/plausible/tmp
# required: https://github.com/plausible/community-edition/wiki/configuration#required
- BASE_URL=${PLAUSIBLE_BASE_URL:-https://plausible.freedium.local}
- SECRET_KEY_BASE=${PLAUSIBLE_SECRET_KEY_BASE}
- DISABLE_REGISTRATION=${PLAUSIBLE_DISABLE_REGISTRATION}
# - DISABLE_REGISTRATION
# optional: https://github.com/plausible/community-edition/wiki/configuration#optional
# registration: https://github.com/plausible/community-edition/wiki/configuration#registration
# - TOTP_VAULT_KEY=${PLAUSIBLE_TOTP_VAULT_KEY}
# - ENABLE_EMAIL_VERIFICATION=${PLAUSIBLE_ENABLE_EMAIL_VERIFICATION}
# web: https://github.com/plausible/community-edition/wiki/configuration#web
- HTTP_PORT=${PLAUSIBLE_HTTP_PORT:-8000} # Default: 8000
# - HTTPS_PORT
# databases: https://github.com/plausible/community-edition/wiki/configuration#database
- DATABASE_URL=postgres://postgres:postgres@plausible_db:5432/plausible_db
- CLICKHOUSE_DATABASE_URL=http://plausible_events_db:8123/plausible_events_db
# Google: https://github.com/plausible/community-edition/wiki/configuration#google
# - GOOGLE_CLIENT_ID
# - GOOGLE_CLIENT_SECRET
# geolocation: https://github.com/plausible/community-edition/wiki/configuration#ip-geolocation
# - IP_GEOLOCATION_DB
# - GEONAMES_SOURCE_FILE
# - MAXMIND_LICENSE_KEY
# - MAXMIND_EDITION
# email: https://github.com/plausible/community-edition/wiki/configuration#email
# - MAILER_ADAPTER
# - MAILER_EMAIL
# - MAILER_NAME
# - SMTP_HOST_ADDR
# - SMTP_HOST_PORT
# - SMTP_USER_NAME
# - SMTP_USER_PWD
# - SMTP_HOST_SSL_ENABLED
# - POSTMARK_API_KEY
# - MAILGUN_API_KEY
# - MAILGUN_DOMAIN
# - MAILGUN_BASE_URI
# - MANDRILL_API_KEY
# - SENDGRID_API_KEY
volumes:
plausible-db-data:
plausible-event-data:
plausible-event-logs:
plausible-data:
networks:
plausible_net: