Thread: Storing config in the data directory

Storing config in the data directory

From
Vincent Jaubert
Date:
Hi everyone,
i am somewhat struggling with the postgres 16.4 package on Ubuntu. I hope this is the correct mailing list to ask this question.
I am using postgresql on servers deployed in the cloud.
I would like to host both postgres data and config in an attached network storage (block storage). This way, when i want to recreate a new server, i have just to use the same block storage as the previous server to continue working with minimal interruption.
So at boot time, the block storage is mounted at /var/lib/postgresql
The problem is that the debian package choose to store config in /etc/postgresql instead.
I tried various workarounds :
  • create a bind mount in /etc/postgresql and another in /var/lib/postgresql
  • store settings in /var/lib/postgresql and create a symlink in /etc/postgresql
Both ways work, but when doing like this, for some reason the server is not restarting at bootup.
When running manually `systemctl start postgresql` it works,  but whatever i tried, i can't get it to start at boot. I have read dozens of logs, and i don't see any error anywhere.
I am also concerned that in case of failure, the server would not restart.
What could be the source of this ?

Thank you.

Vincent Jaubert