swagger for bonus-auth

This commit is contained in:
weiweiw 2024-07-24 10:31:06 +08:00
parent 498698ca71
commit 56c5ff428b
8 changed files with 43 additions and 44 deletions

4
scripts/auth_bootstrap.yml Normal file → Executable file
View File

@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置

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

@ -2,8 +2,6 @@
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
@ -15,51 +13,52 @@ app_source_jars=(
"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 --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.ym"
"bonus-job.jar --spring.config.location=file:job_bootstrap.ym"
"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"
else
# 尝试优雅地关闭应用程序
kill -9 "$P_ID"
wait "$P_ID" 2>/dev/null
# 遍历数组并检查每个JAR文件的进程
for jar_with_args in "${jars[@]}"; do
# 提取JAR文件名不包括参数
jar=$(echo $jar_with_args | awk '{print $1}')
# 检查进程是否仍在运行
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 "原应用程序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
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."

4
scripts/file_bootstrap.yml Normal file → Executable file
View File

@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置

6
scripts/gateway_bootstrap.yml Normal file → Executable file
View File

@ -18,11 +18,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置
@ -41,7 +41,7 @@ spring:
username: nacos
password: nacos
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
dataId: sentinel-bonus-gateway
groupId: DEFAULT_GROUP
data-type: json

4
scripts/gen_bootstrap.yml Normal file → Executable file
View File

@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置

4
scripts/job_bootstrap.yml Normal file → Executable file
View File

@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置

4
scripts/system_bootstrap.yml Normal file → Executable file
View File

@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置

4
scripts/visual_bootstrap.yml Normal file → Executable file
View File

@ -17,11 +17,11 @@ spring:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: 9404b13b-4b90-4759-98c7-f5d7a670ffd8
namespace: f648524d-0a7b-449e-8f92-64e05236fd51
# 配置文件格式
file-extension: yml
# 共享配置