Files
backhaul-agent/.gitea/workflows/build.yml
T
steffen f2257eae40
Build and Push backhaul-agent / build (push) Successful in 42s
backhaul-agent: public containerized DB-backup client
One docker run on a database's private network starts backing it up:
- backhaul-agent.py: stdlib-only sidecar — every-minute check-in, app-owned
  dump schedule, streams pg_dump/mysqldump/mongodump home chunked, self-updates.
- entrypoint.sh: bootstraps the newest script, installs the once-a-minute cron
  (sources persisted env), runs once immediately, hands off to cron; logs to a
  file surfaced via docker logs.
- Dockerfile: debian-slim + pg_dump 17 (PGDG — required for Postgres 17 servers)
  + mysql client. Mongo tools to follow.
- CI builds + pushes the public image and asserts the dump tools are present.
2026-08-11 13:56:01 +02:00

62 lines
2.2 KiB
YAML

# Builds the PUBLIC backhaul-agent image and pushes it to the Gitea registry.
# No deploy step — this image is pulled by `docker run` on each database's host.
name: Build and Push backhaul-agent
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Login to Gitea registry
run: |
echo "${REGISTRY_TOKEN}" | docker login git.skui.io -u "${REGISTRY_USER}" --password-stdin
env:
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
- name: Set version tag
id: version
run: |
CURRENT_DATE="$(date -u +%Y.%m.%d)"
docker pull git.skui.io/steffen/backhaul-agent:latest 2>/dev/null || true
LATEST_TAGS=$(docker image inspect git.skui.io/steffen/backhaul-agent:latest 2>/dev/null | \
jq -r '.[0].RepoTags[]?' 2>/dev/null || echo "")
LATEST_TAG=$(echo "$LATEST_TAGS" | grep -E "${CURRENT_DATE}\.[0-9]+$" | \
sed 's/.*://' | sort -V | tail -1 || echo "")
if [[ $LATEST_TAG =~ ^${CURRENT_DATE}\.([0-9]+)$ ]]; then
COUNTER=$(( BASH_REMATCH[1] + 1 ))
else
COUNTER=1
fi
echo "version=${CURRENT_DATE}.${COUNTER}" >> "$GITHUB_OUTPUT"
- name: Build image
run: |
docker build --pull -t git.skui.io/steffen/backhaul-agent:${{ steps.version.outputs.version }} .
docker tag git.skui.io/steffen/backhaul-agent:${{ steps.version.outputs.version }} git.skui.io/steffen/backhaul-agent:latest
- name: Verify the dump tools are present
run: |
IMG=git.skui.io/steffen/backhaul-agent:${{ steps.version.outputs.version }}
docker run --rm --entrypoint sh "$IMG" -c \
'pg_dump --version && mysqldump --version && python3 --version'
- name: Push image
run: |
docker push git.skui.io/steffen/backhaul-agent:${{ steps.version.outputs.version }}
docker push git.skui.io/steffen/backhaul-agent:latest