Closed alexlenail closed 6 years ago
Hi @zfrenchee, this is really more a question on how to manage docker compose's container startup order. While we could add this to pgbedrock's documentation (and if you put in a PR for it it probably would be accepted), it seems superfluous given that there's a lot of examples of this out there already, including one in the docker compose docs themselves.
What I've typically done with "wait for db to be up" problems in the past is the same as what they show in that link: create a tiny wrapper script that accepts extra commands and then runs them after the db is up. To be specific, in that linked example they get the host from the arguments passed in ($1
), pop that argument (shift
), and then set all the other arguments to the script as the additional command to subsequently run (cmd="$@"
). Put all together:
host="$1"
shift
cmd="$@"
So you'd have a pgbedrock container in your docker compose setup that would use a wrapper script like that: keep seeing if postgres is up, and once it is run pgbedrock.
I'm going to close this issue, but let me know if you want to try to add a more detailed write-up to the docs and I can re-open this issue for reference.
Hope that helps!
I have
How do I properly add pgbedrock to my compose setup?