Closed marcinwaldowski closed 8 years ago
:+1:
Maybe we can make a more general approach. Something like before/after hooks, but for each container.
Such solution will allow us to put simple sleep 2
there or wait for a certain port:
while ! nc -q 1 $ip 3306 </dev/null >/dev/null; do
sleep 1
done
What do you think? @marcinwaldowski @coderofsalvation
I like your idea better than my :)
I'm not experienced in bash programming. Can we implement it in such a way that in case of very simple things (like sleep 5
) the body of container hook could be included in-line in crowdr.cfg.sh file?
+1 for the port polling solution
I had the same problem, I have a crowdr-hook which would sleep x amount of seconds, before it would append some servernames to the /etc/hosts
-file of a container.
This doesn't work always :D
Just after seeing this pull request only once I'd created my own : #10
I added hooks for run, rmi and build, looks like this in the cfg:
...
redis hook run.after sleep 5
...
Implemented in 0.9.0.
This change add two options:
start_wait_sec
- instruct crowdr to wait specified number of seconds after running or starting containerThis change allows for example for waiting for container initialization before starting other containers. One real use case is using consul. If you want to run container which use
consul -join server_host
as CMD then the container will fail to start in case consul server is not yet initialized.stop_delay_sec
- instruct crowdr to wait specified number of seconds before stopping containerThis change allows giving some time before stopping container for proper react to stopping of other containers. I run into some issues when I stopped Apache Zookeeper container immediately after stopping Apache Kafka containers. Using
stop_delay_sec 2
for Apache Zookeeper container solves that issues.