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
d208b7c2
Commit
d208b7c2
authored
Jun 15, 2022
by
tianye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 手动部署多服务(菜单);hcctl支持多服务查看
parent
d3d72a8e
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
478 additions
and
32 deletions
+478
-32
docker-compose-data-center.yaml
...er/app_server/data-center/docker-compose-data-center.yaml
+22
-0
docker-compose-search-center.yaml
...pp_server/search-center/docker-compose-search-center.yaml
+3
-1
docker-compose-base.yaml
Health-cloud-server/db_server/docker-compose-base.yaml
+6
-6
hcctl.bak_202206141737
bak/hcctl.bak_202206141737
+197
-0
install.sh.bak_202206141737
bak/install.sh.bak_202206141737
+89
-0
hcctl
hcctl
+12
-11
install.ini
install.ini
+2
-2
install.ini.bak
install.ini.bak
+44
-0
install.sh
install.sh
+29
-12
install.sh.bak
install.sh.bak
+72
-0
uninstall.sh
uninstall.sh
+2
-0
No files found.
Health-cloud-server/app_server/data-center/docker-compose-data-center.yaml
0 → 100644
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
-
server_logs_data-center:/logs
tty
:
true
ports
:
-
"
8008:9000"
#depends_on:
#- elasticsearch
#- rabbitmq
networks
:
-
sc_net
volumes
:
server_logs_data-center
:
{}
Health-cloud-server/app_server/search-center/docker-compose-searchcenter.yaml
→
Health-cloud-server/app_server/search-center/docker-compose-search
-
center.yaml
View file @
d208b7c2
...
@@ -9,7 +9,7 @@ services:
...
@@ -9,7 +9,7 @@ services:
volumes
:
volumes
:
-
./secret_key:/run/secret/key:ro
-
./secret_key:/run/secret/key:ro
-
${DEPLOY_DIR}/${APP_NAME}/conf/application.yml:/conf/application.yml
-
${DEPLOY_DIR}/${APP_NAME}/conf/application.yml:/conf/application.yml
-
s
c_log
:/logs
-
s
erver_logs_search-center
:/logs
tty
:
true
tty
:
true
ports
:
ports
:
-
"
8004:9001"
-
"
8004:9001"
...
@@ -18,3 +18,5 @@ services:
...
@@ -18,3 +18,5 @@ services:
#- rabbitmq
#- rabbitmq
networks
:
networks
:
-
sc_net
-
sc_net
volumes
:
server_logs_search-center
:
{}
Health-cloud-server/db_server/docker-compose-base.yaml
View file @
d208b7c2
version
:
'
3'
version
:
'
3'
volumes
:
#
volumes:
sc_log
:
# logs_${APP_NAME}
:
driver_opts
:
#
driver_opts:
type
:
none
#
type: none
device
:
${DEPLOY_DIR}/${APP_NAME}/log
#
device: ${DEPLOY_DIR}/${APP_NAME}/log
o
:
bind
#
o: bind
networks
:
networks
:
...
...
bak/hcctl.bak_202206141737
0 → 100755
View file @
d208b7c2
#!/bin/bash
action
=
$1
target
=
$2
source
~/.hcrc 2>/dev/null
||
echo
""
app_sc_dir
=
${
app_sc_dir
:-
/ops_project/Health-cloud-server/data-center
}
source
${
app_sc_dir
}
/install.ini
#DB-compose文件DB_DEPLOY_DIR
COMPOSE_FILE
=
$(
cat
${
app_sc_dir
}
/compose_files 2>/dev/null
||
echo
""
)
#修改es连接信息(默认-->外部)
edit_es_info
(){
echo
-e
" 使用外部MQ"
echo
-e
" 即将修改配置...."
sleep
2
sed
-i
-e
"s#host: es#host:
${
ES_HOST
}
#g"
\
-e
"s#username: elastic#username:
${
ES_USERNAME
}
#g"
\
-e
"s#password: changeme#password:
${
ES_PASSWORD
}
#g"
\
-e
"s#httpPort: 9200#httpPort:
${
ES_HTTP_PORT
}
#g"
\
-e
"s#tcpPort: 9300#tcpPort:
${
ES_TCP_PORT
}
#g"
\
-e
"s#clusterName: elasticsearch-cluster#clusterName:
${
ES_ClusterName
}
#g"
${
APP_CONF_DIR
}
/application.yml
}
#修改mq连接信息(默认-->外部)
edit_mq_info
(){
echo
-e
" 使用外部MQ"
echo
-e
" 即将修改配置...."
sleep
2
sed
-i
-e
"s#host: rabbitmq01#host:
${
MQ_HOST
}
#g"
\
-e
"s#username: admin#username:
${
MQ_USERNAME
}
#g"
\
-e
"s#password: admin#password:
${
MQ_PASSWORD
}
#g"
\
-e
"s#port: 5672#port:
${
MQ_PORT
}
#g"
\
-e
"s#virtual-host: /#virtual-host:
${
MQ_VHOST
}
#g"
${
APP_CONF_DIR
}
/application.yml
}
function
usage
()
{
echo
"Health-Cloud 控制脚本"
echo
echo
"Usage: "
echo
" ./hcctl.sh [COMMAND] [ARGS...]"
echo
" ./hcctl.sh --help"
echo
echo
"Commands: "
echo
" status 查看 Health-Cloud 服务运行状态"
echo
" start 启动 Health-Cloud 服务"
echo
" stop 停止 Health-Cloud 服务"
echo
" restart 重启 Health-Cloud 服务"
echo
" uninstall 卸载 Health-Cloud 服务"
}
#docker-compose的基础配置
install_compose-files
(){
select
INSTALL_MODE
in
"all"
"server"
"controller"
do
echo
"
${
DB_DEPLOY_DIR
}
,
${
APP_NAME
}
"
compose_files
=
"-f
${
DB_DEPLOY_DIR
}
/docker-compose-base.yaml"
case
${
INSTALL_MODE
}
in
all
)
echo
"即将进入all模式,这将安装data-center全部服务与组件"
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
}
/docker-compose-
${
APP_NAME
}
.yaml"
break
;;
server
)
echo
"即将进入server模式,这将只安装data-center服务"
sleep
2
compose_files
=
"
${
compose_files
}
-f
${
app_sc_dir
}
/docker-compose-datacenter.yaml"
break
;;
controller
)
echo
"即将进入crontroller模式,这将根据install.ini中您的所配置的(es,mq)是否使用外部来选择安装"
sleep
2
break
;;
exit
)
echo
"Good Bye!"
exit
0
;;
*
)
echo
"错误模式-请重新输入"
exit
127
esac
done
#是否使用外部组件
if
[
${
INSTALL_MODE
}
==
"all"
]
;
then
echo
-e
"正在创建数据目录"
#mkdir -p ${db_sc_dir}/data/{es_data,mq_data}
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
edit_es_info
edit_mq_info
elif
[
${
INSTALL_MODE
}
==
"controller"
]
;
then
#判断es
if
[
${
ES_ISUSE_STATUS
}
==
'false'
]
;
then
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"
elif
[
${
ES_ISUSE_STATUS
}
==
'true'
]
;
then
edit_es_info
else
echo
"es_isuse_status配置错误"
exit
127
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"
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
fi
#将所需要部署的组件ymal输出到文件
echo
"
${
compose_files
}
"
>
${
app_sc_dir
}
/compose_files
COMPOSE_FILE
=
$(
cat
${
app_sc_dir
}
/compose_files
)
echo
"即将启动docker-compose部署"
sudo
docker-compose
${
COMPOSE_FILE
}
up
-d
}
function
status
(){
echo
cd
${
app_sc_dir
}
docker-compose
${
COMPOSE_FILE
}
ps
}
function
start
(){
echo
cd
${
app_sc_dir
}
docker-compose
${
COMPOSE_FILE
}
start
}
function
stop
(){
echo
cd
${
app_sc_dir
}
docker-compose
${
COMPOSE_FILE
}
stop
}
function
restart
(){
echo
cd
${
app_sc_dir
}
docker-compose
${
COMPOSE_FILE
}
stop
docker-compose
${
COMPOSE_FILE
}
start
}
function
uninstall
(){
echo
cd
${
app_sc_dir
}
docker-compose
${
COMPOSE_FILE
}
down
}
function
main
(){
case
"
${
action
}
"
in
status
)
status
;;
start
)
start
;;
stop
)
stop
;;
restart
)
restart
;;
uninstall
)
uninstall
;;
--help
)
usage
;;
-h
)
usage
;;
install_compose-files
)
# pwd
echo
"即将执行方法install-compose"
install_compose-files
;;
*
)
echo
cd
${
app_sc_dir
}
docker-compose
${
COMPOSE_FILES
}
$@
;;
esac
}
main
$@
bak/install.sh.bak_202206141737
0 → 100755
View file @
d208b7c2
#!/bin/bash
#set -e
#加载配置信息
function
if_err
(){
if
[
$?
-ne
0
]
;
then
exit
127
fi
}
function
get_appname
(){
echo
-e
"
\0
33[32mWelcome To Install Health-Cloud-Server
\n\0
33[0m"
echo
-e
"
\0
33[32m目前支持的服务:
\0
33[0m"
PS3
=
"请输入本次安装服务的序号:"
select
APP_NAME
in
"data-center"
"search-center"
"ehm"
"assessment"
do
APP_NAME
=
${
APP_NAME
}
echo
$APP_NAME
break
done
}
get_appname
sed
-i
"s/APP_NAME=/APP_NAME=
${
APP_NAME
}
/g"
./install.ini
source
./install.ini
#定义安装程序的app路径
DEPLOY_FILE
=
$(
dirname
$0
)
/Health-cloud-server/app_server
#定义安装程序的db路径
DB_DEPLOY_FILE
=
$(
dirname
$0
)
/Health-cloud-server/db_server
if
[
!
-d
${
DEPLOY_DIR
}
]
;
then
mkdir
-p
${
DEPLOY_DIR
}
;
fi
#定义部署目标路径(app,db)
app_sc_dir
=
${
DEPLOY_DIR
}
/
${
APP_NAME
}
db_sc_dir
=
${
DB_DEPLOY_DIR
}
#将docker-compose工程部署到本机
if
[[
!
-d
${
app_sc_dir
}
]]
;
then
cp
-rf
${
DEPLOY_FILE
}
/
${
APP_NAME
}
${
app_sc_dir
}
cp
-rf
${
DB_DEPLOY_FILE
}
${
db_sc_dir
}
if_err
else
echo
"目标目录已安装
${
APP_NAME
}
,请检查
${
app_sc_dir
}
.hcrc是否存在"
exit
127
fi
#将配置文件存入环境变量文件,使其全局生效(app和db目录各存一份)
cp
./install.ini
${
app_sc_dir
}
/install.ini.example
cp
./install.ini
${
db_sc_dir
}
/install.ini.example
env_context
=
$(
cat
${
app_sc_dir
}
/install.ini.example |grep
-v
"^#"
|grep
-v
"^$"
)
echo
"
${
env_context
}
"
>
${
app_sc_dir
}
/.env
echo
"
${
env_context
}
"
>
${
db_sc_dir
}
/.env
source
${
app_sc_dir
}
/.env
source
${
db_sc_dir
}
/.env
ln
-s
${
app_sc_dir
}
/.env
${
app_sc_dir
}
/install.ini 2>/dev/null
ln
-s
${
db_sc_dir
}
/.env
${
db_sc_dir
}
/install.ini 2>/dev/null
#安装hcrc版本文件
echo
-e
"app_sc_dir=
${
app_sc_dir
}
\n
db_sc_dir=
${
db_sc_dir
}
\n
${
APP_NANME
}
版本
${
SC_IMAGE_VERSION
}
"
>
~/.hcrc 2>/dev/null
||
echo
""
#安装hcctl管理命令
sudo cp
hcctl /usr/local/bin
&&
sudo chmod
+x /usr/local/bin/hcctl
ln
-s
/usr/local/bin/hcctl /usr/bin/hcctl 2>/dev/null
cd
${
app_sc_dir
}
#--------------------部署-----------------------#
echo
-e
"----------安装向导------------"
echo
-e
"- all模式-->全部安装(主服务
${
APP_NAME
}
+数据库+队列)"
echo
-e
"- server模式-->只安装主服务
${
APP_NAME
}
(请注意提前修改install.ini中外部db和mq的连接配置)"
echo
-e
"- controller模式-->安装主服务
${
APP_NAME
}
+数据库 or 队列"
echo
-e
"------------------------------"
PS3
=
'请选择安装模式: '
hcctl install_compose-files
if
[
$?
-ne
0
]
;
then
echo
"安装过程出现错误,请查看相关配置..."
exit
127
fi
echo
"
${
APP_NAME
}
服务已安装成功...."
sleep
2
echo
-e
"服务启动状态: "
sleep
2
sudo
/usr/local/bin/hcctl status
sleep
2
echo
"Good Bye ~"
sed
-i
"s/APP_NAME=
${
APP_NAME
}
/APP_NAME=/g"
$(
dirname
$0
)
/install.ini
hcctl
View file @
d208b7c2
...
@@ -4,10 +4,10 @@ target=$2
...
@@ -4,10 +4,10 @@ target=$2
source
~/.hcrc 2>/dev/null
||
echo
""
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/data-center
}
source
${
app_sc_dir
}
/install.ini
source
${
app_sc_dir
}
/
${
APP_NAME
}
/
install.ini
#DB-compose文件DB_DEPLOY_DIR
#DB-compose文件DB_DEPLOY_DIR
COMPOSE_FILE
=
$(
cat
${
app_sc_dir
}
/compose_files 2>/dev/null
||
echo
""
)
COMPOSE_FILE
=
$(
cat
${
app_sc_dir
}
/
${
target
}
/
compose_files 2>/dev/null
||
echo
""
)
#修改es连接信息(默认-->外部)
#修改es连接信息(默认-->外部)
edit_es_info
(){
edit_es_info
(){
...
@@ -60,7 +60,7 @@ install_compose-files(){
...
@@ -60,7 +60,7 @@ install_compose-files(){
echo
"即将进入all模式,这将安装data-center全部服务与组件"
echo
"即将进入all模式,这将安装data-center全部服务与组件"
sleep
2
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 ${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
}
/
docker-compose-datacenter
.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
break
;;
;;
server
)
server
)
...
@@ -125,36 +125,37 @@ install_compose-files(){
...
@@ -125,36 +125,37 @@ install_compose-files(){
mkdir
-p
${
app_sc_dir
}
/log
mkdir
-p
${
app_sc_dir
}
/log
fi
fi
#将所需要部署的组件ymal输出到文件
#将所需要部署的组件ymal输出到文件
echo
"
${
compose_files
}
"
>
${
app_sc_dir
}
/compose_files
echo
"
${
compose_files
}
"
>
${
app_sc_dir
}
/
${
APP_NAME
}
/
compose_files
COMPOSE_FILE
=
$(
cat
${
app_sc_dir
}
/compose_files
)
COMPOSE_FILE
=
$(
cat
${
app_sc_dir
}
/
${
APP_NAME
}
/
compose_files
)
echo
"即将启动docker-compose部署"
echo
"即将启动docker-compose部署"
sudo
docker-compose
${
COMPOSE_FILE
}
up
-d
sudo
docker-compose
${
COMPOSE_FILE
}
up
-d
}
}
function
status
(){
function
status
(){
echo
echo
cd
${
app_sc_dir
}
APP_NAME
=
${
target
}
cd
${
app_sc_dir
}
/
${
target
}
docker-compose
${
COMPOSE_FILE
}
ps
docker-compose
${
COMPOSE_FILE
}
ps
}
}
function
start
(){
function
start
(){
echo
echo
cd
${
app_sc_dir
}
cd
${
app_sc_dir
}
/
${
target
}
docker-compose
${
COMPOSE_FILE
}
start
docker-compose
${
COMPOSE_FILE
}
start
}
}
function
stop
(){
function
stop
(){
echo
echo
cd
${
app_sc_dir
}
cd
${
app_sc_dir
}
/
${
target
}
docker-compose
${
COMPOSE_FILE
}
stop
docker-compose
${
COMPOSE_FILE
}
stop
}
}
function
restart
(){
function
restart
(){
echo
echo
cd
${
app_sc_dir
}
cd
${
app_sc_dir
}
/
${
target
}
docker-compose
${
COMPOSE_FILE
}
stop
docker-compose
${
COMPOSE_FILE
}
stop
docker-compose
${
COMPOSE_FILE
}
start
docker-compose
${
COMPOSE_FILE
}
start
}
}
function
uninstall
(){
function
uninstall
(){
echo
echo
cd
${
app_sc_dir
}
cd
${
app_sc_dir
}
/
${
target
}
docker-compose
${
COMPOSE_FILE
}
down
docker-compose
${
COMPOSE_FILE
}
down
}
}
...
@@ -188,7 +189,7 @@ function main(){
...
@@ -188,7 +189,7 @@ function main(){
;;
;;
*
)
*
)
echo
echo
cd
${
app_sc_dir
}
cd
${
app_sc_dir
}
/
${
target
}
docker-compose
${
COMPOSE_FILES
}
$@
docker-compose
${
COMPOSE_FILES
}
$@
;;
;;
esac
esac
...
...
install.ini
View file @
d208b7c2
#/bin/bash
#
!
/bin/bash
#项目名
#项目名
APP_NAME
=
data
-center
APP_NAME
=
search
-center
#镜像相关
#镜像相关
SC_IMAGE_URL
=
harbor.hw.jiankangyouyi.com:5000/search-center-public/
SC_IMAGE_URL
=
harbor.hw.jiankangyouyi.com:5000/search-center-public/
SC_IMAGE_NAME
=
${APP_NAME}
SC_IMAGE_NAME
=
${APP_NAME}
...
...
install.ini.bak
0 → 100644
View file @
d208b7c2
#/bin/bash
#项目名
APP_NAME=data-center
#镜像相关
SC_IMAGE_URL=harbor.hw.jiankangyouyi.com:5000/search-center-public/
SC_IMAGE_NAME=${APP_NAME}
SC_IMAGE_VERSION=v1.0
#部署目录
DEPLOY_DIR=/ops_project/Health-cloud-server
DB_DEPLOY_DIR=/ops_project/Health-cloud-server-DB
#search-center配置文件目录
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
ES_PASSWORD=3HPDm0OdmoMZ6DiYWCUG
ES_ClusterName=elasticsearch-jkyy
ES_HTTP_PORT=9200
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_PASSWORD=jkyy_pwd
install.sh
View file @
d208b7c2
...
@@ -7,6 +7,21 @@ function if_err(){
...
@@ -7,6 +7,21 @@ function if_err(){
fi
fi
}
}
function
get_appname
(){
echo
-e
"
\0
33[32mWelcome To Install Health-Cloud-Server
\n\0
33[0m"
echo
-e
"
\0
33[32m目前支持的服务:
\0
33[0m"
PS3
=
"请输入本次安装服务的序号:"
select
APP_NAME
in
"data-center"
"search-center"
"ehm"
"assessment"
do
APP_NAME
=
${
APP_NAME
}
echo
$APP_NAME
break
done
}
get_appname
sed
-i
"s/APP_NAME=/APP_NAME=
${
APP_NAME
}
/g"
./install.ini
source
./install.ini
source
./install.ini
#定义安装程序的app路径
#定义安装程序的app路径
DEPLOY_FILE
=
$(
dirname
$0
)
/Health-cloud-server/app_server
DEPLOY_FILE
=
$(
dirname
$0
)
/Health-cloud-server/app_server
...
@@ -15,40 +30,40 @@ DB_DEPLOY_FILE=$(dirname $0)/Health-cloud-server/db_server
...
@@ -15,40 +30,40 @@ DB_DEPLOY_FILE=$(dirname $0)/Health-cloud-server/db_server
if
[
!
-d
${
DEPLOY_DIR
}
]
;
then
mkdir
-p
${
DEPLOY_DIR
}
;
fi
if
[
!
-d
${
DEPLOY_DIR
}
]
;
then
mkdir
-p
${
DEPLOY_DIR
}
;
fi
#定义部署目标路径(app,db)
#定义部署目标路径(app,db)
app_sc_dir
=
${
DEPLOY_DIR
}
/
${
APP_NAME
}
app_sc_dir
=
${
DEPLOY_DIR
}
db_sc_dir
=
${
DB_DEPLOY_DIR
}
db_sc_dir
=
${
DB_DEPLOY_DIR
}
#将docker-compose工程部署到本机
#将docker-compose工程部署到本机
if
[[
!
-d
${
app_sc_dir
}
&&
!
-f
~/.hcrc
]]
;
then
if
[[
!
-d
${
app_sc_dir
}
/
${
APP_NAME
}
]]
;
then
cp
-rf
${
DEPLOY_FILE
}
/
${
APP_NAME
}
${
app_sc_dir
}
cp
-rf
${
DEPLOY_FILE
}
/
${
APP_NAME
}
${
app_sc_dir
}
/
${
APP_NAME
}
cp
-rf
${
DB_DEPLOY_FILE
}
${
db_sc_dir
}
cp
-rf
${
DB_DEPLOY_FILE
}
${
db_sc_dir
}
if_err
if_err
else
else
echo
"目标目录已安装
${
APP_NAME
}
,请检查
${
app_sc_dir
}
.hcrc是否存在"
echo
"目标目录已安装
${
APP_NAME
}
,请检查
${
app_sc_dir
}
/
${
APP_NAME
}
.hcrc是否存在"
exit
127
exit
127
fi
fi
#将配置文件存入环境变量文件,使其全局生效(app和db目录各存一份)
#将配置文件存入环境变量文件,使其全局生效(app和db目录各存一份)
cp
./install.ini
${
app_sc_dir
}
/install.ini.example
cp
./install.ini
${
app_sc_dir
}
/
${
APP_NAME
}
/
install.ini.example
cp
./install.ini
${
db_sc_dir
}
/install.ini.example
cp
./install.ini
${
db_sc_dir
}
/install.ini.example
env_context
=
$(
cat
${
app_sc_dir
}
/install.ini.example |grep
-v
"^#"
|grep
-v
"^$"
)
env_context
=
$(
cat
${
app_sc_dir
}
/
${
APP_NAME
}
/
install.ini.example |grep
-v
"^#"
|grep
-v
"^$"
)
echo
"
${
env_context
}
"
>
${
app_sc_dir
}
/.env
echo
"
${
env_context
}
"
>
${
app_sc_dir
}
/
${
APP_NAME
}
/
.env
echo
"
${
env_context
}
"
>
${
db_sc_dir
}
/.env
echo
"
${
env_context
}
"
>
${
db_sc_dir
}
/.env
source
${
app_sc_dir
}
/.env
source
${
app_sc_dir
}
/
${
APP_NAME
}
/
.env
source
${
db_sc_dir
}
/.env
source
${
db_sc_dir
}
/.env
ln
-s
${
app_sc_dir
}
/
.env
${
app_sc_dir
}
/install.ini 2>/dev/null
ln
-s
${
app_sc_dir
}
/
${
APP_NAME
}
/.env
${
app_sc_dir
}
/
${
APP_NAME
}
/install.ini 2>/dev/null
ln
-s
${
db_sc_dir
}
/.env
${
db_sc_dir
}
/install.ini 2>/dev/null
ln
-s
${
db_sc_dir
}
/.env
${
db_sc_dir
}
/install.ini 2>/dev/null
#安装hcrc版本文件
#安装hcrc版本文件
echo
-e
"app_sc_dir=
${
app_sc_dir
}
\n
db_sc_dir=
${
db_sc_dir
}
\n
${
APP_NAN
ME
}
版本
${
SC_IMAGE_VERSION
}
"
>
~/.hcrc 2>/dev/null
||
echo
""
echo
-e
"app_sc_dir=
${
app_sc_dir
}
\n
db_sc_dir=
${
db_sc_dir
}
\n
APP_NAME=
${
APP_NAME
}
\n
${
APP_NA
ME
}
版本
${
SC_IMAGE_VERSION
}
"
>
~/.hcrc 2>/dev/null
||
echo
""
#安装hcctl管理命令
#安装hcctl管理命令
sudo cp
hcctl /usr/local/bin
&&
sudo chmod
+x /usr/local/bin/hcctl
sudo cp
hcctl /usr/local/bin
&&
sudo chmod
+x /usr/local/bin/hcctl
ln
-s
/usr/local/bin/hcctl /usr/bin/hcctl 2>/dev/null
ln
-s
/usr/local/bin/hcctl /usr/bin/hcctl 2>/dev/null
cd
${
app_sc_dir
}
cd
${
app_sc_dir
}
/
${
APP_NAME
}
#--------------------部署-----------------------#
#--------------------部署-----------------------#
echo
-e
"----------安装向导------------"
echo
-e
"----------安装向导------------"
...
@@ -67,6 +82,8 @@ echo "${APP_NAME}服务已安装成功...."
...
@@ -67,6 +82,8 @@ echo "${APP_NAME}服务已安装成功...."
sleep
2
sleep
2
echo
-e
"服务启动状态: "
echo
-e
"服务启动状态: "
sleep
2
sleep
2
sudo
/usr/local/bin/hcctl status
sudo
/usr/local/bin/hcctl status
${
APP_NAME
}
sleep
2
sleep
2
echo
"Good Bye ~"
echo
"Good Bye ~"
#sed -i "s/APP_NAME=${APP_NAME}/APP_NAME=/g" $(dirname $0)/install.ini
install.sh.bak
0 → 100755
View file @
d208b7c2
#!/bin/bash
#set -e
#加载配置信息
function
if_err
(){
if
[
$?
-ne
0
]
;
then
exit
127
fi
}
source
./install.ini
#定义安装程序的app路径
DEPLOY_FILE
=
$(
dirname
$0
)
/Health-cloud-server/app_server
#定义安装程序的db路径
DB_DEPLOY_FILE
=
$(
dirname
$0
)
/Health-cloud-server/db_server
if
[
!
-d
${
DEPLOY_DIR
}
]
;
then
mkdir
-p
${
DEPLOY_DIR
}
;
fi
#定义部署目标路径(app,db)
app_sc_dir
=
${
DEPLOY_DIR
}
/
${
APP_NAME
}
db_sc_dir
=
${
DB_DEPLOY_DIR
}
#将docker-compose工程部署到本机
if
[[
!
-d
${
app_sc_dir
}
&&
!
-f
~/.hcrc
]]
;
then
cp
-rf
${
DEPLOY_FILE
}
/
${
APP_NAME
}
${
app_sc_dir
}
cp
-rf
${
DB_DEPLOY_FILE
}
${
db_sc_dir
}
if_err
else
echo
"目标目录已安装
${
APP_NAME
}
,请检查
${
app_sc_dir
}
.hcrc是否存在"
exit
127
fi
#将配置文件存入环境变量文件,使其全局生效(app和db目录各存一份)
cp
./install.ini
${
app_sc_dir
}
/install.ini.example
cp
./install.ini
${
db_sc_dir
}
/install.ini.example
env_context
=
$(
cat
${
app_sc_dir
}
/install.ini.example |grep
-v
"^#"
|grep
-v
"^$"
)
echo
"
${
env_context
}
"
>
${
app_sc_dir
}
/.env
echo
"
${
env_context
}
"
>
${
db_sc_dir
}
/.env
source
${
app_sc_dir
}
/.env
source
${
db_sc_dir
}
/.env
ln
-s
${
app_sc_dir
}
/.env
${
app_sc_dir
}
/install.ini 2>/dev/null
ln
-s
${
db_sc_dir
}
/.env
${
db_sc_dir
}
/install.ini 2>/dev/null
#安装hcrc版本文件
echo
-e
"app_sc_dir=
${
app_sc_dir
}
\n
db_sc_dir=
${
db_sc_dir
}
\n
${
APP_NANME
}
版本
${
SC_IMAGE_VERSION
}
"
>
~/.hcrc 2>/dev/null
||
echo
""
#安装hcctl管理命令
sudo cp
hcctl /usr/local/bin
&&
sudo chmod
+x /usr/local/bin/hcctl
ln
-s
/usr/local/bin/hcctl /usr/bin/hcctl 2>/dev/null
cd
${
app_sc_dir
}
#--------------------部署-----------------------#
echo
-e
"----------安装向导------------"
echo
-e
"- all模式-->全部安装(主服务
${
APP_NAME
}
+数据库+队列)"
echo
-e
"- server模式-->只安装主服务
${
APP_NAME
}
(请注意提前修改install.ini中外部db和mq的连接配置)"
echo
-e
"- controller模式-->安装主服务
${
APP_NAME
}
+数据库 or 队列"
echo
-e
"------------------------------"
PS3
=
'请选择安装模式: '
hcctl install_compose-files
if
[
$?
-ne
0
]
;
then
echo
"安装过程出现错误,请查看相关配置..."
exit
127
fi
echo
"
${
APP_NAME
}
服务已安装成功...."
sleep
2
echo
-e
"服务启动状态: "
sleep
2
sudo
/usr/local/bin/hcctl status
sleep
2
echo
"Good Bye ~"
uninstall.sh
View file @
d208b7c2
...
@@ -23,6 +23,8 @@ else
...
@@ -23,6 +23,8 @@ else
echo
"You are Not Install The hcrc File"
echo
"You are Not Install The hcrc File"
exit
127
exit
127
fi
fi
hcctl uninstall
rm
-f
/root/.hcrc
echo
"Uninstalling APP contried"
echo
"Uninstalling APP contried"
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