-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprox.sh
More file actions
executable file
·47 lines (38 loc) · 1.08 KB
/
prox.sh
File metadata and controls
executable file
·47 lines (38 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -e
set -x
# Usage: ./proxy.sh molten-yearling
REDIS_HOST=10.204.203.78
SUBDOMAIN=$1
IP=$(ifconfig eth0 | sed -n 2p | cut -d ":" -f2 | cut -d " " -f10)
sleep 3
echo "Polling docker for the port"
COUNTER=1
PORT_OUT=''
while [ 1 ]; do
echo "docker port output:"
echo The counter is $COUNTER
set +e
PORT_OUT=$(/usr/bin/docker port devmon-$SUBDOMAIN 5000)
set -e
if [[ "$?" -ne "0" ]]; then
echo $PORT_OUT
continue
fi
echo $PORT_OUT
PORT=$(echo $PORT_OUT | sed 's/.*:\([:digit:]*\)/\1/')
echo "port result"
echo $PORT
if [[ "$PORT" -ne "" ]];
then
break
fi
sleep 1
let COUNTER=COUNTER+1
done
curl "http://$REDIS_HOST:7379/DEL/frontend:$SUBDOMAIN.appcbtr.com"
curl "http://$REDIS_HOST:7379/RPUSH/frontend:$SUBDOMAIN.appcbtr.com/$SUBDOMAIN"
curl "http://$REDIS_HOST:7379/RPUSH/frontend:$SUBDOMAIN.appcbtr.com/http%3A%2F%2F$IP:$PORT"
curl "http://$REDIS_HOST:7379/DEL/frontend:*.$SUBDOMAIN.appcbtr.com"
curl "http://$REDIS_HOST:7379/RPUSH/frontend:*.$SUBDOMAIN.appcbtr.com/$SUBDOMAIN"
curl "http://$REDIS_HOST:7379/RPUSH/frontend:*.$SUBDOMAIN.appcbtr.com/http%3A%2F%2F$IP:$PORT"