- .env.scripts: synced version stamp to current template; preserved ENV_PULL_URL=casjaysdev/alpine (gen-dockerfile's --update path had a bug computing "alpine" instead, corrected manually per the casjaysdevdocker->casjaysdev/* base-image convention)
- rootfs/usr/local/bin/entrypoint.sh: regenerated from current template; fixes stale CONTAINER_NAME="alpine" -> "opengist" and normalizes whitespace
- rootfs/usr/local/etc/docker/functions/entrypoint.sh: replaced from template; picks up upstream fix for __symlink/__initialize_ssl_certs returning nonzero on success under set -e
- rootfs/root/docker/setup/00-init.sh, 01-system.sh, 02-packages.sh, 03-files.sh, 04-users.sh, 06-post.sh, 07-cleanup.sh: version stamp bump only, no logic change
- rootfs/root/docker/setup/05-custom.sh: version stamp bump only; restored the opengist binary download/install logic that the template regeneration would have wiped (this file is app-specific, not boilerplate)
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
Root cause: many functions in functions/entrypoint.sh ended with a bare,
unguarded `[ "$DEBUGGER" = "on" ] && echo/printf/__service_banner ...`
statement as their last executed line. With DEBUGGER unset (the default
runtime case), the `[ ]` test is false, so the function's implicit
return value is nonzero. Several of these functions (most critically
__symlink, called bare from __setup_mta) are invoked as unguarded
statements from other functions, and the whole entrypoint runs under
`set -eo pipefail`, so the nonzero return aborted the entire script
chain immediately after startup — explaining why the container only
printed the first log line and exited 1, and why it only worked with
DEBUGGER=on (which makes the echo run and return 0, masking the bug).
Verified via two clean docker buildx build + run cycles: before the
fix, `docker inspect` showed the container crash-looping (exit 1,
~3.9s uptime); after, `RestartCount=0 Status=running Health=healthy`
with opengist fully started, DEBUGGER unset.
- rootfs/usr/local/etc/docker/functions/entrypoint.sh: append `|| true`
to all 26 bare `[ "$DEBUGGER" = "on" ] && ...` statements so their
result never propagates as the enclosing function's return value
- TODO.AI.md: log 20 pre-existing script-lint findings on the same
file (missing `--` on grep, missing `local` on a few function-local
vars, missing VERSION= line) found incidentally while diagnosing
this bug; deferred as unrelated cleanup, not part of this fix
The .local.sh block defined stub functions in memory but never
wrote the file to disk, so __file_exists_with_content always
failed and __create_service_env returned non-zero on every run.
Fix: use a heredoc to write the stub functions into .local.sh.
- rootfs/usr/local/etc/docker/init.d/00-opengist.sh: write .local.sh
via heredoc in __create_service_env; bump version to 202606261600-git
rootfs/usr/local/etc/docker/init.d/00-opengist.sh
Update the embedded entrypoint copies in rootfs/ to match the
upstream template change. Internal state files renamed to dotfiles
so they're not matched by `/run/*.pid` cleanup globs:
- /run/init.d/entrypoint.pid -> /run/.entrypoint.pid
- /run/no_exit.pid -> /run/.no_exit.pid
- /run/backup.pid -> /run/.backup.pid
- /run/__start_init_scripts.pid -> /run/.start_init_scripts.pid
Per-service PIDs in /run/init.d/ are unchanged.
rootfs/usr/local/bin/entrypoint.sh
rootfs/usr/local/etc/docker/functions/entrypoint.sh
rootfs/usr/local/etc/docker/init.d/00-opengist.sh
rootfs/usr/local/share/template-files/config/env/default.sample
rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh