diff --git a/docker-compose.yml b/docker-compose.yml index ffa0d63436..6c9e9eeda4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -104,7 +104,7 @@ services: restart: unless-stopped litestream: - image: litestream/litestream:0.3.13 + image: litestream/litestream:0.5.17 # The app's user, so the shadow WAL it writes beside the database is # owned like the database. user: "1000:1000" diff --git a/docs/CONTROL_PLANE_CONTAINER.md b/docs/CONTROL_PLANE_CONTAINER.md index 7feb011002..50600d49aa 100644 --- a/docs/CONTROL_PLANE_CONTAINER.md +++ b/docs/CONTROL_PLANE_CONTAINER.md @@ -56,7 +56,7 @@ Prerequisites: Docker with Compose v2, a GitHub App and OAuth app as in ``` The response reports the migrations applied, the resident sessions, and the state of the cron - loop and alarm clock. Litestream logs `snapshot written` once the first snapshot is in the + loop and alarm clock. Litestream logs `snapshot complete` once the first snapshot is in the `backups` bucket. Any S3 client pointed at http://127.0.0.1:9000 with the root credentials lists both buckets. @@ -140,7 +140,7 @@ docker compose rm -sf app litestream docker volume rm "$(basename "$PWD")_control-plane-data" docker compose up -d --wait docker compose logs app | grep litestream.restore -docker compose logs litestream | grep "snapshot written" +docker compose logs litestream | grep "snapshot complete" ``` ## Recovering from an unclean stop diff --git a/packages/control-plane/docker/litestream.yml b/packages/control-plane/docker/litestream.yml index eb7334d6c9..1a956debd6 100644 --- a/packages/control-plane/docker/litestream.yml +++ b/packages/control-plane/docker/litestream.yml @@ -15,12 +15,12 @@ dbs: - path: /data/global.db - replicas: - - type: s3 - bucket: ${LITESTREAM_BUCKET} - path: control-plane/global.db - endpoint: ${LITESTREAM_ENDPOINT} - force-path-style: true - access-key-id: ${LITESTREAM_ACCESS_KEY_ID} - secret-access-key: ${LITESTREAM_SECRET_ACCESS_KEY} - sync-interval: 1s + replica: + type: s3 + bucket: ${LITESTREAM_BUCKET} + path: control-plane/global.db + endpoint: ${LITESTREAM_ENDPOINT} + force-path-style: true + access-key-id: ${LITESTREAM_ACCESS_KEY_ID} + secret-access-key: ${LITESTREAM_SECRET_ACCESS_KEY} + sync-interval: 1s diff --git a/scripts/compose-smoke.sh b/scripts/compose-smoke.sh index 6dd3cfa0b6..9aabd76b5c 100755 --- a/scripts/compose-smoke.sh +++ b/scripts/compose-smoke.sh @@ -181,8 +181,11 @@ done echo " ok the cron loop ticked" log "replication" -"${COMPOSE[@]}" logs --no-color litestream | grep -q "snapshot written" || - fail "Litestream never wrote a snapshot of the global store" +REPLICATION_DEADLINE=$((SECONDS + 60)) +until "${COMPOSE[@]}" logs --no-color litestream | grep -q "snapshot complete"; do + [ "$SECONDS" -lt "$REPLICATION_DEADLINE" ] || fail "Litestream never wrote a snapshot of the global store" + sleep 2 +done echo " ok Litestream replicated the global store" log "clean shutdown"