-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathautorun-for-k8s.sh
executable file
·171 lines (137 loc) · 4.94 KB
/
autorun-for-k8s.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash
trap 'exit' SIGTERM SIGINT
SERVERS_PATH=/data/src/Servers
#公共函数
function LOG_ERROR()
{
if (( $# < 1 ))
then
echo -e "\033[33m usesage: LOG_ERROR msg \033[0m";
fi
local msg=$(date +%Y-%m-%d" "%H:%M:%S);
msg="${msg} $@";
echo -e "\033[31m $msg \033[0m";
}
function LOG_WARNING()
{
if (( $# < 1 ))
then
echo -e "\033[33m usesage: LOG_WARNING msg \033[0m";
fi
local msg=$(date +%Y-%m-%d" "%H:%M:%S);
msg="${msg} $@";
echo -e "\033[33m $msg \033[0m";
}
function LOG_DEBUG()
{
if (( $# < 1 ))
then
LOG_WARNING "Usage: LOG_DEBUG logmsg";
fi
local msg=$(date +%Y-%m-%d" "%H:%M:%S);
msg="${msg} $@";
echo -e "\033[40;37m $msg \033[0m";
}
function LOG_INFO()
{
if (( $# < 1 ))
then
LOG_WARNING "Usage: LOG_INFO logmsg";
fi
local msg=$(date +%Y-%m-%d" "%H:%M:%S);
for p in $@
do
msg=${msg}" "${p};
done
echo -e "\033[32m $msg \033[0m"
}
LOG_DEBUG "Building CPP"
# --------------------------------------cpp--------------------------------------
rm -rf ${SERVERS_PATH}/CppServer/build
mkdir -p ${SERVERS_PATH}/CppServer/build
cd ${SERVERS_PATH}/CppServer/build
cmake .. -DTARS_WEB_HOST=${WEB_HOST}
make -j4
cd ${SERVERS_PATH}/..
exec-build.sh tarscloud/tars.cppbase cpp Servers/CppServer/build/bin/CppHttp yaml/CppHttp.yaml latest true || exit -1
exec-helm.sh yaml/CppHttp.yaml latest || exit -1
exec-deploy.sh tars-dev demo-cpphttp-1.0.0.tgz || exit -1
exec-build.sh tarscloud/tars.cppbase cpp Servers/CppServer/build/bin/CppTars yaml/CppTars.yaml latest true || exit -1
exec-helm.sh yaml/CppTars.yaml latest || exit -1
exec-deploy.sh tars-dev demo-cpptars-1.0.0.tgz || exit -1
# --------------------------------------golang--------------------------------------
LOG_DEBUG "Building GoLang"
cd ${SERVERS_PATH}/GoServer/GoHttp
go mod vendor
make
cd ${SERVERS_PATH}/..
exec-build.sh tarscloud/tars.cppbase go Servers/GoServer/GoHttp/GoHttp yaml/GoHttp.yaml latest true || exit -1
exec-helm.sh yaml/GoHttp.yaml latest || exit -1
exec-deploy.sh tars-dev demo-gohttp-1.0.0.tgz || exit -1
cd ${SERVERS_PATH}/GoServer/GoTars
go mod vendor
make
cd ${SERVERS_PATH}/..
exec-build.sh tarscloud/tars.cppbase go Servers/GoServer/GoTars/GoTars yaml/GoTars.yaml latest true || exit -1
exec-helm.sh yaml/GoTars.yaml latest || exit -1
exec-deploy.sh tars-dev demo-gotars-1.0.0.tgz || exit -1
# --------------------------------------java--------------------------------------
LOG_DEBUG "Building Java"
cd ${SERVERS_PATH}/JavaServer/JavaHttp
rm -rf ./target
mvn package
cd ${SERVERS_PATH}/..
cp Servers/JavaServer/JavaHttp/target/JavaHttp-1.0-SNAPSHOT.jar Servers/JavaServer/JavaHttp/target/JavaHttp.jar
exec-build.sh tarscloud/tars.javabase java-jar Servers/JavaServer/JavaHttp/target/JavaHttp.jar yaml/JavaHttp.yaml latest true || exit -1
exec-helm.sh yaml/JavaHttp.yaml latest || exit -1
exec-deploy.sh tars-dev demo-javahttp-1.0.0.tgz || exit -1
cd ${SERVERS_PATH}/JavaServer/JavaTars
rm -rf ./target
mvn package
cd ${SERVERS_PATH}/..
cp Servers/JavaServer/JavaTars/target/JavaTars-1.0-SNAPSHOT.jar Servers/JavaServer/JavaTars/target/JavaTars.jar
exec-build.sh tarscloud/tars.javabase java-jar Servers/JavaServer/JavaTars/target/JavaTars.jar yaml/JavaTars.yaml latest true || exit -1
exec-helm.sh yaml/JavaTars.yaml latest || exit -1
exec-deploy.sh tars-dev demo-javatars-1.0.0.tgz || exit -1
# --------------------------------------nodejs--------------------------------------
LOG_DEBUG "Building Nodejs"
source /root/.bashrc
source /etc/profile
cd ${SERVERS_PATH}/NodejsServer/NodejsHttp
npm install
cd ${SERVERS_PATH}/..
exec-build.sh tarscloud/tars.nodejsbase nodejs Servers/NodejsServer/NodejsHttp yaml/NodejsHttp.yaml latest true || exit -1
exec-helm.sh yaml/NodejsHttp.yaml latest || exit -1
exec-deploy.sh tars-dev demo-nodejshttp-1.0.0.tgz || exit -1
cd ${SERVERS_PATH}/NodejsServer/NodejsTars
npm install
cd ${SERVERS_PATH}/..
exec-build.sh tarscloud/tars.nodejsbase nodejs Servers/NodejsServer/NodejsTars yaml/NodejsTars.yaml latest true || exit -1
exec-helm.sh yaml/NodejsTars.yaml latest || exit -1
exec-deploy.sh tars-dev demo-nodejstars-1.0.0.tgz || exit -1
# --------------------------------------php--------------------------------------
LOG_DEBUG "Building PHP"
cd ${SERVERS_PATH}/PhpServer/PHPHttp/src
mkdir servant
composer install
cd ../scripts
./tars2php.sh
cd ${SERVERS_PATH}/..
exec-build.sh tarscloud/tars.php74base php Servers/PhpServer/PHPHttp yaml/PhpHttp.yaml latest true || exit -1
exec-helm.sh yaml/PhpHttp.yaml latest || exit -1
exec-deploy.sh tars-dev demo-phphttp-1.0.0.tgz || exit -1
# cd ../src
# rm -rf *.tar.gz
# composer run-script deploy
cd ${SERVERS_PATH}/PhpServer/PHPTars/src
mkdir servant
composer install
cd ../scripts
./tars2php.sh
cd ${SERVERS_PATH}/..
exec-build.sh tarscloud/tars.php74base php Servers/PhpServer/PHPTars yaml/PhpTars.yaml latest true || exit -1
exec-helm.sh yaml/PhpTars.yaml latest || exit -1
exec-deploy.sh tars-dev demo-phptars-1.0.0.tgz || exit -1
# cd ../src
# rm -rf *.tar.gz
# composer run-script deploy