sosedoff / pgweb

Cross-platform client for PostgreSQL databases
https://sosedoff.github.io/pgweb
MIT License
8.53k stars 724 forks source link

Dockerfile: wait for postgres #694

Closed frafra closed 8 months ago

frafra commented 10 months ago

Sometimes pgweb starts before Postgres, and it fails, because Postgres is slower to start, or it has to initialize its database or recover. This makes it try until Postgres is available.

Two commits:

  1. Execute the pgweb command as command instead of entrypoint
  2. Use script as entrypoint which waits for Postgres to be available
sosedoff commented 10 months ago

What are your thoughts on having the waiting done via a special CLI flag? Having this functionality only tied to Docker is not ideal as it'll need to be documented separately vs a general flag that works the same everywhere. We can detect connection refused errors upon connect and act accordingly (retry N times etc)

frafra commented 10 months ago

It would be nice, actually :)

sosedoff commented 10 months ago

Currently in WIP at https://github.com/sosedoff/pgweb/pull/695

sosedoff commented 8 months ago

Im closing this since #695 is already merged