Hi. I'm trying to set up a docker stack with postg...
# help
r
Hi. I'm trying to set up a docker stack with postgres. When starting the stack, the lakefs container terminates before the database container starts:
Copy code
lakefs-lakefs-1  | time="2024-04-05T23:48:35Z" level=info msg="lakeFS run" func=cmd/lakefs/cmd.glob..func8 file="cmd/run.go:91" version=1.16.0
lakefs-lakefs-1  | time="2024-04-05T23:48:35Z" level=fatal msg="Failed to open KV store" func=cmd/lakefs/cmd.glob..func8 file="cmd/run.go:99" error="connect failed: failed to connect to `host=db user=postgres database=lakefs`: dial error (dial tcp 172.30.0.2:5432: connect: connection refused)"
lakefs-db-1      | 
lakefs-db-1      | PostgreSQL Database directory appears to contain a database; Skipping initialization
lakefs-db-1      | 
lakefs-db-1      | 
lakefs-db-1      | 2024-04-05 23:48:35.174 UTC [1] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
lakefs-db-1      | 2024-04-05 23:48:35.215 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
lakefs-db-1      | 2024-04-05 23:48:35.215 UTC [1] LOG:  listening on IPv6 address "::", port 5432
lakefs-db-1      | 2024-04-05 23:48:35.216 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
lakefs-db-1      | 2024-04-05 23:48:35.221 UTC [16] LOG:  database system was shut down at 2024-04-05 23:48:09 UTC
lakefs-db-1      | 2024-04-05 23:48:35.228 UTC [1] LOG:  database system is ready to accept connections
After initialization, I can connect from another container just fine to the database. Is there some way for lakefs to halt connecting to the database until it has started?
i
Hey Ralph, lakeFS has some built in mechanism to try and reconnect to the DB. If the containers are too out of sync, you can use Docker premetives to sync the containers, see here fo example.