-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_infra.sh
executable file
·61 lines (47 loc) · 1.48 KB
/
setup_infra.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
set +o verbose
# check clients docker networks existence
docker network inspect clients >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Network clients exists."
else
docker network create clients --subnet 10.0.10.0/24
echo "Network clients created."
fi
# check servers docker network existence
docker network inspect servers >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Network servers exists."
else
docker network create servers --subnet 10.0.11.0/24
echo "Network servers created."
fi
# check router docker image existence
docker image inspect router >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Image router exists."
else
docker build -t router -f router/Dockerfile .
echo "Image router created."
fi
# check router container existence
docker container inspect router >/dev/null 2>&1
if [ $? -eq 0 ]; then
docker container stop router
docker container rm router
echo "Container router removed."
fi
# add --rm??
docker run -d --name router router
echo "Container router executed."
# attach router to client and server networks
docker network connect --ip 10.0.10.254 clients router
docker network connect --ip 10.0.11.254 servers router
echo "Container router connected to client and server networks."
# check chord docker image existence
# docker image inspect chord >/dev/null 2>&1
# if [ $? -eq 0 ]; then
# echo "Image chord exists."
# else
# docker build -t chord -f chord/chord.Dockerfile chord/
# echo "Image chord created."
# fi