diff --git a/entrypoint.clickhouse.sh b/entrypoint.clickhouse.sh index 714711c..8cebd82 100644 --- a/entrypoint.clickhouse.sh +++ b/entrypoint.clickhouse.sh @@ -1,21 +1,12 @@ #!/bin/bash -# clickhouse entrypoint (cc-ci Q4.7b hardening — recipe-PR for recipe-maintainers/plausible). + +# clickhouse-backup is a backup tool (backupbot pre/post-hooks: `clickhouse-backup create/restore`). +# It is a 22 MB GitHub download (rate-limit / network), which can fail to download, and lead to crash loop and download throttling. # -# clickhouse-backup is the BACKUP tool (backupbot pre/post-hooks: `clickhouse-backup create/restore`). -# It is NOT required for clickhouse-SERVER (`/entrypoint.sh`) to run. The published recipe fetched it -# with `set -ex` + a single silenced no-retry wget to ephemeral /tmp, so ANY transient failure of the -# 22 MB GitHub download (rate-limit / network) exited the container BEFORE the server started → swarm -# restarted it → re-downloaded → amplified the throttle → crash-loop → deploy timeout (cc-ci Q4.7). -# -# Hardening (no behaviour change when the download succeeds first try): -# - cache the binary on the PERSISTENT clickhouse data volume (/var/lib/clickhouse) so it is fetched +# to make the download smoother: +# - cache the binary on the persistent clickhouse data volume (/var/lib/clickhouse) so it is fetched # at most once and reused on every container restart (no re-download amplification); -# - retry with backoff to ride out transient GitHub failures; -# - un-silenced so a failure is diagnosable in `docker service logs`. -# -# Policy: clickhouse-backup is REQUIRED. If it cannot be installed after all retries the entrypoint -# aborts (non-zero exit) and the server is NOT started — we deliberately fail the deploy loudly rather -# than come up silently without backup/restore capability. +# - retry with backoff to ride out transient GitHub failures set -e @@ -60,8 +51,7 @@ install_clickhouse_backup() { return 1 } -# Required: if the backup tool cannot be installed after retries, abort (set -e) so the deploy fails -# loudly instead of coming up without backup/restore capability. +#if the backup tool cannot be installed after retries, it aborts (set -e) so the deploy fails install_clickhouse_backup exec /entrypoint.sh