-
Notifications
You must be signed in to change notification settings - Fork 485
Closed
Description
From #290 and #292, reconnecting database during init process was introduced, but this makes a dependency service management harder in docker-compose.yml
like the following redmine usecase, because redmine database migration process starts before reconnecting database and failed.
https://github.com/gtt-project/docker-gtt/blob/feature/simplify-docker-settings/docker-compose.yml
services:
postgis:
image: postgis/postgis:14-3.2
volumes:
- postgis:/var/lib/postgresql/data
redmine:
:
depends_on:
- postgis
docker-compose.yml
side workaround is possible by waiting for last postgis_tiger_geocoder
extension like as follows, but this is not handy.
volumes:
- postgis:/var/lib/postgresql/data
+ healthcheck:
+ test: "pg_isready && psql -c \"\\dx\" | grep postgis_tiger_geocoder"
+ interval: 10s
+ timeout: 2s
+ retries: 5
+ start_period: 10s
redmine:
:
depends_on:
- - postgis
+ postgis:
+ condition: service_healthy
So, if possible, without reconnecting database during init process is preferable.
The following diff is my suggestion, but I am not sure whether the sessions are separated and original #290 issue will be solved by this.
--- a/initdb-postgis.sh
+++ b/initdb-postgis.sh
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
- -- Reconnect to update pg_setting.resetval
- -- See https://github.com/postgis/docker-postgis/issues/288
- \c
+EOSQL
+
+ "${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
EOSQL
ImreSamu
Metadata
Metadata
Assignees
Labels
No labels