NC 27, all `POSTGRES_*` env vars set but warning of using sqlite on initial start?

Hi, I’m setting up nextcloud using the nextcloud:27 image. I don’t want to use the AIO because it makes too many assumptions for my setup.

In the docs, it says that I can configure it to use postgres “out of the box” by setting all the POSTGRES_ env vars. But when I do that, launch the stack (using Swarm), and go to the nextcloud homepage, it warns me I’m using sqlite. If I pick postgres instead, none of the data is pre-populated.

What gives?

...
services:
  nextcloud:
    image: nextcloud:27
    environment:
      POSTGRES_HOST: db
      POSTGRES_DB: nextcloud
      POSTGRES_USER_FILE: "/run/secrets/nextcloud_db_user"
      POSTGRES_PASSWORD_FILE: "/run/secrets/nextcloud_db_password"
...

The secrets exist, are present in the container.

Any ideas?

Hi, did you see https://github.com/nextcloud/all-in-one/tree/main/manual-install already?

Yes, the example yaml files in there don’t use secrets. I wonder if there is a bug in the image where it only looks for POSTGRES_* instead of handling POSTGRES_*_FILE and so it thinks it’s missing some of the POSTGRES_* vars, and skips the automated db config setup?

For those struggling with this, see Autoconfig environment `_FILE` variables · Issue #2062 · nextcloud/docker · GitHub

Basically, either you set every POSTGRES_*_FILE env var on the nextcloud image or none. You can’t mix and match.

1 Like