Some checks failed
cc-ci/testme cc-ci: failure
Replaces the previous best-effort (|| true) approach: a deploy without clickhouse-backup would have silently broken backup/restore, so the entrypoint now hard-fails (visibly, in service logs) if the tool truly cannot be installed — but makes that case effectively unreachable: - cache the VERIFIED binary on the persistent clickhouse volume, keyed by version: downloaded at most once per app; container restarts never re-fetch (kills the re-download amplification that turned a GitHub throttle into a permanent crash-loop) - canonical Altinity release URL (project moved; old path is a redirect) - bounded retries with backoff + wget read timeout (a stalled connection can no longer hang the deploy) - verify the binary executes before trusting or caching it (catches truncated downloads and a corrupt cache) - compose: fix app depends_on to the real service name (plausible_events_db) — docker compose config was failing on it, which disabled CI image prepull and pushed pulls into the deploy window - bump CLICKHOUSE_ENTRYPOINT_VERSION v4 -> v5 (swarm configs immutable) Verified on a dev deploy: fresh download path, cached-restart path, clickhouse-backup create/list/delete, and /api/health all green.
106 lines
3.6 KiB
YAML
106 lines
3.6 KiB
YAML
---
|
|
version: "3.8"
|
|
|
|
services:
|
|
app:
|
|
image: plausible/analytics:v2.0.0
|
|
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
|
|
depends_on:
|
|
- db
|
|
- plausible_events_db
|
|
environment:
|
|
- BASE_URL=https://$DOMAIN
|
|
- SECRET_KEY_BASE
|
|
- DATABASE_URL=postgres://plausible:plausible@${STACK_NAME}_db:5432/plausible
|
|
- CLICKHOUSE_DATABASE_URL=http://${STACK_NAME}_plausible_events_db:8123/plausible_events_db
|
|
- SMTP_HOST_ADDR
|
|
- MAILER_EMAIL
|
|
- SMTP_HOST_PORT
|
|
- SMTP_USER_NAME
|
|
- SMTP_USER_PWD
|
|
- SMTP_HOST_SSL_ENABLED
|
|
- DISABLE_REGISTRATION
|
|
- DISABLE_AUTH
|
|
networks:
|
|
- proxy
|
|
- internal
|
|
deploy:
|
|
restart_policy:
|
|
condition: on-failure
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8000"
|
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
|
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
|
- coop-cloud.${STACK_NAME}.version=3.1.0+v2.0.0
|
|
db:
|
|
image: pgautoupgrade/pgautoupgrade:18-alpine
|
|
volumes:
|
|
- db-data:/var/lib/postgresql/data
|
|
environment:
|
|
# pin legacy PGDATA so the existing cluster on the volume is upgraded in place, not re-init'd
|
|
- PGDATA=/var/lib/postgresql/data
|
|
- POSTGRES_USER=plausible
|
|
- POSTGRES_PASSWORD=plausible
|
|
- POSTGRES_DB=plausible
|
|
networks:
|
|
- internal
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U plausible -d plausible"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 60
|
|
deploy:
|
|
labels:
|
|
backupbot.backup: "true"
|
|
backupbot.backup.pre-hook: sh -c 'pg_dump -U "$$POSTGRES_USER" -Fc "$$POSTGRES_DB" | gzip > "/postgres.dump.gz"'
|
|
backupbot.backup.path: "/postgres.dump.gz"
|
|
backupbot.backup.post-hook: "rm -f /postgres.dump.gz"
|
|
backupbot.restore: "true"
|
|
backupbot.restore.post-hook: sh -c 'gzip -d /postgres.dump.gz && pg_restore --clean -U "$$POSTGRES_USER" --dbname="$$PLAUSIBLE_DB" < /postgres.dump && rm -f /postgres.dump'
|
|
|
|
plausible_events_db:
|
|
image: clickhouse/clickhouse-server:23.4.2.11-alpine
|
|
volumes:
|
|
- event-data:/var/lib/clickhouse
|
|
entrypoint: /custom-entrypoint.sh
|
|
configs:
|
|
- source: clickhouse-config
|
|
target: /etc/clickhouse-server/config.d/logging.xml
|
|
- source: clickhouse-user-config
|
|
target: /etc/clickhouse-server/users.d/clickhouse-user-config.xml
|
|
- source: clickhouse_entrypoint
|
|
target: /custom-entrypoint.sh
|
|
mode: 0555
|
|
networks:
|
|
- internal
|
|
deploy:
|
|
labels:
|
|
backupbot.backup: "true"
|
|
backupbot.backup.pre-hook: clickhouse-backup create events
|
|
backupbot.backup.path: "/var/lib/clickhouse/backup/events"
|
|
backupbot.backup.post-hook: "rm -rf /var/lib/clickhouse/backup/events"
|
|
backupbot.restore: "true"
|
|
backupbot.restore.post-hook: clickhouse-backup restore --rm events && rm -rf /var/lib/clickhouse/backup/events
|
|
|
|
volumes:
|
|
db-data:
|
|
event-data:
|
|
|
|
networks:
|
|
proxy:
|
|
external: true
|
|
internal:
|
|
|
|
configs:
|
|
clickhouse-config:
|
|
name: ${STACK_NAME}_clickhouse_config_${CLICKHOUSE_CONF_VERSION}
|
|
file: clickhouse-config.xml
|
|
clickhouse-user-config:
|
|
name: ${STACK_NAME}_clickhouse_user_config_${CLICKHOUSE_USER_CONF_VERSION}
|
|
file: clickhouse-user-config.xml
|
|
clickhouse_entrypoint:
|
|
name: ${STACK_NAME}_clickhouse_entrypoint_${CLICKHOUSE_ENTRYPOINT_VERSION}
|
|
file: entrypoint.clickhouse.sh
|