Closed dimrozakis closed 5 years ago
The change in behavior described above was perhaps caused by #399
Are you using the latest docker image (sosedoff/pgweb:0.11) ? In any case - i'll have a look.
I'm using sosedoff/pgweb:latest
which seems to be pointing to the same image id (81c2f0ef3f5a) as sosedoff/pgweb:0.11.0
.
I just tried to replicate your issue by having pgweb started using DATABASE_URL
env var:
DATABASE_URL
The change you've mentioned (#399) does not make any difference here since it only runs during the start up.
The issue I described occurs if postgres is down when pgweb is starting. So the steps to reproduce would be the following:
DATABASE_URL
Oh i see what you mean, i just noticed that when i was running another test.
I have the following snippet in my
docker-compose.yml
:When starting up containers with
docker-compose up
,pgweb
will sometimes try to connect topostgresql
before it can accept connections. Even with thedepends_on
, which causespostgresql
to be started beforepgweb
, there's no guarantee it'll be listening whenpgweb
tries to connect to it. In previous pgweb versions, this would cause thepgweb
container to exit and it would get restarted by the configured restart policy.Recently this behavior has changed. As far as I can tell, if
postgresql
isn't ready whenpgweb
tries to connect to it,pgweb
won't exit, but it seems to then completely forget the configuredDATABASE_URL
. Even afterpostgresql
is up and running, when visitingpgweb
's web UI, the user is prompted to enter database connection information in order to proceed.Ideally, I think that
pgweb
should retry connecting to the configuredDATABASE_URL
when the user visits the web UI (falling back to requesting connection information if it can't connect to it). Alternatively, reverting to the previous behavior makes it much easier to handle connection errors (by using restart policies in docker/docker-compose, kubernetes, systemd, supervisord or whatever system people are using to run pgweb).