Found while build-testing the freshly regenerated image in a temp
data/config dir: opengist served REPLACE_HOSTNAME literally in every
generated URL, and http.git-enabled routes redirected to bogus paths,
because __update_conf_files() was patching a config file
($ETC_DIR/opengist.yaml) that doesn't exist -- the shipped config is
named config.yaml. Also normalized the substituted value: opengist's
external-url must be a full URL (scheme+host), not a bare hostname,
or it breaks absolute-URL/redirect generation; ssh.external-domain
must stay a bare domain, so it now gets its own REPLACE_SSH_HOSTNAME
token instead of reusing the schemed value.
Verified via: docker build, then a container run against a scratch
temp dir with data/config volumes -- health check reports healthy,
config.yaml shows the correct external-url/ssh.external-domain, and
/-/all, /-/login, /-/register all return 200 with real opengist HTML.
- rootfs/usr/local/etc/docker/init.d/00-opengist.sh: __update_conf_files
now targets $ETC_DIR/config.yaml (was opengist.yaml, a nonexistent
file), prefixes sysname with http:// when no scheme is present for
external-url, and replaces ssh.external-domain via a separate
REPLACE_SSH_HOSTNAME token using the unschemed hostname
- rootfs/tmp/etc/opengist/config.yaml: ssh.external-domain placeholder
changed from REPLACE_HOSTNAME to REPLACE_SSH_HOSTNAME
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
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