From cce5f868cec11830d19126b90c659772708cd323 Mon Sep 17 00:00:00 2001 From: jaylinski Date: Mon, 2 Mar 2026 06:03:39 +0100 Subject: [PATCH] chore(Dockerfile.rootless): remove legacy config file support (#11098) This legacy support was added in version 8. We now have version 14, so this deprecated feature can be confidently removed. See dad16cd5895a945c067ec6a2dacdac67afc8aa04 for a detailed explanation. Docs PR: https://codeberg.org/forgejo/docs/pulls/1740 Co-authored-by: Jakob Linskeseder Co-authored-by: 0ko <0ko@noreply.codeberg.org> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11098 Reviewed-by: Michael Kriese Reviewed-by: 0ko <0ko@noreply.codeberg.org> Reviewed-by: Gusted Co-authored-by: jaylinski Co-committed-by: jaylinski --- Dockerfile.rootless | 10 +++------- .../rootless/usr/local/bin/docker-entrypoint.sh | 5 ----- docker/rootless/usr/local/bin/docker-setup.sh | 16 ++-------------- release-notes/11098.md | 1 + 4 files changed, 6 insertions(+), 26 deletions(-) create mode 100644 release-notes/11098.md diff --git a/Dockerfile.rootless b/Dockerfile.rootless index c4079fd918..785986e545 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -86,8 +86,8 @@ RUN addgroup \ -G git \ git -RUN mkdir -p /var/lib/gitea /etc/gitea -RUN chown git:git /var/lib/gitea /etc/gitea +RUN mkdir -p /var/lib/gitea +RUN chown git:git /var/lib/gitea COPY --from=build-env /tmp/local / RUN cd /usr/local/bin ; ln -s gitea forgejo @@ -103,13 +103,9 @@ ENV GITEA_CUSTOM=/var/lib/gitea/custom ENV GITEA_TEMP=/tmp/gitea ENV TMPDIR=/tmp/gitea -# Legacy config file for backwards compatibility -# TODO: remove on next major version release -ENV GITEA_APP_INI_LEGACY=/etc/gitea/app.ini - ENV GITEA_APP_INI=${GITEA_CUSTOM}/conf/app.ini ENV HOME="/var/lib/gitea/git" -VOLUME ["/var/lib/gitea", "/etc/gitea"] +VOLUME ["/var/lib/gitea"] WORKDIR /var/lib/gitea ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"] diff --git a/docker/rootless/usr/local/bin/docker-entrypoint.sh b/docker/rootless/usr/local/bin/docker-entrypoint.sh index e5fa41cc78..ca509214bf 100755 --- a/docker/rootless/usr/local/bin/docker-entrypoint.sh +++ b/docker/rootless/usr/local/bin/docker-entrypoint.sh @@ -13,10 +13,5 @@ fi if [ $# -gt 0 ]; then exec "$@" else - # TODO: remove on next major version release - # Honour legacy config file if existing - if [ -f ${GITEA_APP_INI_LEGACY} ]; then - GITEA_APP_INI=${GITEA_APP_INI_LEGACY} - fi exec /usr/local/bin/gitea -c ${GITEA_APP_INI} web fi diff --git a/docker/rootless/usr/local/bin/docker-setup.sh b/docker/rootless/usr/local/bin/docker-setup.sh index 09bbeabc63..7bcb78c88c 100755 --- a/docker/rootless/usr/local/bin/docker-setup.sh +++ b/docker/rootless/usr/local/bin/docker-setup.sh @@ -11,22 +11,10 @@ mkdir -p ${GITEA_CUSTOM} && chmod 0700 ${GITEA_CUSTOM} mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP} if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi -# TODO: remove on next major version release -# Honour legacy config file if existing, but inform the user -if [ -f ${GITEA_APP_INI_LEGACY} ] && [ ${GITEA_APP_INI} != ${GITEA_APP_INI_LEGACY} ]; then - GITEA_APP_INI_DEFAULT=/var/lib/gitea/custom/conf/app.ini - echo -e \ - "\033[33mWARNING\033[0m: detected configuration file in deprecated default path ${GITEA_APP_INI_LEGACY}." \ - "The new default is ${GITEA_APP_INI_DEFAULT}. To remove this warning, choose one of the options:\n" \ - "* Move ${GITEA_APP_INI_LEGACY} to ${GITEA_APP_INI_DEFAULT} (or to \$GITEA_APP_INI if you want to override this variable)\n" \ - "* Explicitly override GITEA_APP_INI=${GITEA_APP_INI_LEGACY} in the container environment" - GITEA_APP_INI=${GITEA_APP_INI_LEGACY} -fi - -#Prepare config file +# Prepare config file if [ ! -f ${GITEA_APP_INI} ]; then - #Prepare config file folder + # Prepare config file folder GITEA_APP_INI_DIR=$(dirname ${GITEA_APP_INI}) mkdir -p ${GITEA_APP_INI_DIR} && chmod 0700 ${GITEA_APP_INI_DIR} if [ ! -w ${GITEA_APP_INI_DIR} ]; then echo "${GITEA_APP_INI_DIR} is not writable"; exit 1; fi diff --git a/release-notes/11098.md b/release-notes/11098.md new file mode 100644 index 0000000000..bab9505d8f --- /dev/null +++ b/release-notes/11098.md @@ -0,0 +1 @@ +In Forgejo v8.0.0, the default location for the config file was changed from `/etc/gitea/app.ini` to `/var/lib/gitea/app.ini`. Backward compatibility logic and startup warnings were added to container setup and entrypoint scripts. Now they are removed. This change only affects those using container deployments with rootless images. If you have the config file stored in a volume bound to container's /etc/gitea, move it to the new location or override the environment variable `GITEA_APP_INI`. An unused volume `/etc/gitea` can be safely removed from the container after moving the config or if the deployment never used versions prior to v8.0.0. \ No newline at end of file