-
Notifications
You must be signed in to change notification settings - Fork 341
/
deploy.sh
156 lines (132 loc) · 4.66 KB
/
deploy.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
#作者(author):自动畅(auto-chang)
#微信号(WeChat):自动畅(auto-chang)
#公众号(WeChat official account):畅聊了个科技(IT-chang)
#时间(Time):2023年4月22日,星期六(Saturday, April 22, 2023)
#描述(Describe:为爱发电(Power Generation for Love)
usage() {
cat << EOF >&2
Usage: $PROGNAME
-keeper --install-keeper
-web --install-Web
-dk --deploy-keeper
-dw --deploy-Web
-rw --run-Web
-rk --run-keeper
-h --help
EOF
exit 1
}
if [ "$1" == "" ]; then
usage
fi
while true; do
case "$1" in
-keeper | --install-keeper ) ACTION=install-keeper; shift ;;
-web | --install-Web ) ACTION=install-Web; shift ;;
-dk | --deploy-keeper ) ACTION=deploy-keeper; shift ;;
-dw | --deploy-Web ) ACTION=deploy-Web; shift ;;
-rw | --run-Web ) ACTION=run-Web; shift ;;
-rk | --run-keeper ) ACTION=run-keeper; shift ;;
-h | --help ) usage; exit 1 ;;
-- ) shift; break ;;
* ) break ;;
esac
done
APP_KEEPER_NAME=ak-keeper
APP_WEB_NAME=ak-web
echo "Welcome to the AKStream(c# NetCore Programming Language)"
echo "You have chosen an $ACTION "
if [ "$ACTION" == install-keeper ]; then
if [ ! -f ubuntu-zlm-ffmpeg-dotnet.tar ]
then
echo "This image is quite large, please be patient and wait for a while"
echo "Please visit the URL to download--> https://share.weiyun.com/WJBSrscU "
echo "After downloading, execute the command---> docker load -i ubuntu-zlm-ffmpeg-dotnet.tar"
#docker load -i ubuntu-zlm-ffmpeg-dotnet.tar
else
docker build -f Dockerfile-Keeper -t $APP_KEEPER_NAME .
fi
fi
if [ "$ACTION" == install-Web ]; then
docker build -f Dockerfile-Web -t $APP_WEB_NAME .
fi
if [ "$ACTION" == deploy-keeper ]; then
# shellcheck disable=SC2046
docker stop $(docker ps | grep $APP_KEEPER_NAME | awk '{print $1}')
# shellcheck disable=SC2046
docker rm $(docker ps -a | grep $APP_KEEPER_NAME | awk '{print $1}')
# shellcheck disable=SC2046
#docker rmi $(docker images | grep $APP_KEEPER_NAME | awk '{print $3}')
docker run -p 6880:6880 \
-p 10001-10010:10001-10010 \
-p 10001-10010:10001-10010/udp \
-p 20002-20200:20002-20200 \
-p 20002-20200:20002-20200/udp \
-p 6881:80 \
-p 6882:1935 \
-p 6883:554 \
-p 6883:554/udp \
-p 10000:10000 \
-p 10000:10000/udp \
-p 8000:8000/udp \
-p 30000-30035:30000-30035/udp \
-v ./AKStreamKeeper/Config/AKStreamKeeper.json:/root/AKStreamKeeper/Config/AKStreamKeeper.json \
-v ./AKStreamKeeper/Config/logconfig.xml:/root/AKStreamKeeper/Config/logconfig.xml \
--name=$APP_KEEPER_NAME \
--restart=always \
-d $APP_KEEPER_NAME \
dotnet AKStreamKeeper.dll
fi
if [ "$ACTION" == run-keeper ]; then
docker run -p 6880:6880 \
-p 10001-10010:10001-10010 \
-p 10001-10010:10001-10010/udp \
-p 20002-20200:20002-20200 \
-p 20002-20200:20002-20200/udp \
-p 6881:80 \
-p 6882:1935 \
-p 6883:554 \
-p 6883:554/udp \
-p 10000:10000 \
-p 10000:10000/udp \
-p 8000:8000/udp \
-p 30000-30035:30000-30035/udp \
-v ./AKStreamKeeper/Config/AKStreamKeeper.json:/root/AKStreamKeeper/Config/AKStreamKeeper.json \
-v ./AKStreamKeeper/Config/logconfig.xml:/root/AKStreamKeeper/Config/logconfig.xml \
--name=$APP_KEEPER_NAME \
--restart=always \
-d $APP_KEEPER_NAME \
dotnet AKStreamKeeper.dll
fi
if [ "$ACTION" == deploy-Web ]; then
# shellcheck disable=SC2046
docker stop $(docker ps | grep $APP_WEB_NAME | awk '{print $1}')
# shellcheck disable=SC2046
docker rm $(docker ps -a | grep $APP_WEB_NAME | awk '{print $1}')
# shellcheck disable=SC2046
#docker rmi $(docker images | grep $APP_WEB_NAME | awk '{print $3}')
docker run -p 5800:5800 \
-p 5060:5060 \
-p 5060:5060/udp \
-v ./AKStreamWeb/Config/AKStreamWeb.json:/app/Config/AKStreamWeb.json \
-v ./AKStreamWeb/Config/SipClientConfig.json:/app/Config/SipClientConfig.json \
-v ./AKStreamWeb/Config/SipServerConfig.json:/app/Config/SipServerConfig.json \
-v ./AKStreamWeb/Config/logconfig.xml:/app/Config/logconfig.xml \
--name=$APP_WEB_NAME \
--restart=always \
-d $APP_WEB_NAME
fi
if [ "$ACTION" == run-Web ]; then
docker run -p 5800:5800 \
-p 5060:5060 \
-p 5060:5060/udp \
-v ./AKStreamWeb/Config/AKStreamWeb.json:/app/Config/AKStreamWeb.json \
-v ./AKStreamWeb/Config/SipClientConfig.json:/app/Config/SipClientConfig.json \
-v ./AKStreamWeb/Config/SipServerConfig.json:/app/Config/SipServerConfig.json \
-v ./AKStreamWeb/Config/logconfig.xml:/app/Config/logconfig.xml \
--name=$APP_WEB_NAME \
--restart=always \
-d $APP_WEB_NAME
fi
echo "Successful script execution, best wishes for you"