mirror of
https://github.com/casjaysdevdocker/opengist
synced 2026-08-14 14:01:17 -04:00
Root cause: the `git` service user's UID is assigned dynamically (random, non-persistent across container recreations), and __fix_permissions re-chowns APPLICATION_DIRS on every startup to whatever UID `git` currently has. However DATABASE_DIR / DATABASE_BASE_DIR (e.g. /data/db/sqlite for the sqlite backend) live under /data/db, outside APPLICATION_DIRS ($ETC_DIR $CONF_DIR $DATA_DIR $LOG_DIR $TMP_DIR $RUN_DIR $VAR_DIR, where DATA_DIR is /data/opengist, not /data). So whenever the on-disk DB ownership didn't already match the current `git` UID, it was never corrected, and opengist failed every start with "attempt to write a readonly database (8)", causing the container to exit and get restarted indefinitely. Reproduced against a live instance (git.casjay.work, casjaysdevdocker/opengist:latest): confirmed via container logs and `id git` vs `ls -la /data/db/sqlite` that the sqlite file's owning UID did not match the current `git` UID, and manually chowning it fixed that boot but the mismatch could recur on any future UID reassignment. Reproduced locally by pre-seeding a volume with the DB owned by an arbitrary UID (9999) and confirming, pre-fix, __fix_permissions never touched it; post-fix, the container's first boot re-chowns it to the newly assigned `git` UID and opengist starts cleanly. - rootfs/usr/local/etc/docker/init.d/00-opengist.sh: after the database-type case block resolves DATABASE_DIR/DATABASE_BASE_DIR, append both to ADD_APPLICATION_DIRS so __fix_permissions picks them up on every startup, regardless of database backend