The Basics
- Nextcloud Server version: nextcloud:stable-fpm-alpine@sha256:fd092d936643c2e0c0b80c27d5518c793e5e215d5b5836e5ecdca973395b2c34 (Should be the latest version I believe so nextcloud 30?)
- Operating system: Truenas scale 24.10
- Web server and version (e.g, Apache 2.4.25):
Not sure? - Reverse proxy and version _(e.g. nginx 1.27.2)
Not sure? - PHP version (e.g, 8.3):
Not sure? - Is this the first time you’ve seen this error? (Yes / No):
Yes
Summary of the issue you are facing:
I used to have a nextcloud server running without much problem, but I failed a migration of the postgres database a few weeks back and rather than spend more time fixing this I decided to just start from the beginning again since I basically just use nextcloud as an easy file hosting/sharing service among my devices and friends.
However, for some reason my previous docker-compose file no longer seems to be working after updating it to the latest versions and starting from scratch.
All the containers spin up just fine, and the docker logs look fine as far as I can see, but nothing is written into the nextcloud.log file and the nextcloud server is unreachable, so something is clearly very wrong.
Steps to replicate it (hint: details matter!):
- docker compose up --force-recreate
- Wait for container to start up.
- Note that the webpage is not accessible, neither through my normal domain or through the port that nextcloud should be exposing on.
Log entries
oot@truenas[...taStore/docker/docker_stack/nextcloud]# docker compose up --force-recreate
[+] Running 4/4
✔ Container nextcloud-nextcloud-cron-1 Recreated 0.3s
✔ Container nextcloud-postgres-1 Recreated 0.3s
✔ Container nextcloud-redis-1 Recreated 0.3s
✔ Container nextcloud Recreated 0.2s
Attaching to nextcloud, nextcloud-cron-1, postgres-1, redis-1
postgres-1 |
postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres-1 |
postgres-1 | 2025-03-11 13:54:48.881 UTC [1] LOG: starting PostgreSQL 17.2 (Debian 17.2-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
postgres-1 | 2025-03-11 13:54:48.921 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres-1 | 2025-03-11 13:54:48.921 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres-1 | 2025-03-11 13:54:48.955 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1 | 2025-03-11 13:54:48.992 UTC [29] LOG: database system was shut down at 2025-03-11 13:54:23 UTC
postgres-1 | 2025-03-11 13:54:49.013 UTC [1] LOG: database system is ready to accept connections
redis-1 | 1:C 11 Mar 2025 13:54:49.034 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-1 | 1:C 11 Mar 2025 13:54:49.035 * Redis version=7.4.2, bits=64, commit=00000000, modified=0, pid=1, just started
redis-1 | 1:C 11 Mar 2025 13:54:49.035 * Configuration loaded
redis-1 | 1:M 11 Mar 2025 13:54:49.035 * monotonic clock: POSIX clock_gettime
redis-1 | 1:M 11 Mar 2025 13:54:49.036 * Running mode=standalone, port=6379.
redis-1 | 1:M 11 Mar 2025 13:54:49.036 * Server initialized
redis-1 | 1:M 11 Mar 2025 13:54:49.037 * Loading RDB produced by version 7.4.2
redis-1 | 1:M 11 Mar 2025 13:54:49.037 * RDB age 26 seconds
redis-1 | 1:M 11 Mar 2025 13:54:49.037 * RDB memory usage when created 1.00 Mb
redis-1 | 1:M 11 Mar 2025 13:54:49.037 * Done loading RDB, keys loaded: 9, keys expired: 0.
redis-1 | 1:M 11 Mar 2025 13:54:49.037 * DB loaded from disk: 0.001 seconds
redis-1 | 1:M 11 Mar 2025 13:54:49.038 * Ready to accept connections tcp
nextcloud-cron-1 | crond: crond (busybox 1.37.0) started, log level 8
nextcloud | Configuring Redis as session handler
nextcloud | => Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/before-starting
nextcloud | [11-Mar-2025 13:54:55] NOTICE: fpm is running, pid 1
nextcloud | [11-Mar-2025 13:54:55] NOTICE: ready to handle connections
nextcloud-cron-1 | crond: USER www-data pid 7 cmd php -f /var/www/html/cron.php
postgres-1 | 2025-03-11 13:55:36.735 UTC [72] FATAL: password authentication failed for user "netdata"
postgres-1 | 2025-03-11 13:55:36.735 UTC [72] DETAIL: Role "netdata" does not exist.
postgres-1 | Connection matched file "/var/lib/postgresql/data/pg_hba.conf" line 128: "host all all all scram-sha-256"
postgres-1 | 2025-03-11 13:59:49.089 UTC [27] LOG: checkpoint starting: time
postgres-1 | 2025-03-11 13:59:51.267 UTC [27] LOG: checkpoint complete: wrote 23 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.008 s, sync=0.128 s, total=2.179 s; sync files=13, longest=0.026 s, average=0.010 s; distance=131 kB, estimate=131 kB; lsn=0/221DD20, redo lsn=0/221DCC8
nextcloud-cron-1 | crond: USER www-data pid 8 cmd php -f /var/www/html/cron.php
postgres-1 | 2025-03-11 14:04:49.364 UTC [27] LOG: checkpoint starting: time
postgres-1 | 2025-03-11 14:04:51.502 UTC [27] LOG: checkpoint complete: wrote 21 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.007 s, sync=0.070 s, total=2.138 s; sync files=12, longest=0.018 s, average=0.006 s; distance=149 kB, estimate=149 kB; lsn=0/2243288, redo lsn=0/2243230
nextcloud-cron-1 | crond: USER www-data pid 9 cmd php -f /var/www/html/cron.php
There are no nextcloud.log entries.
nextcloud.log is an empty file containing zero information, it is owned by www-data and everything seems to be in order in that regard.
Configuration
Nextcloud
The output of occ config:list system
or similar is best, but, if not possible, the contents of your config.php
file from /path/to/nextcloud
is fine (make sure to remove any identifiable information!):
/var/www/html # sudo -u 'www-data' ./occ config:list system
Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
The current PHP memory limit is below the recommended value of 512MB.
{
"system": {
"memcache.local": "\\OC\\Memcache\\APCu",
"apps_paths": [
{
"path": "\/var\/www\/html\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/html\/custom_apps",
"url": "\/custom_apps",
"writable": true
}
],
"memcache.distributed": "\\OC\\Memcache\\Redis",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"password": "***REMOVED SENSITIVE VALUE***",
"port": 6379
},
"overwritehost": "cloud.mydomain.com",
"overwriteprotocol": "https",
"overwrite.cli.url": "https:\/\/cloud.mydomain.com",
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"upgrade.disable-web": true,
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"localhost",
"cloud.mydomain.com"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "pgsql",
"version": "30.0.6.2",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"instanceid": "***REMOVED SENSITIVE VALUE***"
}
}
/var/www/html #
Additional information
The docker-compose.yml file I use is the following:
services:
nextcloud:
# Use the official nextcloud image (v21.0.0 at time of writing this)
image: nextcloud:stable-fpm-alpine@sha256:fd092d936643c2e0c0b80c27d5518c793e5e215d5b5836e5ecdca973395b2c34
container_name: nextcloud
hostname: nextcloud
restart: unless-stopped
networks:
- nextcloud
- proxy
# Open ports in the format host:container - We will remove this later
ports:
# INSECURE - we will remove this later after completing a few more steps in this guide
- ${PORT_NEXTCLOUD}:80
volumes:
- ${LOCAL_BASE_PATH}/nextcloud/data:${DATA_PATH}
# - ${NAS_DOCUMENTS_PATH}:${DATA_PATH}/data/tue/files
environment:
TZ: ${TZ}
POSTGRES_HOST: postgres
DB_PORT: 5432
POSTGRES_DB: ${NEXTCLOUD_DB_NAME}
POSTGRES_USER: ${NEXTCLOUD_DB_USER}
POSTGRES_PASSWORD: ${NEXTCLOUD_DB_PASSWORD}
REDIS_HOST: redis
REDIS_HOST_PORT: 6379
REDIS_HOST_PASSWORD: ${NEXTCLOUD_REDIS_PASSWORD}
NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USERNAME}
NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_HOSTNAME}
OVERWRITECLIURL: https://${NEXTCLOUD_HOSTNAME}
OVERWRITEPROTOCOL: https
OVERWRITEHOST: ${NEXTCLOUD_HOSTNAME}
TRUSTED_PROXIES: 172.16.0.0/12 192.168.0.0/16 10.0.0.0/8 fc00::/7 fe80::/10 2001:db8::/32
NC_maintenance_window_start: 1
NC_default_phone_region: 'DK'
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:80/" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 90s
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.nextcloud.entrypoints=https"
- "traefik.http.routers.nextcloud.rule=Host(`cloud.${DOMAIN}`)"
- "traefik.http.routers.nextcloud.tls=true"
- "traefik.http.routers.nextcloud.service=nextcloud"
- "traefik.http.services.nextcloud.loadbalancer.server.port=80"
- "traefik.http.services.nextcloud.loadbalancer.passhostheader=true"
- "traefik.http.middlewares.nextcloud-securityheaders.headers.stsSeconds=15552000"
- "traefik.http.middlewares.nextcloud-securityheaders.headers.stsIncludeSubdomains=true"
- "traefik.http.middlewares.nextcloud-securityheaders.headers.stsPreload=true"
- "traefik.http.routers.nextcloud.middlewares=nextcloud-redirectregex1,nextcloud-redirectregex2,compresstraefik,nextcloud-securityheaders"
- "traefik.http.middlewares.nextcloud-redirectregex1.redirectregex.permanent=true"
- "traefik.http.middlewares.nextcloud-redirectregex1.redirectregex.regex=https?://([^/]*)/.well-known/(card|cal)dav"
- "traefik.http.middlewares.nextcloud-redirectregex1.redirectregex.replacement=https://$${1}/remote.php/dav/"
- "traefik.http.middlewares.nextcloud-redirectregex2.redirectregex.permanent=true"
- "traefik.http.middlewares.nextcloud-redirectregex2.redirectregex.regex=https?://([^/]*)(/.well-known[^#]*)"
- "traefik.http.middlewares.nextcloud-redirectregex2.redirectregex.replacement=https://$${1}/index.php$${2}"
- "traefik.http.middlewares.compresstraefik.compress=true"
postgres:
image: postgres:17.2@sha256:87ec5e0a167dc7d4831729f9e1d2ee7b8597dcc49ccd9e43cc5f89e808d2adae
volumes:
- ${LOCAL_BASE_PATH}/nextcloud/db:/var/lib/postgresql/data
- ${LOCAL_BASE_PATH}/nextcloud/backup:/backup
environment:
POSTGRES_DB: ${NEXTCLOUD_DB_NAME}
POSTGRES_USER: ${NEXTCLOUD_DB_USER}
POSTGRES_PASSWORD: ${NEXTCLOUD_DB_PASSWORD}
networks:
- nextcloud
healthcheck:
test: [ "CMD", "pg_isready", "-q", "-d", "${NEXTCLOUD_DB_NAME}", "-U", "${NEXTCLOUD_DB_USER}" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 60s
restart: unless-stopped
redis:
image: redis:7.4.2@sha256:93a8d83b707d0d6a1b9186edecca2e37f83722ae0e398aee4eea0ff17c2fad0e
command: ["redis-server", "--requirepass", "$NEXTCLOUD_REDIS_PASSWORD"]
volumes:
- ${LOCAL_BASE_PATH}/nextcloud/redis:/data
networks:
- nextcloud
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 60s
restart: unless-stopped
nextcloud-cron:
image: nextcloud:stable-fpm-alpine@sha256:fd092d936643c2e0c0b80c27d5518c793e5e215d5b5836e5ecdca973395b2c34
entrypoint: /cron.sh
volumes:
- ${LOCAL_BASE_PATH}/nextcloud/data:${DATA_PATH}
networks:
- nextcloud
# Declare networks at the high level to avoid confusion and to access those
# not initially started by this document.
networks:
# Internal facing network for Nextcloud Docker containers
nextcloud:
name: nextcloud
# Define how we want the network created
driver: bridge
proxy:
external: true