The Basics
- Nextcloud Server version (e.g., 29.x.x):
fpm-30
- Operating system and version (e.g., Ubuntu 24.04):
debian bookworm
- Web server and version (e.g, Apache 2.4.25):
nginx:latest
- Reverse proxy and version _(e.g. nginx 1.27.2)
caddy:latest
- PHP version (e.g, 8.3):
the one from the image
- Is this the first time you’ve seen this error? (Yes / No):
yes
- When did this problem seem to first start?
when I tried creating my nextcloud stack
- Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
Docker
- Are you using CloudfIare, mod_security, or similar? (Yes / No)
no
Summary of the issue you are facing:
So I am trying to create a Docker Stack with docker compose for my nextcloud application. I used maria DB for some years now in my old instalation but I am trying to refresh that shit.
Thats why I opted to do a new install with postgres:16, nginx, redis:7 and the nextcloud:fpm-30 image.
But doing that seems to be rather complicated. I havent used a custom postgres install before but I figured, that I need to modify the pg_hba.conf
to allow my nextcloud container to talk with the DB.
Also figured out, that I want to update the postgresql.conf
Mostly for SSL and authentication settings.
Since I am a puppet user, I created a small puppet class for the general nextcloud setup as well as for the postgres part. But after trying to roll it out for the first time, I ran into some issues.
- The postgres container skips initialization since there are already files present in
/var/lib/postgresql/data
these files are just my config files that are placed before the container is created via a bind mount. - The nextcloud container fails to connect to the db container since it cant resolve the
POSTGRES_HOST
. This seems to be due to the fact that the postgres container for some arbitrary reason is not joined to thenextcloud_internal
network. This in turn stops the nextcloud container from doing the fist install steps and nothing works.
Log entries
nextcloud-app-1 | Error while trying to create admin account: An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "db" (172.20.0.2), port 5432 failed: Connection refused
nextcloud-db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
Here is the docker-compose.yml, pg_hba.conf, postgresql.conf, and my puppet code:
→ nextcloud-setup ($4798696) · Snippets · GitLab
PS: If I dont apply any custom stuff to the postgres, It is unable to connect to the nextcloud container. Then the container refuses the conenction from the nextcloud container.