tomishinets.v 5 năm trước cách đây
mục cha
commit
0ad1757bb4
2 tập tin đã thay đổi với 3 bổ sung4 xóa
  1. 1 1
      Dockerfile
  2. 2 3
      healthcheck.sh

+ 1 - 1
Dockerfile

@@ -4,7 +4,7 @@ COPY docker-entrypoint.sh healthcheck.sh /usr/share/web-registry-portal/bin/
 COPY application-logger.xml /etc/web-registry-portal/
 ENV PATH=/usr/share/web-registry-portal/bin:$PATH LANG="en_US.UTF-8" ADMIN_HOST=admin
 EXPOSE 9000 2551
-HEALTHCHECK --start-period=30s --interval=15s --timeout=5s --retries=2 CMD healthcheck.sh
+HEALTHCHECK --start-period=30s --interval=20s --timeout=10s --retries=2 CMD healthcheck.sh
 ARG repo=prod
 RUN set -x \
            && curl https://repo.infoclinica.ru/yum/centos/sds-${repo}-portal.repo -o /etc/yum.repos.d/sds-${repo}-portal.repo \

+ 2 - 3
healthcheck.sh

@@ -11,7 +11,6 @@ curl -f -H 'Host:demo.infoclinica.ru' 127.0.0.1:9000/login || exit 1
 
 # Проверяем наличие файла с переменной time_to_dead
 if [ -f /tmp/dead ];then
-#  dead_to_time=$(cat /tmp/dead)
   if (( ${curtime} > $(cat /tmp/dead) ));then kill 1;fi
 else
 # Определяем изменился ли адрес админки
@@ -21,11 +20,11 @@ else
     if [[ ${new_admin_ip} != $(cat /tmp/admin_ip) ]];then
       ping -c3 ${new_admin_ip} || exit 0
     fi
+# Вычисляем адреса task'ов и сортируем их
     sorted=($(echo $(dig tasks.${SERVICE_NAME}.${APPNET} +short)|tr " " "\n"|sort -n))
     for (( i=0; i < ${#sorted[*]}; i++ ))
     do
-      [[ $(ip a | grep ${sorted[${i}]}) ]] && echo $((${i}*180+$(date +%s)+60)) > /tmp/dead
-#      if [[ ${sorted[${i}]} == $(dig ${HOSTNAME}.${APPNET} +short) ]];then echo $((${i}*180+$(date +%s)+20)) > /tmp/dead;fi
+      [[ $(ip a | grep ${sorted[${i}]}) ]] && echo $((${i}*180+$(date +%s)+40)) > /tmp/dead
     done
   fi
 fi