Browse Source

Change other setting and env

Admin User 6 years ago
parent
commit
21780bda65
3 changed files with 8 additions and 7 deletions
  1. 1 0
      Dockerfile
  2. 2 2
      check_ip.sh
  3. 5 5
      docker-entrypoint.sh

+ 1 - 0
Dockerfile

@@ -3,3 +3,4 @@ ENTRYPOINT ["/tmp/docker-entrypoint.sh"]
 COPY docker-entrypoint.sh \
      check_ip.sh \
      /tmp/
+RUN apk --update --no-cache add curl

+ 2 - 2
check_ip.sh

@@ -8,8 +8,8 @@ check_service() {
 }
 
 check_ip() {
-  curl -f ${floating_ip}
-  if [ $? == 0 ]; then echo "${floating_ip} is exist!!!"; return 0; else echo "The ${floating_ip} doesn't exist!"; return 1; fi
+  curl -f ${vip}
+  if [ $? == 0 ]; then echo "${vip} is exist!!!"; return 0; else echo "The ${vip} doesn't exist!"; return 1; fi
 }
 
 check=0

+ 5 - 5
docker-entrypoint.sh

@@ -2,16 +2,16 @@
 #set -e
 
 if [ -z ${service} ]; then echo "The service isn't defined!!!"; exit 1; fi
-if [ -z ${floating_ip} ]; then echo "IP isn't defined!!!"; exit 1; fi
-if [ -z ${floating_mask} ]; then echo "NetMASK isn't defined!!!"; exit 1; fi
-if [ -z ${floating_if} ]; then echo "IF isn't defined!!!"; exit 1; fi
+if [ -z ${vip} ]; then echo "IP isn't defined!!!"; exit 1; fi
+if [ -z ${vin} ]; then echo "NetMASK isn't defined!!!"; exit 1; fi
+if [ -z ${vif} ]; then echo "IF isn't defined!!!"; exit 1; fi
 
 trap cleanup SIGTERM EXIT
   cleanup()
     {
-      ip addr del ${floating_ip}/${floating_mask} dev ${floating_if}:floating
+      ip addr del ${vip}/${vin} dev ${vif}:vip
     }
-    ip addr add ${floating_ip}/${floating_mask} brd + dev ${floating_if} label ${floating}:floating
+    ip addr add ${vip}/${vin} brd + dev ${vif} label ${vif}:vip
 exec "/tmp/check_ip.sh" "$@" &
 wait