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
946a1519
Commit
946a1519
authored
Mar 25, 2022
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
24ec0cdf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
9 deletions
+58
-9
hcctl
hcctl
+11
-4
install.sh
install.sh
+20
-5
uninstall.sh
uninstall.sh
+27
-0
No files found.
hcctl
100644 → 100755
View file @
946a1519
...
...
@@ -4,6 +4,7 @@ target=$2
source
~/.hcrc 2>/dev/null
||
echo
""
app_sc_dir
=
${
app_sc_dir
:-
/ops_project/Health-cloud-server/search-center
}
echo
"
${
app_sc_dir
}
"
source
${
app_sc_dir
}
/install.ini
#DB-compose文件DB_DEPLOY_DIR
...
...
@@ -53,6 +54,7 @@ function usage() {
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
)
...
...
@@ -86,7 +88,7 @@ install_compose-files(){
#是否使用外部组件
if
[
${
INSTALL_MODE
}
==
"all"
]
;
then
echo
-e
"正在创建数据目录"
mkdir
-p
${
app
_sc_dir
}
/data/
{
es_data,mq_data
}
mkdir
-p
${
db
_sc_dir
}
/data/
{
es_data,mq_data
}
echo
-e
"正在创建日志目录"
mkdir
-p
${
app_sc_dir
}
/log
elif
[
${
INSTALL_MODE
}
==
"server"
]
;
then
...
...
@@ -98,7 +100,8 @@ install_compose-files(){
#判断es
if
[
${
ES_ISUSE_STATUS
}
==
'false'
]
;
then
echo
-e
"正在创建Elasticsearch数据目录"
mkdir
-p
${
app_sc_dir
}
/data/es_data
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
...
...
@@ -108,8 +111,8 @@ install_compose-files(){
fi
#判断mq
if
[
${
MQ_ISUSE_STATUS
}
==
'false'
]
;
then
echo
-e
"正在创建
Elasticsearch
数据目录"
mkdir
-p
${
app
_sc_dir
}
/data/es_data
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
...
...
@@ -123,6 +126,8 @@ install_compose-files(){
#将所需要部署的组件ymal输出到文件
echo
"
${
compose_files
}
"
>
${
app_sc_dir
}
/compose_files
COMPOSE_FILE
=
$(
cat
${
app_sc_dir
}
/compose_files
)
echo
"即将启动docker-compose部署"
pwd
sudo
docker-compose
${
COMPOSE_FILE
}
up
-d
}
...
...
@@ -177,6 +182,8 @@ function main(){
usage
;;
install_compose-files
)
pwd
echo
"即将执行方法install-compose"
install_compose-files
;;
*
)
...
...
install.sh
100644 → 100755
View file @
946a1519
#!/bin/bash
#set -e
#加载配置信息
function
if_err
(){
if
[
$?
-ne
0
]
;
then
exit
127
fi
}
source
./install.ini
#定义安装程序的app路径
DEPLOY_FILE
=
$(
dirname
$0
)
/Health-
C
loud-server/app_server
DEPLOY_FILE
=
$(
dirname
$0
)
/Health-
c
loud-server/app_server
#定义安装程序的db路径
DB_DEPLOY_FILE
=
$(
dirname
$0
)
/Health-
C
loud-server/db_server
DB_DEPLOY_FILE
=
$(
dirname
$0
)
/Health-
c
loud-server/db_server
if
[
!
-d
${
DEPLOY_DIR
}
]
;
then
mkdir
-p
${
DEPLOY_DIR
}
;
fi
#定义部署目标路径(app,db)
...
...
@@ -15,20 +21,29 @@ db_sc_dir=${DB_DEPLOY_DIR}
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
${
APP_NANME
}
版本
${
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_NANME
}
版本
${
SC_IMAGE_VERSION
}
"
>
~/.hcrc 2>/dev/null
||
echo
""
#安装hcctl管理命令
sudo cp
hcctl /usr/local/bin
&&
sudo chmod
+x /usr/local/bin/hcctl
...
...
@@ -48,7 +63,7 @@ if [ $? -ne 0 ];then
echo
"安装过程出现错误,请查看相关配置..."
exit
127
fi
echo
"
${
APP_NAME
}
服务已安装成功..."
echo
"
${
APP_NAME
}
服务已安装成功...
.
"
sleep
2
echo
-e
"服务启动状态: "
sleep
2
...
...
uninstall.sh
0 → 100755
View file @
946a1519
#!/bin/bash
source
./install.ini
if
[
-d
${
DEPLOY_DIR
}
]
;
then
echo
"Uninstalling APP Server Files..."
rm
-rf
${
DEPLOY_DIR
}
else
echo
"You are Not Install The APP Server"
exit
127
fi
if
[
-d
${
DB_DEPLOY_DIR
}
]
;
then
echo
"Uninstalling DB Server Files..."
rm
-rf
${
DB_DEPLOY_DIR
}
else
echo
"You are Not Install The DB Server"
exit
127
fi
if
[
-f
~/.hcrc
]
;
then
echo
"Deleting hcrc File..."
rm
-rf
~/.hcrc
else
echo
"You are Not Install The hcrc File"
exit
127
fi
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