From d0243cf724ec90d5543b839eb5137fc06641cf3a Mon Sep 17 00:00:00 2001 From: notplants <@notplants> Date: Mon, 22 Jun 2026 19:30:09 +0000 Subject: [PATCH] fix: seed app.ini into writable config volume for Gitea 1.24+ Gitea 1.24+ persists settings back to app.ini on boot (e.g. WORK_PATH). Mounting app.ini directly as a read-only swarm config makes that write fail (logged error, possible repo-access bugs). Mount the rendered config as app.ini.init and seed a writable copy in the config volume instead. --- abra.sh | 2 +- compose.yml | 2 +- docker-setup.sh.tmpl | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/abra.sh b/abra.sh index 68fe314..c412518 100644 --- a/abra.sh +++ b/abra.sh @@ -1,5 +1,5 @@ export APP_INI_VERSION=v23 -export DOCKER_SETUP_SH_VERSION=v1 +export DOCKER_SETUP_SH_VERSION=v3 export PG_BACKUP_VERSION=v1 abra_backup_app() { diff --git a/compose.yml b/compose.yml index dc61ac1..af32e0f 100644 --- a/compose.yml +++ b/compose.yml @@ -6,7 +6,7 @@ services: image: "gitea/gitea:1.27.1-rootless" configs: - source: app_ini - target: /etc/gitea/app.ini + target: /etc/gitea/app.ini.init - source: docker_setup_sh target: /usr/local/bin/docker-setup.sh mode: 0555 diff --git a/docker-setup.sh.tmpl b/docker-setup.sh.tmpl index 310e8f7..19abb8e 100644 --- a/docker-setup.sh.tmpl +++ b/docker-setup.sh.tmpl @@ -13,3 +13,11 @@ mkdir -p ${GITEA_CUSTOM} && chmod 0500 ${GITEA_CUSTOM} # Prepare temp folder mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP} if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi + +# Gitea 1.24+ writes settings back to app.ini on boot (e.g. WORK_PATH), which fails when app.ini is +# mounted directly as a read-only swarm config. So mount the rendered config as app.ini.init and seed +# a writable copy. Use `! -s` (empty), not `! -f`: old direct-mount upgrades leave a 0-byte app.ini. +if [ ! -s /etc/gitea/app.ini ]; then + cp /etc/gitea/app.ini.init /etc/gitea/app.ini +fi +chmod 0600 /etc/gitea/app.ini 2>/dev/null || true -- 2.54.0