Include database configuration examples for compose and swarm deployments
In the "Database Configuration" section on the image docs (https://hub.docker.com/_/postgres), it's easy to see how to override database configuration for docker run commands. I'm currently trying to do this via docker stack deploy..., and am struggling to figure this out.
It would be very helpful if the... via docker stack deploy or docker-compose section included an example of specifying a database parameter such as random_page_cost
This seems to work - if there is a better way, I'd like to know!
...
volumes:
pgdata:
driver: local
services:
postgis:
image: $POSTGIS_IMAGE
command: >-
postgres
-c random_page_cost=2
-c seq_page_cost=1
-c shared_buffers=512MB
-c work_mem=32MB
-c maintenance_work_mem=128MB
-c wal_buffers=4MB
-c wal_level=minimal
-c max_wal_senders=0
-c fsync=on
...
That's definitely a very solid solution. 👍
Thank you @tianon. It seems to work, though unless I'm imagining things these only get applied on the first container start? (i.e. if I redeploy the Docker stack with different values those don't seem to reflect). Is that correct?
I'm pretty sure CLI flags like that will apply retroactively (unlike initdb arguments / initdb environment variables).
Okay, thank you. I must have confused myself elsewhere