chore(docker): controls the timeout of the container through environmental variables

This commit is contained in:
zhanghongtong 2021-01-26 10:04:23 +08:00 committed by Rory Z
parent da406689c5
commit 068c351936
2 changed files with 4 additions and 2 deletions

View File

@ -40,7 +40,7 @@ initContainers: {}
# image: alpine
# command: ["sh", "-c", "for i in $(seq 1 300); do nc -zvw1 mysql 3306 && exit 0 || sleep 3; done; exit 1"]
## EMQX configuration item, see the documentation (https://github.com/emqx/emqx-docker#emq-x-configuration)
## EMQX configuration item, see the documentation (https://hub.docker.com/r/emqx/emqx)
emqxConfig:
EMQX_CLUSTER__K8S__APISERVER: "https://kubernetes.default.svc:443"
## The address type is used to extract host from k8s service.

View File

@ -1,6 +1,8 @@
#!/bin/sh
set -e -u
EMQX_WAIT_TIME=${EMQX_WAIT_TIME:-5}
emqx_exit(){
# At least erlang.log.1 exists
if [ -f /opt/emqx/log/erlang.log.1 ]; then
@ -53,7 +55,7 @@ while [ $IDLE_TIME -lt 5 ]; do
else
echo "['$(date -u +"%Y-%m-%dT%H:%M:%SZ")']:emqx not running, waiting for recovery in $((25-IDLE_TIME*5)) seconds"
fi
sleep 5
sleep $EMQX_WAIT_TIME
done
# If running to here (the result 5 times not is running, thus in 25s emqx is not running), exit docker image