geopython/GeoHealthCheck

set pgport if !5432 on docker

pvgenuchten opened this issue · 1 comments

docker has a script that checks if postgres is running prior to starting the webapp
this script assumes the default port, usually 5432
but you can set a environment variable PGPORT to the relevant db port/. Psql will then use that port

typically you will get this type of messages, if there is a bad port

Check if Postgres is avail/ready...
12 example.com:5432 - no response
11 Exit code=2 - Postgres not ready - sleeping
10 example.com:5432 - no response

suggestion to include this aspect in docker documentation

Aha good catch! The the Docker Bash script parses out ${DB_HOST} from the ${SQLALCHEMY_DATABASE_URI} but not ${DB_PORT}, so the default of 5432 is taken.
That (parsing/using ${DB_PORT} could be the ultimate solution, but for the time being setting the standard PG-var PGPORT can help.

Note that there has been a merged PR that attempts to solve the "Is PostgreSQL Ready?" trials using the
SQLALCHEMY_ENGINE_OPTION_PRE_PING:
PR #400. But the Docker script does not take that into account and #400 is more geared to lost PG-connections during operations. I should revisit the details if this also works for startup.

IMO the final solution should come from within the GHC Python code not an external Bash-script. This problem ihas been solved a hundred times, suggestions welcome!