Skip to content

Commit 061f97d

Browse files
author
Chuy García
committed
feat: add self-healing entrypoint wrapper for interrupted upgrades
1 parent c625b36 commit 061f97d

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎nextcloud/Dockerfile‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ RUN { \
2222
} > /usr/src/nextcloud/config/redis.config.php
2323

2424
EXPOSE 8034
25+
26+
# Self-healing entrypoint wrapper: runs `occ upgrade` on every boot before
27+
# delegating to the upstream Nextcloud entrypoint. This fixes the case where
28+
# a previous upgrade was interrupted after code sync but before DB migrations,
29+
# leaving the instance stuck in maintenance mode with matching versions.
30+
COPY docker-entrypoint.dappnode.sh /usr/local/bin/
31+
RUN chmod +x /usr/local/bin/docker-entrypoint.dappnode.sh
32+
ENTRYPOINT ["docker-entrypoint.dappnode.sh"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
# Self-heal interrupted upgrades: if Nextcloud is already installed but a
4+
# previous upgrade was interrupted after code sync but before DB migrations,
5+
# the upstream entrypoint will not retry because the version numbers already
6+
# match. Run occ upgrade unconditionally here (it is idempotent) so the
7+
# instance can boot out of maintenance mode by itself.
8+
if [ -f /var/www/html/occ ]; then
9+
su -p www-data -s /bin/sh -c '/usr/local/bin/php /var/www/html/occ upgrade' || true
10+
fi
11+
12+
exec /entrypoint.sh "$@"

0 commit comments

Comments
 (0)