mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-07 13:44:17 +08:00
added wait script for the mq to hold on until server is up
This commit is contained in:
parent
a751b4fbd0
commit
8941ba3657
2 changed files with 22 additions and 0 deletions
|
@ -39,6 +39,7 @@ services:
|
|||
VERBOSITY: "1"
|
||||
MANAGE_IPTABLES: "on"
|
||||
PORT_FORWARD_SERVICES: "dns"
|
||||
MQ_ADMIN_PASSWORD: "MQ_ADMIN_PASSWORD"
|
||||
ports:
|
||||
- "51821-51830:51821-51830/udp"
|
||||
expose:
|
||||
|
@ -109,9 +110,13 @@ services:
|
|||
depends_on:
|
||||
- netmaker
|
||||
restart: unless-stopped
|
||||
command: ["/mosquitto/config/wait.sh"]
|
||||
environment:
|
||||
NETMAKER_SERVER_HOST: "api.NETMAKER_BASE_DOMAIN"
|
||||
volumes:
|
||||
- /root/mosquitto.conf:/mosquitto/config/mosquitto.conf
|
||||
- /root/dynamic-security.json:/mosquitto/config/dynamic-security.json
|
||||
- /root/wait.sh:/mosquitto/config/wait.sh
|
||||
- mosquitto_data:/mosquitto/data
|
||||
- mosquitto_logs:/mosquitto/log
|
||||
expose:
|
||||
|
|
17
docker/wait.sh
Executable file
17
docker/wait.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
wait_for_netmaker() {
|
||||
until curl --output /dev/null --silent --fail --head \
|
||||
--location "${NETMAKER_SERVER_HOST}/api/server/health"; do
|
||||
echo "Waiting for netmaker server to startup"
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
# wait for netmaker to startup
|
||||
apk add curl
|
||||
wait_for_netmaker
|
||||
}
|
||||
|
||||
main "${@}"
|
Loading…
Add table
Reference in a new issue