-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Hi,
I want to ensure at any start of postgres container, that a custom setting is set from enviroment variable from my docker-compose
file.
I thought docker-entrypoint-initdb.d
would be the way to go, but if I have a volume for the pg data initialized already, than these scripts are not executed.
I have a script like this:
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
SET my.node_id = $MY_NODE_ID;
ALTER SYSTEM SET my.node_id = $MY_NODE_ID;
SELECT pg_reload_conf();
EOSQL
And a docker-compose.yml like this:
postgres:
image: postgres:9.5
volumes:
- ./postgresql_data:/var/lib/postgresql/data
- ./script/postgres_configure_node_id.sh:/docker-entrypoint-initdb.d/configure-node-id.sh
environment:
ERICA_NODE_ID: 1
Would you merge a pull request, that would lead to execution of everything in, let's say, /docker-entrypoint-start.d
when the docker container starts?
Metadata
Metadata
Assignees
Labels
No labels