Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setup-project-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
setup-project-platform
Commits
5041f9f2
Commit
5041f9f2
authored
Oct 23, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部署脚本
parent
969a129b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
283 additions
and
266 deletions
+283
-266
setup-project-manager/pom.xml
setup-project-manager/pom.xml
+251
-245
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupDbServiceImpl.java
...als/xhx/module/setup/service/impl/SetupDbServiceImpl.java
+7
-5
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupProjectServiceImpl.java
...hx/module/setup/service/impl/SetupProjectServiceImpl.java
+7
-9
setup.sh
setup.sh
+18
-7
No files found.
setup-project-manager/pom.xml
View file @
5041f9f2
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<profiles.publish.path>
/home/publish
</profiles.publish.path>
<profiles.publish.path>
/home/publish
</profiles.publish.path>
<profiles.filepath>
/mortals/app/data
</profiles.filepath>
<profiles.filepath>
/mortals/app/data
</profiles.filepath>
<profiles.nacosUrl>
http://127.0.0.1:8848
</profiles.nacosUrl>
<profiles.nacosUrl>
http://127.0.0.1:8848
</profiles.nacosUrl>
<profiles.server.debug>
21568
</profiles.server.debug>
<profiles.server.debug>
</profiles.server.debug>
</properties>
</properties>
<profiles>
<profiles>
...
@@ -48,7 +48,8 @@
...
@@ -48,7 +48,8 @@
<id>
test
</id>
<id>
test
</id>
<properties>
<properties>
<profiles.active>
test
</profiles.active>
<profiles.active>
test
</profiles.active>
<profiles.server.debug>
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=25599
</profiles.server.debug>
<profiles.server.debug>
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=25599
</profiles.server.debug>
<profiles.datasource.uri>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://192.168.0.98:3306/setup-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]>
</profiles.datasource.uri>
<![CDATA[jdbc:mysql://192.168.0.98:3306/setup-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]>
</profiles.datasource.uri>
<profiles.datasource.username>
root
</profiles.datasource.username>
<profiles.datasource.username>
root
</profiles.datasource.username>
...
@@ -59,7 +60,12 @@
...
@@ -59,7 +60,12 @@
<profile>
<profile>
<id>
product
</id>
<id>
product
</id>
<properties>
<properties>
<profiles.active>
test
</profiles.active>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://127.0.0.1:3306/setup-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]>
</profiles.datasource.uri>
<profiles.datasource.username>
root
</profiles.datasource.username>
<profiles.datasource.password>
xhx@2022
</profiles.datasource.password>
<profiles.publish.path>
/home/publish/
</profiles.publish.path>
</properties>
</properties>
</profile>
</profile>
</profiles>
</profiles>
...
@@ -151,7 +157,7 @@
...
@@ -151,7 +157,7 @@
<artifactId>
poi-tl
</artifactId>
<artifactId>
poi-tl
</artifactId>
<version>
1.12.0
</version>
<version>
1.12.0
</version>
</dependency>
</dependency>
<!--
<!--
<dependency>
<dependency>
<groupId>org.springframework</groupId>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<artifactId>spring-expression</artifactId>
...
...
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupDbServiceImpl.java
View file @
5041f9f2
...
@@ -48,11 +48,13 @@ public class SetupDbServiceImpl implements SetupDbService {
...
@@ -48,11 +48,13 @@ public class SetupDbServiceImpl implements SetupDbService {
druidDataSource
.
setPassword
(
dbSetupEntity
.
getPassword
());
druidDataSource
.
setPassword
(
dbSetupEntity
.
getPassword
());
DruidPooledConnection
connection
=
druidDataSource
.
getConnection
();
DruidPooledConnection
connection
=
druidDataSource
.
getConnection
();
createDatabase
(
connection
,
dbSetupEntity
.
getDbName
());
boolean
database
=
createDatabase
(
connection
,
dbSetupEntity
.
getDbName
());
if
(
database
){
connection
.
setCatalog
(
dbSetupEntity
.
getDbName
());
connection
.
setCatalog
(
dbSetupEntity
.
getDbName
());
FileSystemResource
rc
=
new
FileSystemResource
(
uploadService
.
getFilePath
(
dbSetupEntity
.
getDbFilePath
()));
FileSystemResource
rc
=
new
FileSystemResource
(
uploadService
.
getFilePath
(
dbSetupEntity
.
getDbFilePath
()));
EncodedResource
er
=
new
EncodedResource
(
rc
,
"UTF-8"
);
EncodedResource
er
=
new
EncodedResource
(
rc
,
"UTF-8"
);
ScriptUtils
.
executeSqlScript
(
connection
,
er
);
ScriptUtils
.
executeSqlScript
(
connection
,
er
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"初始化数据库异常"
,
e
);
log
.
error
(
"初始化数据库异常"
,
e
);
...
...
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupProjectServiceImpl.java
View file @
5041f9f2
...
@@ -53,7 +53,6 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -53,7 +53,6 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
@Autowired
@Autowired
private
UploadService
uploadService
;
private
UploadService
uploadService
;
@Autowired
@Autowired
private
SetupDbService
setupDbService
;
private
SetupDbService
setupDbService
;
...
@@ -102,6 +101,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -102,6 +101,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
dbSetupEntity
.
setUserName
(
setupProjectEntity
.
getDbUser
());
dbSetupEntity
.
setUserName
(
setupProjectEntity
.
getDbUser
());
dbSetupEntity
.
setPassword
(
setupProjectEntity
.
getDbPassword
());
dbSetupEntity
.
setPassword
(
setupProjectEntity
.
getDbPassword
());
dbSetupEntity
.
setDbFilePath
(
publicPath
+
"/db/base.sql"
);
dbSetupEntity
.
setDbFilePath
(
publicPath
+
"/db/base.sql"
);
log
.
info
(
"数据库db路径!{}"
,
dbSetupEntity
.
getDbFilePath
());
Rest
<
String
>
dbRest
=
setupDbService
.
initDb
(
dbSetupEntity
);
Rest
<
String
>
dbRest
=
setupDbService
.
initDb
(
dbSetupEntity
);
if
(
YesNoEnum
.
YES
.
getValue
()
!=
dbRest
.
getCode
())
{
if
(
YesNoEnum
.
YES
.
getValue
()
!=
dbRest
.
getCode
())
{
log
.
info
(
"数据库初始化成功!"
);
log
.
info
(
"数据库初始化成功!"
);
...
@@ -113,13 +113,13 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -113,13 +113,13 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
//判断当前系统类型,执行不同shell 或者 bat脚本
//判断当前系统类型,执行不同shell 或者 bat脚本
if
(
SystemUtil
.
getOsInfo
().
isLinux
())
{
if
(
SystemUtil
.
getOsInfo
().
isLinux
())
{
//todo 执行部署脚本
//todo 执行部署脚本
//RuntimeUtil.exec()
//RuntimeUtil.exec()
log
.
info
(
"执行deploy shell 脚本 或者构造文件"
);
log
.
info
(
"执行deploy shell 脚本 或者构造文件"
);
// callScript("deploy.sh","4",publicPath+"/bin/");
// callScript("deploy.sh","4",publicPath+"/bin/");
}
else
if
(
SystemUtil
.
getOsInfo
().
isWindows
())
{
}
else
if
(
SystemUtil
.
getOsInfo
().
isWindows
())
{
//todo
//todo
}
}
...
@@ -217,12 +217,12 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -217,12 +217,12 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
}
}
private
void
callScript
(
String
script
,
String
args
,
String
...
workspace
){
private
void
callScript
(
String
script
,
String
args
,
String
...
workspace
)
{
try
{
try
{
String
cmd
=
"sh "
+
script
+
" "
+
args
;
String
cmd
=
"sh "
+
script
+
" "
+
args
;
// String[] cmd = {"sh", script, "4"};
// String[] cmd = {"sh", script, "4"};
File
dir
=
null
;
File
dir
=
null
;
if
(
workspace
[
0
]
!=
null
)
{
if
(
workspace
[
0
]
!=
null
)
{
dir
=
new
File
(
workspace
[
0
]);
dir
=
new
File
(
workspace
[
0
]);
System
.
out
.
println
(
workspace
[
0
]);
System
.
out
.
println
(
workspace
[
0
]);
}
}
...
@@ -235,14 +235,12 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -235,14 +235,12 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
log
.
info
(
line
);
log
.
info
(
line
);
}
}
input
.
close
();
input
.
close
();
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
FileUtil
.
getSuffix
(
"test.tar.gz"
));
System
.
out
.
println
(
FileUtil
.
getSuffix
(
"test.tar.gz"
));
...
...
product-deploy
.sh
→
setup
.sh
View file @
5041f9f2
...
@@ -322,7 +322,6 @@ setup_nginx() {
...
@@ -322,7 +322,6 @@ setup_nginx() {
}
}
setup_font
()
{
setup_font
()
{
writelog
"字体安装..."
writelog
"字体安装..."
yum
install
-y
fontconfig mkfontscale
yum
install
-y
fontconfig mkfontscale
...
@@ -477,12 +476,19 @@ nacos_deploy() {
...
@@ -477,12 +476,19 @@ nacos_deploy() {
#todo 添加nginx 针对当前ip的sql stream代理
#todo 添加nginx 针对当前ip的sql stream代理
fi
fi
#查看进程是否存在,如果存在 则不安装
#查看进程是否存在,如果存在 则不安装
project_status
=
$(
systemctl status
"
${
NACOS
}
"
|
grep
Active |
awk
'{print $2}'
)
if
[
-n
"
$project_status
"
]
;
then
#查看文件夹是否存在
echo
"NACOS项目已经安装,状态:
$project_status
"
if
[
-d
${
NACOS_EXECPATH
}
]
;
then
writelog
"NACOS项目已经安装!"
return
return
fi
fi
#project_status=$(systemctl status "${NACOS}" | grep Active | awk '{print $2}')
# if [ -n "$project_status" ]; then
# echo "NACOS项目已经安装,状态: $project_status"
# return
# fi
rm
-rf
${
NACOS_SERVICE
}
rm
-rf
${
NACOS_SERVICE
}
rm
-rf
${
NACOS_EXECPATH
}
rm
-rf
${
NACOS_EXECPATH
}
mkdir
-p
${
NACOS_EXECPATH
}
mkdir
-p
${
NACOS_EXECPATH
}
...
@@ -527,9 +533,14 @@ setup_project_deploy() {
...
@@ -527,9 +533,14 @@ setup_project_deploy() {
build_nginx_mysql_stream
$NGINX_CONF_PATH
/mysql_stream.stream
build_nginx_mysql_stream
$NGINX_CONF_PATH
/mysql_stream.stream
fi
fi
project_status
=
$(
systemctl status
"
${
SETUP_PROJECT_PLATFORM
}
"
|
grep
Active |
awk
'{print $2}'
)
# project_status=$(systemctl status "${SETUP_PROJECT_PLATFORM}" | grep Active | awk '{print $2}')
if
[
-n
"
$project_status
"
]
;
then
# if [ -n "$project_status" ]; then
writelog
"工程已经安装,状态:
$project_status
"
# writelog "工程已经安装,状态: $project_status"
# return
# fi
if
[
-d
${
SETUP_PROJECT_PLATFORM_EXECPATH
}
]
;
then
writelog
"项目部署工程已经安装!"
return
return
fi
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