Просмотр исходного кода

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

zhanghongtong 5 лет назад
Родитель
Сommit
068c351936
2 измененных файлов с 4 добавлено и 2 удалено
  1. 1 1
      deploy/charts/emqx/values.yaml
  2. 3 1
      deploy/docker/start.sh

+ 1 - 1
deploy/charts/emqx/values.yaml

@@ -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.

+ 3 - 1
deploy/docker/start.sh

@@ -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