From 4a07ddda36ab43f2efb21541d55d7f4dc2bf4d56 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 8 Oct 2026 16:14:33 -0500 Subject: [PATCH] Run as UID/GID 1004 by default; release 0.1.1 The image's dbbackup user is now 1004:1004 (previously UID 10001 with an auto-assigned GID of 999), matching the CronJob's securityContext, the restore Job example and the test stack. Co-Authored-By: Claude Opus 5.5 --- Dockerfile | 7 ++++--- compose.yaml | 2 +- deploy/k8s/cronjob.yaml | 4 ++-- deploy/k8s/kustomization.yaml | 2 +- docs/restore.md | 6 +++--- pyproject.toml | 2 +- src/dbbackup/__init__.py | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 86b6e1d..ac70019 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,9 +36,10 @@ WORKDIR /app COPY pyproject.toml README.md LICENSE ./ COPY src ./src RUN pip install --no-cache-dir . \ - && useradd --system --uid 10001 --user-group --home-dir /nonexistent --shell /usr/sbin/nologin dbbackup + && groupadd --gid 1004 dbbackup \ + && useradd --uid 1004 --gid 1004 --no-create-home --home-dir /nonexistent --shell /usr/sbin/nologin dbbackup -USER 10001 +USER 1004:1004 ENTRYPOINT ["dbbackup"] CMD ["backup"] @@ -48,6 +49,6 @@ FROM runtime AS test USER root RUN pip install --no-cache-dir "pytest>=8" COPY tests ./tests -USER 10001 +USER 1004:1004 ENTRYPOINT [] CMD ["python", "-m", "pytest", "-p", "no:cacheprovider", "-m", "integration", "-v", "tests/integration"] diff --git a/compose.yaml b/compose.yaml index e80248b..20b1582 100644 --- a/compose.yaml +++ b/compose.yaml @@ -161,5 +161,5 @@ services: read_only: true tmpfs: - /tmp - - /backups:uid=10001,gid=10001 + - /backups:uid=1004,gid=1004 depends_on: *db-deps diff --git a/deploy/k8s/cronjob.yaml b/deploy/k8s/cronjob.yaml index 478439a..5905b1f 100644 --- a/deploy/k8s/cronjob.yaml +++ b/deploy/k8s/cronjob.yaml @@ -29,8 +29,8 @@ spec: runAsNonRoot: true # Must be able to write to the NFS export: set these to its owner. # (fsGroup doesn't help here, as NFS volumes aren't chowned.) - runAsUser: 10001 - runAsGroup: 10001 + runAsUser: 1004 + runAsGroup: 1004 seccompProfile: type: RuntimeDefault containers: diff --git a/deploy/k8s/kustomization.yaml b/deploy/k8s/kustomization.yaml index 3168ab4..d26e4f2 100644 --- a/deploy/k8s/kustomization.yaml +++ b/deploy/k8s/kustomization.yaml @@ -23,7 +23,7 @@ configMapGenerator: images: - name: ghcr.io/arkane-systems/db-backup - newTag: "0.1.0" + newTag: "0.1.1" labels: - pairs: diff --git a/docs/restore.md b/docs/restore.md index 5a72939..3e75a98 100644 --- a/docs/restore.md +++ b/docs/restore.md @@ -65,10 +65,10 @@ spec: template: spec: restartPolicy: Never - securityContext: {runAsNonRoot: true, runAsUser: 10001, runAsGroup: 10001} + securityContext: {runAsNonRoot: true, runAsUser: 1004, runAsGroup: 1004} containers: - name: restore - image: ghcr.io/arkane-systems/db-backup:0.1.0 + image: ghcr.io/arkane-systems/db-backup:0.1.1 args: [restore, postgres-main, --host, new-postgres.example.lan, --username, postgres, --password-env, ADMIN_PASSWORD] env: - name: ADMIN_PASSWORD @@ -85,7 +85,7 @@ spec: ```bash docker run --rm -v /mnt/db-backups:/backups:ro -v $PWD/config.yaml:/etc/dbbackup/config.yaml:ro \ - -e ADMIN_PASSWORD ghcr.io/arkane-systems/db-backup:0.1.0 \ + -e ADMIN_PASSWORD ghcr.io/arkane-systems/db-backup:0.1.1 \ restore mariadb-main --host new-mariadb.example.lan --username root --password-env ADMIN_PASSWORD ``` diff --git a/pyproject.toml b/pyproject.toml index 7027c54..8bff90d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "dbbackup" -version = "0.1.0" +version = "0.1.1" description = "Containerized logical backups of MariaDB, PostgreSQL and MongoDB servers, with GFS retention" readme = "README.md" license = "MIT" diff --git a/src/dbbackup/__init__.py b/src/dbbackup/__init__.py index 6f44d38..668c39e 100644 --- a/src/dbbackup/__init__.py +++ b/src/dbbackup/__init__.py @@ -1,3 +1,3 @@ """Logical backups of MariaDB, PostgreSQL and MongoDB servers, with GFS retention.""" -__version__ = "0.1.0" +__version__ = "0.1.1"