Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | if [ $# -eq 0 ]; then |
| 4 | echo "No arguments supplied" |
| 5 | exit 1 |
| 6 | fi |
| 7 | |
| 8 | |
| 9 | RELEASE=$1 |
| 10 | DEP_ENV=$2 |
| 11 | |
| 12 | |
| 13 | docker_ids=`docker ps -a | egrep "Exit" | awk '{print $1}'` |
| 14 | for X in ${docker_ids} |
| 15 | do |
| 16 | docker rm -f ${X} |
| 17 | done |
| 18 | |
| 19 | export IP=`ifconfig eth0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'` |
| 20 | |
| 21 | echo "" |
| 22 | |
| 23 | # Back-End |
| 24 | my_cnt=`docker ps|egrep -c "sdc-backend:${RELEASE}"` |
| 25 | if [ "${my_cnt}" -eq "1" ]; then |
| 26 | # echo "`date` - BE is running" >> /data/ASDC/logs/watchdog.log |
| 27 | echo "`date` - BE is running" > /dev/null |
| 28 | else |
| 29 | echo "`date` - BE was down" >> /data/ASDC/logs/watchdog.log |
| 30 | docker pull ecomp-nexus:51212/ecomp/sdc-backend:${RELEASE} |
| 31 | docker run --detach --name sdc-BE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 3g --memory-swap=3g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/ASDC/logs/BE/:/var/lib/jetty/logs --volume /data/ASDC/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ecomp-nexus:51212/ecomp/sdc-backend:${RELEASE} |
| 32 | fi |
| 33 | |
| 34 | # Front-End |
| 35 | my_cnt=`docker ps|egrep -c "sdc-frontend:${RELEASE}"` |
| 36 | if [ "${my_cnt}" -eq "1" ]; then |
| 37 | # echo "`date` - FE is running" >> /data/ASDC/logs/watchdog.log |
| 38 | echo "`date` - FE is running" >> /dev/null |
| 39 | else |
| 40 | echo "`date` - FE was down" >> /data/ASDC/logs/watchdog.log |
| 41 | docker pull ecomp-nexus:51212/ecomp/sdc-frontend:${RELEASE} |
| 42 | docker run --detach --name sdc-FE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 2g --memory-swap=2g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/ASDC/logs/FE/:/var/lib/jetty/logs --volume /data/ASDC/environments:/root/chef-solo/environments --publish 9443:9443 --publish 8181:8181 ecomp-nexus:51212/ecomp/sdc-frontend:${RELEASE} |
| 43 | fi |
ml636r | 0649e65 | 2017-02-20 21:10:54 +0200 | [diff] [blame^] | 44 | |