Barry Chen 7a158efe8f
chore(build): upgrade bookworm -> trixie (and thus python 3.13) (#2290)
This commit
 - upgrades Debian Bookworm to Trixie
 - uses pip --ignore-installed since pip can't uninstall system python packages
 - installs python3-setuptools for pyramid's pkg_resources dependency
 - upgrades to boto3 since a boto vendored dep won't work in python 3.13
2026-05-11 08:50:19 -05:00
..

PostgreSQL Utility Scripts

Currently there is one script: purge_ttl.py.

purge_ttl.py

Purge expired items (BSOs and batches) from a Sync storage PostgreSQL instance. The script is intended to be invoked regularly, e.g. as a cronjob.

Prerequisites

Run Script Locally

cd tools/postgres
poetry install
SYNC_SYNCSTORAGE__DATABASE_URL="postgresql://user:pass@localhost/syncstorage poetry run python purge_ttl.py"

Pass -h to see the list of options.

Run Tests Locally

cd tools/postgres
poetry install
SYNC_SYNCSTORAGE__DATABASE_URL="postgresql://user:pass@localhost/syncstorage poetry run pytest test_purge_ttl.py -v"

Run with Docker

A Docker image with the PostgreSQL build is not published anywhere at the moment. Once that's available, this readme will be updated to include that step.

docker run --rm \
  --entrypoint python3 \
  -e SYNC_SYNCSTORAGE__DATABASE_URL="postgresql://user:pass@host:5432/syncstorage" \
  syncstorage-postgres-image:tag \
  /app/tools/postgres/purge_ttl.py