Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
Privatisation_Deploy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
tianye
Privatisation_Deploy
Commits
d34a4e68
Commit
d34a4e68
authored
Jun 15, 2022
by
tianye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 自定义安装模式-增加mysql,mongo,redis的判断; 服务安装模式-加入判断为必须用所有外部才可成功安装
parent
d208b7c2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
127 additions
and
62 deletions
+127
-62
docker-compose-datacenter.yaml
...ver/app_server/data-center/docker-compose-datacenter.yaml
+0
-20
hcctl.bak_search-center
bak/hcctl.bak_search-center
+0
-0
install.ini.bak
bak/install.ini.bak
+0
-0
install.sh.bak
bak/install.sh.bak
+0
-0
hcctl
hcctl
+98
-35
install.ini
install.ini
+25
-4
install.sh
install.sh
+4
-3
No files found.
Health-cloud-server/app_server/data-center/docker-compose-datacenter.yaml
deleted
100644 → 0
View file @
d208b7c2
version
:
'
3'
services
:
health-cloud-data-center
:
image
:
harbor.hw.jiankangyouyi.com:5000/search-center-public/data-center:v1.0
container_name
:
health-cloud-data-center
environment
:
JAVA_OPTS
:
stdin_open
:
true
volumes
:
-
./secret_key:/run/secret/key:ro
-
${DEPLOY_DIR}/${APP_NAME}/conf/application.yml:/conf/application.yml:ro
#- sc_log:/logs
tty
:
true
ports
:
-
"
8008:9000"
#depends_on:
#- elasticsearch
#- rabbitmq
networks
:
-
sc_net
hcctl.bak_search-center
→
bak/
hcctl.bak_search-center
View file @
d34a4e68
File moved
install.ini.bak
→
bak/
install.ini.bak
View file @
d34a4e68
File moved
install.sh.bak
→
bak/
install.sh.bak
100755 → 100644
View file @
d34a4e68
File moved
hcctl
View file @
d34a4e68
...
...
@@ -3,7 +3,7 @@ action=$1
target
=
$2
source
~/.hcrc 2>/dev/null
||
echo
""
app_sc_dir
=
${
app_sc_dir
:-
/ops_project/Health-cloud-server
/data-center
}
app_sc_dir
=
${
app_sc_dir
:-
/ops_project/Health-cloud-server
}
source
${
app_sc_dir
}
/
${
APP_NAME
}
/install.ini
#DB-compose文件DB_DEPLOY_DIR
...
...
@@ -11,7 +11,7 @@ COMPOSE_FILE=$(cat ${app_sc_dir}/${target}/compose_files 2>/dev/null || echo "")
#修改es连接信息(默认-->外部)
edit_es_info
(){
echo
-e
" 使用外部
MQ
"
echo
-e
" 使用外部
Elasticsearch
"
echo
-e
" 即将修改配置...."
sleep
2
sed
-i
-e
"s#host: es#host:
${
ES_HOST
}
#g"
\
...
...
@@ -23,7 +23,7 @@ edit_es_info(){
}
#修改mq连接信息(默认-->外部)
edit_mq_info
(){
echo
-e
" 使用外部M
Q
"
echo
-e
" 使用外部M
q
"
echo
-e
" 即将修改配置...."
sleep
2
sed
-i
-e
"s#host: rabbitmq01#host:
${
MQ_HOST
}
#g"
\
...
...
@@ -32,6 +32,31 @@ edit_mq_info(){
-e
"s#port: 5672#port:
${
MQ_PORT
}
#g"
\
-e
"s#virtual-host: /#virtual-host:
${
MQ_VHOST
}
#g"
${
APP_CONF_DIR
}
/application.yml
}
#修改mysql连接信息(默认-->外部)
edit_mysql_info
(){
echo
-e
" 使用外部MySql"
echo
-e
" 即将修改配置...."
sleep
2
sed
-i
-e
"s#url: jdbc:mysql:
\/\/
mysql57:3306/ego_gw_db#url: jdbc:mysql:
\/\/
${
MYSQL_HOST
}
:
${
MYSQL_PORT
}
/
${
MYSQL_DB
}
#g"
\
-e
"s#username: root#username:
${
MYSQL_USERNAME
}
#g"
\
-e
"s#password: 123456#password:
${
MYSQL_PASSWORD
}
#g"
${
APP_CONF_DIR
}
/application.yml
}
#修改mongodb连接信息(默认-->外部)
edit_mongodb_info
(){
echo
-e
" 使用外部MongoDB"
echo
-e
" 即将修改配置...."
sleep
2
sed
-i
-e
"s#uri: mongodb:
\/\/
ego_gw_self:123456@mongo
\/
ego_gw_db#uri: mongodb:
\/\/
${
MONGODB_USERNAME
}
:
${
MONGODB_PASSWORD
}
@
${
MONGODB_URL
}
\/
${
MONGODB_DB
}
"
${
APP_CONF_DIR
}
/application.yml
}
#修改redis连接信息(默认-->外部)
edit_redis_info
(){
echo
-e
" 使用外部Redis"
echo
-e
" 即将修改配置...."
sleep
2
sed
-i
-e
"s#host: redis#host:
${
REDIS_HOST
}
#g"
\
-e
"s#password: redis123456#password:
${
REDIS_PASSWORD
}
#g"
\
-e
"s#port: 6379#port:
${
REDIS_PORT
}
#g"
${
APP_CONF_DIR
}
/application.yml
}
function
usage
()
{
echo
"Health-Cloud 控制脚本"
...
...
@@ -57,20 +82,19 @@ install_compose-files(){
compose_files
=
"-f
${
DB_DEPLOY_DIR
}
/docker-compose-base.yaml"
case
${
INSTALL_MODE
}
in
all
)
echo
"即将进入all模式,这将安装
data-center
全部服务与组件"
echo
"即将进入all模式,这将安装
${
APP_NAME
}
全部服务与组件"
sleep
2
#compose_files="${compose_files} -f ${DB_DEPLOY_DIR}/docker-compose-es.yaml -f ${DB_DEPLOY_DIR}/docker-compose-mq.yaml -f ${app_sc_dir}/docker-compose-searchcenter.yaml"
compose_files
=
"
${
compose_files
}
-f
${
DB_DEPLOY_DIR
}
/docker-compose-es.yaml -f
${
DB_DEPLOY_DIR
}
/docker-compose-mq.yaml -f
${
DB_DEPLOY_DIR
}
/docker-compose-mongodb.yaml -f
${
DB_DEPLOY_DIR
}
/docker-compose-mysql.yaml -f
${
DB_DEPLOY_DIR
}
/docker-compose-redis.yaml -f
${
app_sc_dir
}
/
${
APP_NAME
}
/docker-compose-
${
APP_NAME
}
.yaml"
break
;;
server
)
echo
"即将进入server模式,这将只安装
data-center
服务"
echo
"即将进入server模式,这将只安装
${
APP_NAME
}
服务"
sleep
2
compose_files
=
"
${
compose_files
}
-f
${
app_sc_dir
}
/
docker-compose-datacenter
.yaml"
compose_files
=
"
${
compose_files
}
-f
${
app_sc_dir
}
/
${
APP_NAME
}
/docker-compose-
${
APP_NAME
}
.yaml"
break
;;
controller
)
echo
"即将进入crontroller模式,这将根据install.ini中
您的所配置的(es,mq)是否使用外部来选择安装
"
echo
"即将进入crontroller模式,这将根据install.ini中
ISUSE_STATUS选项决定您按需安装的中间件服务
"
sleep
2
break
;;
...
...
@@ -87,23 +111,27 @@ install_compose-files(){
#是否使用外部组件
if
[
${
INSTALL_MODE
}
==
"all"
]
;
then
echo
-e
"正在创建数据目录"
#mkdir -p ${db_sc_dir}/data/{es_data,mq_data}
echo
-e
"正在创建中间件数据目录..."
mkdir
-p
${
db_sc_dir
}
/data/
{
es_data,mq_data,mongo_data,redis_data,mysql_data
}
echo
-e
"正在创建日志目录"
mkdir
-p
${
app_sc_dir
}
/log
elif
[
${
INSTALL_MODE
}
==
"server"
]
;
then
echo
-e
"正在创建日志目录"
mkdir
-p
${
app_sc_dir
}
/log
true_count
=
$(
grep
-i
"true"
${
app_sc_dir
}
/
${
APP_NAME
}
/install.ini|wc
-l
)
if
[
$true_count
-eq
0
]
;
then
edit_es_info
edit_mq_info
edit_mysql_info
edit_mongodb_info
edit_redis_info
else
echo
"由于您选择了server模式,所以install.ini中您未将所有使用外部中间件开关置为true,请检查后再次重试..."
exit
127
fi
elif
[
${
INSTALL_MODE
}
==
"controller"
]
;
then
#判断es
if
[
${
ES_ISUSE_STATUS
}
==
'false'
]
;
then
echo
-e
"正在创建Elasticsearch数据目录"
echo
-e
"正在创建Elasticsearch数据目录
...
"
mkdir
-p
${
db_sc_dir
}
/data/es_data
chown
-R
1000:0
${
db_sc_dir
}
/data/es_data
compose_files
=
"
${
compose_files
}
-f
${
DB_DEPLOY_DIR
}
/docker-compose-es.yaml -f
${
app_sc_dir
}
/
docker-compose-searchcenter
.yaml"
compose_files
=
"
${
compose_files
}
-f
${
DB_DEPLOY_DIR
}
/docker-compose-es.yaml -f
${
app_sc_dir
}
/
${
APP_NAME
}
/docker-compose-
${
APP_NAME
}
.yaml"
elif
[
${
ES_ISUSE_STATUS
}
==
'true'
]
;
then
edit_es_info
else
...
...
@@ -112,17 +140,52 @@ install_compose-files(){
fi
#判断mq
if
[
${
MQ_ISUSE_STATUS
}
==
'false'
]
;
then
echo
-e
"正在创建MQ数据目录"
mkdir
-p
${
db_sc_dir
}
/data/
es
_data
compose_files
=
"
${
compose_files
}
-f
${
DB_DEPLOY_DIR
}
/docker-compose-mq.yaml -f
${
app_sc_dir
}
/
docker-compose-searchcenter
.yaml"
echo
-e
"正在创建MQ数据目录
...
"
mkdir
-p
${
db_sc_dir
}
/data/
mq
_data
compose_files
=
"
${
compose_files
}
-f
${
DB_DEPLOY_DIR
}
/docker-compose-mq.yaml -f
${
app_sc_dir
}
/
${
APP_NAME
}
/docker-compose-
${
APP_NAME
}
.yaml"
elif
[
${
MQ_ISUSE_STATUS
}
==
'true'
]
;
then
edit_mq_info
else
ehco
"mq_isuse_status配置错误"
exit
127
fi
echo
-e
"正在创建日志目录"
mkdir
-p
${
app_sc_dir
}
/log
#判断mysql
if
[
${
MYSQL_ISUSE_STATUS
}
==
'false'
]
;
then
echo
-e
"正在创建MYSQL数据目录..."
mkdir
-p
${
db_sc_dir
}
/data/mysql_data
compose_files
=
"
${
compose_files
}
-f
${
DB_DEPLOY_DIR
}
/docker-compose-mysql.yaml -f
${
app_sc_dir
}
/
${
APP_NAME
}
/docker-compose-
${
APP_NAME
}
.yaml"
elif
[
${
MQ_ISUSE_STATUS
}
==
'true'
]
;
then
edit_mysql_info
else
ehco
"mysql_isuse_status配置错误"
exit
127
fi
#判断mongodb
if
[
${
MONGODB_ISUSE_STATUS
}
==
'false'
]
;
then
echo
-e
"正在创建MongoDB数据目录..."
mkdir
-p
${
db_sc_dir
}
/data/mongo_data
compose_files
=
"
${
compose_files
}
-f
${
DB_DEPLOY_DIR
}
/docker-compose-mongodb.yaml -f
${
app_sc_dir
}
/
${
APP_NAME
}
/docker-compose-
${
APP_NAME
}
.yaml"
elif
[
${
MQ_ISUSE_STATUS
}
==
'true'
]
;
then
edit_mongodb_info
else
ehco
"mongodb_isuse_status配置错误"
exit
127
fi
#判断redis
if
[
${
REDIS_ISUSE_STATUS
}
==
'false'
]
;
then
echo
-e
"正在创建Redis数据目录..."
mkdir
-p
${
db_sc_dir
}
/data/redis_data
compose_files
=
"
${
compose_files
}
-f
${
DB_DEPLOY_DIR
}
/docker-compose-redis.yaml -f
${
app_sc_dir
}
/
${
APP_NAME
}
/docker-compose-
${
APP_NAME
}
.yaml"
elif
[
${
REDIS_ISUSE_STATUS
}
==
'true'
]
;
then
edit_redis_info
else
ehco
"redis_isuse_status配置错误"
exit
127
fi
fi
#将所需要部署的组件ymal输出到文件
echo
"
${
compose_files
}
"
>
${
app_sc_dir
}
/
${
APP_NAME
}
/compose_files
...
...
install.ini
View file @
d34a4e68
...
...
@@ -15,7 +15,6 @@ APP_CONF_DIR=${DEPLOY_DIR}/${APP_NAME}/conf
#是否使用外部es
ES_ISUSE_STATUS
=
false
#es
ES_HOST
=
192.168.1.201
ES_USERNAME
=
app_search-center
...
...
@@ -26,14 +25,36 @@ ES_TCP_PORT=9300
#是否使用外部rabbitmq
MQ_ISUSE_STATUS
=
false
#mq
MQ_HOST
=
121.36.45.76,121.36.67.45,119.3.221.135
MQ_PORT
=
5672
MQ_VHOST
=
/
qa
MQ_USERNAME
=
ego_gw_
qa
MQ_VHOST
=
/
dev
MQ_USERNAME
=
ego_gw_
dev
MQ_PASSWORD
=
jkyy_pwd
#是否使用外部mysql
MYSQL_ISUSE_STATUS
=
false
#mysql
MYSQL_HOST
=
test.mysql.hw
MYSQL_PORT
=
3306
MYSQL_DB
=
ego_gw_db
MYSQL_USERNAME
=
egd_hca
MYSQL_PASSWORD
=
eYhGqLHo7HrDKITh
#是否使用外部mongodb
MONGODB_ISUSE_STATUS
=
false
#mongodb
MONGODB_URL
=
192.168.1.14:8635,192.168.1.2:8635
MONGODB_DB
=
ego_gw_db
MONGODB_USERNAME
=
egd_hca
MONGODB_PASSWORD
=
wx+M-LAbog^l0xL0
#是否使用外部redis
REDIS_ISUSE_STATUS
=
false
#redis
REDIS_HOST
=
test.redis.hw
REDIS_PORT
=
6379
REDIS_PASSWORD
=
FezUc3YF9CK7PGu5
...
...
install.sh
View file @
d34a4e68
...
...
@@ -67,10 +67,11 @@ cd ${app_sc_dir}/${APP_NAME}
#--------------------部署-----------------------#
echo
-e
"----------安装向导------------"
echo
-e
"-
all模式-->全部安装(主服务
${
APP_NAME
}
+数据库+队列)
"
echo
-e
"-
server模式-->只安装主服务
${
APP_NAME
}
(请注意提前修改install.ini中外部db和mq的连接配置)
"
echo
-e
"-
controller模式-->安装主服务
${
APP_NAME
}
+数据库 or 队列
"
echo
-e
"-
-- all模式 --- 【安装: 微服务
${
APP_NAME
}
+ 全部中间件安装 】
"
echo
-e
"-
-- server模式 ---【安装:微服务
${
APP_NAME
}
】
"
echo
-e
"-
-- controller模式 --- 【安装: 微服务
${
APP_NAME
}
+ 自定义中间件安装 】
"
echo
-e
"------------------------------"
echo
-e
"注意:除all模式外,其余模式均需要: 提前修改install.ini中外部db和mq的配置开关"
PS3
=
'请选择安装模式: '
hcctl install_compose-files
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment