1
0

Compare commits

..

3 Commits

Author SHA1 Message Date
lukas 9fb6c4cc7c vaultwarden: fix formatting 2026-06-18 23:01:35 +02:00
lukas 1e623a9540 timetracker: migrate to newever version 2026-06-18 23:01:26 +02:00
lukas 33b89cb484 Add staging reaper for timetracker branch deployments
Removes timetracker staging containers/volumes/images whose branch no
longer exists on Gitea. Backstop for missed branch-delete events from
the staging workflow in the timetracker repo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 17:08:55 +02:00
4 changed files with 27 additions and 1 deletions
+6 -1
View File
@@ -32,6 +32,8 @@ secrets:
file: secrets/igdb_api_client_secret file: secrets/igdb_api_client_secret
hardcover_api_token: hardcover_api_token:
file: secrets/hardcover_api_token file: secrets/hardcover_api_token
timetracker_secret_key:
file: secrets/timetracker_secret_key
configs: configs:
caddyfile: caddyfile:
@@ -176,12 +178,15 @@ services:
timetracker: timetracker:
image: ${REGISTRY_URL}/timetracker image: ${REGISTRY_URL}/timetracker
container_name: timetracker container_name: timetracker
secrets:
- timetracker_secret_key
environment: environment:
- TZ=${TZ} - TZ=${TZ}
- "CSRF_TRUSTED_ORIGINS=https://tracker.kucharczyk.xyz" - "APP_URL=https://tracker.kucharczyk.xyz"
- PUID=${PUID} - PUID=${PUID}
- PGID=${PGID} - PGID=${PGID}
- DATA_DIR=/home/timetracker/app/data - DATA_DIR=/home/timetracker/app/data
- SECRET_KEY__FILE=/run/secrets/timetracker_secret_key
volumes: volumes:
- "${DOCKER_STORAGE_PATH}/timetracker/data:/home/timetracker/app/data" - "${DOCKER_STORAGE_PATH}/timetracker/data:/home/timetracker/app/data"
- "${DOCKER_STORAGE_PATH}/timetracker/backups:/home/timetracker/app/games/fixtures/backups" - "${DOCKER_STORAGE_PATH}/timetracker/backups:/home/timetracker/app/games/fixtures/backups"
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Removes timetracker staging containers (deployed by .gitea/workflows/staging.yml
# in the timetracker repo) whose branch no longer exists on Gitea.
# Backstop for missed branch-delete events; safe to run any time.
set -euo pipefail
API="https://git.kucharczyk.xyz/api/v1/repos/lukas/timetracker/branches?limit=50"
# If the API is unreachable, set -e aborts here and nothing gets reaped.
branches=$(curl -fsS "$API" | python3 -c 'import json,sys; print("\n".join(b["name"] for b in json.load(sys.stdin)))')
docker ps -a --filter label=xyz.kucharczyk.staging=timetracker --format '{{.Names}}' | while read -r name; do
branch=$(docker inspect "$name" --format '{{ index .Config.Labels "xyz.kucharczyk.staging.branch" }}')
if ! grep -qxF "$branch" <<<"$branches"; then
image=$(docker inspect "$name" --format '{{ .Config.Image }}')
docker rm -f "$name" >/dev/null
docker volume rm "$name" >/dev/null 2>&1 || true
docker rmi "$image" >/dev/null 2>&1 || true
echo "reaped ${name} (branch '${branch}' no longer exists)"
fi
done
Binary file not shown.
Binary file not shown.