PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
FIX (docker): Give postgres a group in common with databasus so it can reach PGDATA (issue #751)
Rostislav Duginfb503f4bf42c
diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.ymlindex ad34c744..bfc435f0 100644--- a/.github/workflows/ci-release.yml+++ b/.github/workflows/ci-release.yml@@ -375,7 +375,10 @@ jobs:- name: Run smoke pings against dev imagerun: |+ # 0770 keeps the traversal bit off for others, so the smoke run only passes+ # while the in-container postgres account reaches PGDATA through its group.mkdir -p /tmp/databasus-dev-smoke-data+ chmod 770 /tmp/databasus-dev-smoke-datadocker run -d --name databasus-dev-smoke \-p 4005:4005 \-v /tmp/databasus-dev-smoke-data:/databasus-data \@@ -574,7 +577,10 @@ jobs:- name: Run smoke pings against built imagerun: |+ # 0770 keeps the traversal bit off for others, so the smoke run only passes+ # while the in-container postgres account reaches PGDATA through its group.mkdir -p /tmp/databasus-smoke-data+ chmod 770 /tmp/databasus-smoke-datadocker run -d --name databasus-smoke \-p 4005:4005 \-v /tmp/databasus-smoke-data:/databasus-data \diff --git a/Dockerfile b/Dockerfileindex 2f882f50..2ba4d899 100644--- a/Dockerfile+++ b/Dockerfile@@ -162,11 +162,21 @@ RUN --mount=type=bind,source=assets/tools,target=/ctx/tools,readonly \RUN set -eux; \groupmod -g 999 postgres; \usermod -u 999 postgres; \+ # Renumbering rewrites the account, not the directories the package already created, so+ # they would keep IDs that resolve to nothing until some later install reuses them.+ chown -R postgres:postgres \+ /var/lib/postgresql /etc/postgresql /var/log/postgresql /run/postgresql; \mkdir -p /databasus-data/pgdata; \chown -R postgres:postgres /databasus-data/pgdata-# Create non-root user for the main application process-RUN useradd -r -s /usr/sbin/nologin -u 65532 databasus+# databasus owns everything in /databasus-data except PGDATA, so like postgres above it needs+# IDs that stay stable across releases for hosts that bind-mount the volume. postgres joins+# the group as a supplementary member rather than sharing a primary group, because it has to+# traverse the volume root to reach PGDATA and PUID/PGID renumber its primary group at startup.+RUN set -eux; \+ groupadd -g 65532 databasus; \+ useradd -r -s /usr/sbin/nologin -u 65532 -g databasus databasus; \+ usermod -aG databasus postgresWORKDIR /app@@ -275,6 +285,9 @@ mkdir -p /databasus-data/pgdatamkdir -p /databasus-data/tempmkdir -p /databasus-data/backupschown databasus:databasus /databasus-data+# postgres reaches pgdata through this directory as a member of the databasus group, and a+# bind-mounted host directory can arrive without a group traversal bit.+chmod g+x /databasus-datachown -R postgres:postgres /databasus-data/pgdatachown -R databasus:databasus /databasus-data/temp /databasus-data/backups# Upgrade path: secret.key and instance.json may be owned by root or postgres