Compare commits

...

2 Commits

Author SHA1 Message Date
weiweiw 56c5ff428b swagger for bonus-auth 2024-07-24 10:31:06 +08:00
weiweiw 498698ca71 commit configuration for services 2024-07-23 16:09:59 +08:00
8 changed files with 275 additions and 31 deletions

35
scripts/auth_bootstrap.yml Executable file
View File

@ -0,0 +1,35 @@
# Tomcat
server:
port: 18081
# Spring
spring:
application:
# 应用名称
name: bonus-auth
profiles:
# 环境配置
active: dev
cloud:
nacos:
username: nacos
password: nacos
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
#加密组件
jasypt:
encryptor:
password: Encrypt

64
scripts/deploy.sh Normal file → Executable file
View File

@ -2,61 +2,63 @@
export deploy_path=/opt/webapps/bonus-cloud
#export jars_path = /home/jenkins/workspace/Bonus-Cloud/bonus-auth/target
export app_workspace=/home/jenkins/workspace/Bonus-Cloud
app_source_jars=(
"bonus-auth/target/bonus-auth.jar"
"bonus-api/bonus-api-system/target/bonus-api-system-24.6.0.jar"
"bonus-gateway/target/bonus-gateway.jar"
"bonus-modules/bonus-file/target/bonus-file.jar"
"bonus-modules/bonus-gen/target/bonus-gen.jar"
"bonus-modules/bonus-job/target/bonus-job.jar"
"bonus-modules/bonus-oss/target/bonus-oss.jar"
"bonus-modules/bonus-system/target/bonus-system.jar"
"bonus-visual/target/bonus-visual-monitor.jar"
"bonus-visual/bonus-monitor/target/bonus-visual-monitor.jar"
)
for source_jar in "${app_source_jars[@]}"; do
cp -f ${app_workspace}/${source_jar} $deploy_path
echo "copied ${app_workspace}/${source_jar}/auth/target/auth.jar to $deploy_path"
echo "copied ${app_workspace}/${source_jar} to $deploy_path"
done
# Define an array of JAR files to run
jars=("bonus-auth.jar" "bonus-gateway.jar" "bonus-gen.jar" "bonus-job.jar"
"bonus-modules-file.jar" "bonus-modules-system.jar" "bonus-system.jar"
"bonus-visual-monitor.jar" "sentinel-dashboard-1.8.1.jar")
jars=("bonus-auth.jar --spring.config.location=file:auth_bootstrap.yml"
"bonus-gateway.jar --spring.config.location=file:gateway_bootstrap.yml"
"bonus-system.jar --spring.config.location=file:system_bootstrap.yml"
"bonus-gen.jar --spring.config.location=file:gen_bootstrap.yml"
"bonus-job.jar --spring.config.location=file:job_bootstrap.yml"
"bonus-file.jar --spring.config.location=file:file_bootstrap.yml"
"bonus-visual-monitor.jar --spring.config.location=file:visual_bootstrap.yml")
# Stop all running JARs
for jar in "${jars[@]}"; do
P_ID=$(pgrep -f "$jar")
# 如果该项目已经在服务器上启动则kill掉
echo "原应用程序$jar进程id$P_ID"
if [ -z "$P_ID" ]; then
echo "==$jar service process does not exist"
# 遍历数组并检查每个JAR文件的进程
for jar_with_args in "${jars[@]}"; do
# 提取JAR文件名不包括参数
jar=$(echo $jar_with_args | awk '{print $1}')
# 检查进程是否启动
echo "原应用程序1 $jar "
pids=$(pgrep -f $jar || true)
echo "原应用程序2 $jar "
if [ -n "$pids" ]; then
echo "$jar is running with PID(s): $pids"
# 杀死进程
for pid in $pids; do
kill -9 $pid
if [ $? -eq 0 ]; then
echo "Process $pid for $jar killed successfully"
else
echo "Failed to kill process $pid for $jar"
fi
done
else
# 尝试优雅地关闭应用程序
kill -9 "$P_ID"
wait "$P_ID" 2>/dev/null
# 检查进程是否仍在运行
if ! ps -p "$P_ID" > /dev/null; then
echo "$jar service process was terminated gracefully"
else
# 如果优雅关闭失败,则强制杀死进程
kill -9 "$P_ID"
echo "$jar service process was killed forcefully"
fi
echo "$jar is not running"
fi
done
# Iterate over the JAR files array
for jar in "${jars[@]}"; do
echo "Running $jar..."
# Assuming java is in your PATH and the JARs are in the current directory
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar "$jar" >/dev/null 2>&1 &
echo "Starting $jar"
nohup java -jar $jar >/dev/null 2>&1 &
done
echo "All JARs have been run successfully."

29
scripts/file_bootstrap.yml Executable file
View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9300
# Spring
spring:
application:
# 应用名称
name: bonus-file
profiles:
# 环境配置
active: dev
cloud:
nacos:
username: nacos
password: nacos
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

58
scripts/gateway_bootstrap.yml Executable file
View File

@ -0,0 +1,58 @@
# Tomcat
server:
port: 18080
servlet:
context-path: zhgd
# Spring
spring:
application:
# 应用名称
name: bonus-gateway
profiles:
# 环境配置
active: dev
cloud:
nacos:
username: nacos
password: nacos
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 192.168.0.14:18858
# nacos配置持久化
datasource:
ds1:
nacos:
username: nacos
password: nacos
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
dataId: sentinel-bonus-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow
#系统 自动 加解密开关
system:
encryptEnabled: false
decryptEnabled: true
#加密组件
jasypt:
encryptor:
password: Encrypt

29
scripts/gen_bootstrap.yml Executable file
View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9202
# Spring
spring:
application:
# 应用名称
name: bonus-gen
profiles:
# 环境配置
active: dev
cloud:
nacos:
username: nacos
password: nacos
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

29
scripts/job_bootstrap.yml Executable file
View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9203
# Spring
spring:
application:
# 应用名称
name: bonus-job
profiles:
# 环境配置
active: dev
cloud:
nacos:
username: nacos
password: nacos
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

33
scripts/system_bootstrap.yml Executable file
View File

@ -0,0 +1,33 @@
# Tomcat
server:
port: 18082
# Spring
spring:
application:
# 应用名称
name: bonus-system
profiles:
# 环境配置
active: dev
cloud:
nacos:
username: nacos
password: nacos
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
system:
supports:
phoneLogin: true
emailLogin: true

29
scripts/visual_bootstrap.yml Executable file
View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9100
# Spring
spring:
application:
# 应用名称
name: bonus-monitor
profiles:
# 环境配置
active: dev
cloud:
nacos:
username: nacos
password: nacos
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}