Waiting for MongoDB? #160
-
What happens if the mongodb container is not ready when the seeding container is run? Will it automatically retry to seed? I'm not sure if useful, but have you considered to add a wait-for script to your docker? It's a script which is run just in front of the normal docker command to wait for the mongodb to be ready before kicking off the main script. Here's a couple of official docker recommended options: If it's not relevant, please feel free to close this, but I tend to use this for my other containers so I don't get false errors in the logs. This probably is more relevant for mysql, as it tends to take much longer to startup, but I could still see it being useful for this project. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
P.S. regarding the official examples, I was reading this page: |
Beta Was this translation helpful? Give feedback.
-
Yes, exactly. You can configure the reconnect timeout by See the details here: https://github.com/pkosiec/mongo-seeding/blob/master/cli/README.md#environmental-variables |
Beta Was this translation helpful? Give feedback.
-
Excellent, somehow I missed that. |
Beta Was this translation helpful? Give feedback.
-
No problem 🙂I'm closing this as everything is clear. Feel free to comment or create another issue, if you have any further questions/ideas. |
Beta Was this translation helpful? Give feedback.
Yes, exactly. You can configure the reconnect timeout by
RECONNECT_TIMEOUT
env variable (CLI, Docker Image) or--reconnect-timeout
command line parameter (CLI). Of course the configuration property is also there in the JS library. So it will wait at most the time specified in the env variable, and it will try to reconnect every 0,5s.See the details here: https://github.com/pkosiec/mongo-seeding/blob/master/cli/README.md#environmental-variables