From e3ba3a791dae2c6f1f2bbcbb5ec85b62fb13385c Mon Sep 17 00:00:00 2001 From: Taras Kushnir <505555+ribtoks@users.noreply.github.com> Date: Wed, 19 Jul 2023 12:49:20 +0000 Subject: [PATCH] Make Litestream retention configurable (#447) Details in #446 One problem though: due to current code organization (few "entrypoints"), I did not find a good **single** place for a default value. --------- Co-authored-by: Michael Lynch --- Dockerfile | 2 ++ README.md | 1 + docker-entrypoint | 1 + fly.toml | 1 + litestream.yml | 2 +- playwright.config.ts | 2 +- 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 501ecc51..e8cd4a6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,6 +67,8 @@ COPY ./litestream.yml /etc/litestream.yml COPY ./static /app/static COPY ./LICENSE /app/LICENSE +ENV LITESTREAM_RETENTION=72h + WORKDIR /app ENTRYPOINT ["/app/docker-entrypoint"] diff --git a/README.md b/README.md index e8b9c15b..a34191b2 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ You can adjust behavior of the Docker container by specifying these Docker-speci | `LITESTREAM_ENDPOINT` | Litestream-compatible cloud storage endpoint where Litestream should replicate data. | | `LITESTREAM_ACCESS_KEY_ID` | Litestream-compatible cloud storage access key ID to the bucket where you want to replicate data. | | `LITESTREAM_SECRET_ACCESS_KEY` | Litestream-compatible cloud storage secret access key to the bucket where you want to replicate data. | +| `LITESTREAM_RETENTION` | The amount of time Litestream snapshots & WAL files will be kept (defaults to 72h). | ### Docker build args diff --git a/docker-entrypoint b/docker-entrypoint index 5c076982..c95261a6 100755 --- a/docker-entrypoint +++ b/docker-entrypoint @@ -47,6 +47,7 @@ if [[ "${IS_LITESTREAM_ENABLED}" == 'true' ]]; then /app/litestream version echo "LITESTREAM_BUCKET=${LITESTREAM_BUCKET}" echo "LITESTREAM_ENDPOINT=${LITESTREAM_ENDPOINT}" + echo "LITESTREAM_RETENTION=${LITESTREAM_RETENTION}" if [[ -f "$DB_PATH" ]]; then echo "Existing database is $(stat -c %s "${DB_PATH}") bytes" diff --git a/fly.toml b/fly.toml index 0c5da789..8f875941 100644 --- a/fly.toml +++ b/fly.toml @@ -9,6 +9,7 @@ processes = [] PS_BEHIND_PROXY="yes" LITESTREAM_BUCKET="picoshare-litestream" LITESTREAM_ENDPOINT="s3.us-west-002.backblazeb2.com" + LITESTREAM_RETENTION="72h" [experimental] allowed_public_ports = [] diff --git a/litestream.yml b/litestream.yml index 43d07883..a81fa1d9 100644 --- a/litestream.yml +++ b/litestream.yml @@ -8,5 +8,5 @@ dbs: path: db endpoint: ${LITESTREAM_ENDPOINT} force-path-style: true - retention: 72h + retention: ${LITESTREAM_RETENTION} snapshot-interval: 24h diff --git a/playwright.config.ts b/playwright.config.ts index 1fc69b6f..a40a9af3 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -3,7 +3,7 @@ import { devices } from "@playwright/test"; const config: PlaywrightTestConfig = { testDir: "./e2e", - timeout: 30 * 1000, + timeout: 35 * 1000, expect: { timeout: 5 * 1000, },