blob: cc8452537b9543a3464820fa0168b2a1d7017475 [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001#!/bin/bash
2
3if [ $# -eq 0 ]; then
4 echo "No arguments supplied"
5 exit 1
6fi
7
8
9RELEASE=$1
10DEP_ENV=$2
11
12
13docker_ids=`docker ps -a | egrep "Exit" | awk '{print $1}'`
14for X in ${docker_ids}
15do
16 docker rm -f ${X}
17done
18
19export IP=`ifconfig eth0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
20
21echo ""
22
23# Back-End
24my_cnt=`docker ps|egrep -c "sdc-backend:${RELEASE}"`
25if [ "${my_cnt}" -eq "1" ]; then
26# echo "`date` - BE is running" >> /data/ASDC/logs/watchdog.log
27 echo "`date` - BE is running" > /dev/null
28else
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}
32fi
33
34# Front-End
35my_cnt=`docker ps|egrep -c "sdc-frontend:${RELEASE}"`
36if [ "${my_cnt}" -eq "1" ]; then
37# echo "`date` - FE is running" >> /data/ASDC/logs/watchdog.log
38 echo "`date` - FE is running" >> /dev/null
39else
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}
43fi