Drop Apache+mod_php for the actual performance win — nginx + PHP-FPM — without the LinuxServer image cascade (custom auto-install, /custom-cont-init.d, abc-vs- www-data rewrites in the auth adapter + every tool, HTTPS-by-default quirks). The official fpm-alpine image keeps env-var auto-install and the www-data user, so the auth adapter, all tools, and the compose-tags hook keep working unchanged. - Compose: nextcloud-service is now fpm-alpine (still container_name=nextcloud- service so docker exec ... nextcloud-service php occ in the auth adapter is untouched). New nextcloud-web nginx sidecar serves :80 over the shared ./html volume, terminating FastCGI to nextcloud-service:9000. Traefik labels + PORTS_ TAG_1 move to nextcloud-web (the HTTP face); backup.files stays on -service (the file-owning brain). nextcloud-db + nextcloud-redis unchanged. - resources/nginx.conf: Nextcloud's recommended nginx config, trimmed for behind-Traefik (no TLS), large-upload + caldav/carddav/.well-known redirects. - scripts/nextcloud_update_specifics.sh: NEW post-install hook — appUpdateSpecifics_nextcloud waits for first-boot occ install to complete (config.php + occ status=installed), then wires Redis as memcache.distributed + memcache.locking via occ config:system:set. Idempotent. Auto-install is unchanged (official image's NEXTCLOUD_ADMIN_USER + MYSQL_* env flow). Redis caching now actually USED by Nextcloud (previously the container was up but config.php had no memcache config). Container-side backup capture still the right answer for the perm boundary — image change doesn't affect it. Verified statically: yaml structure, hook parses + dispatches + has the right graceful-timeout fallback when occ isn't reachable. Live verification (sync performance + actual Redis hit rate + traefik proxy of FastCGI) needs a fresh install on a throwaway box. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
40 lines
2.2 KiB
Bash
40 lines
2.2 KiB
Bash
#!/bin/bash
|
||
|
||
# Post-install/update specifics for Nextcloud — dispatched by appUpdateSpecifics.
|
||
#
|
||
# Nextcloud's official image runs `occ maintenance:install` on first boot from the
|
||
# NEXTCLOUD_ADMIN_USER + MYSQL_* env vars (so no web wizard). After that, wire
|
||
# Redis as the distributed cache + file-locking backend — this is the actual
|
||
# performance win for sync-heavy workloads. The redis container is on the same
|
||
# docker network as nextcloud-service, so the hostname `nextcloud-redis` resolves.
|
||
# Idempotent: `occ config:system:set` with the same value is a no-op.
|
||
appUpdateSpecifics_nextcloud() {
|
||
# Wait for Nextcloud's first-boot init to complete (config.php exists +
|
||
# occ reports installed). 60 × 2s = 2 minute timeout.
|
||
local i=0
|
||
while (( i++ < 60 )); do
|
||
if runFileOp docker exec -u www-data nextcloud-service test -f /var/www/html/config/config.php 2>/dev/null \
|
||
&& runFileOp docker exec -u www-data nextcloud-service php occ status 2>/dev/null | grep -q 'installed: true'; then
|
||
break
|
||
fi
|
||
sleep 2
|
||
done
|
||
if (( i >= 60 )); then
|
||
isNotice "Nextcloud not yet initialized; skipping Redis wiring (re-run by reinstalling once it's up)"
|
||
return 0
|
||
fi
|
||
|
||
isNotice "Wiring Redis caching into Nextcloud..."
|
||
local rc=0
|
||
runFileOp docker exec -u www-data nextcloud-service php occ config:system:set memcache.distributed --value '\OC\Memcache\Redis' >/dev/null 2>&1 || rc=1
|
||
runFileOp docker exec -u www-data nextcloud-service php occ config:system:set memcache.locking --value '\OC\Memcache\Redis' >/dev/null 2>&1 || rc=1
|
||
runFileOp docker exec -u www-data nextcloud-service php occ config:system:set redis host --value nextcloud-redis >/dev/null 2>&1 || rc=1
|
||
runFileOp docker exec -u www-data nextcloud-service php occ config:system:set redis port --value 6379 --type=integer >/dev/null 2>&1 || rc=1
|
||
runFileOp docker exec -u www-data nextcloud-service php occ config:system:set filelocking.enabled --value true --type=boolean >/dev/null 2>&1 || rc=1
|
||
if [[ $rc -eq 0 ]]; then
|
||
isSuccessful "Nextcloud → Redis caching + file-locking wired."
|
||
else
|
||
isNotice "Redis wiring had errors (non-fatal; Nextcloud still functions without it)"
|
||
fi
|
||
}
|