调整结构

This commit is contained in:
fish
2025-10-07 10:32:46 +08:00
parent 1e9cdda192
commit 2b1d9b4e8d
13 changed files with 281 additions and 1 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

1
.gitignore vendored
View File

@@ -24,6 +24,7 @@ dist/
# 临时文件目录
tmp/
temp/
shared_data/
# 日志文件
*.log

View File

@@ -1 +1,5 @@
# REAMDME
# REAMDME
create_api.py -- 创建 API 模块。
build_service.py -- 编译服务,需要本地编译成功后,才能提交和打标签。
deploy.sh -- 服务器部署脚本。

26
api_delete/.dockerignore Normal file
View File

@@ -0,0 +1,26 @@
# 排除Go编译产物
*.exe
*.exe~
*.dll
*.so
*.dylib
app # 排除本地已构建的二进制文件
# 排除依赖目录
vendor/
go/pkg/
db
scripts
shared_data
# 排除版本控制和日志文件
.git/
.gitignore
logs/
*.log
*.md
*.sql
# 排除IDE配置文件
.idea/
.vscode/

26
api_gateway/.dockerignore Normal file
View File

@@ -0,0 +1,26 @@
# 排除Go编译产物
*.exe
*.exe~
*.dll
*.so
*.dylib
app # 排除本地已构建的二进制文件
# 排除依赖目录
vendor/
go/pkg/
db
scripts
shared_data
# 排除版本控制和日志文件
.git/
.gitignore
logs/
*.log
*.md
*.sql
# 排除IDE配置文件
.idea/
.vscode/

26
api_login/.dockerignore Normal file
View File

@@ -0,0 +1,26 @@
# 排除Go编译产物
*.exe
*.exe~
*.dll
*.so
*.dylib
app # 排除本地已构建的二进制文件
# 排除依赖目录
vendor/
go/pkg/
db
scripts
shared_data
# 排除版本控制和日志文件
.git/
.gitignore
logs/
*.log
*.md
*.sql
# 排除IDE配置文件
.idea/
.vscode/

View File

@@ -0,0 +1,26 @@
# 排除Go编译产物
*.exe
*.exe~
*.dll
*.so
*.dylib
app # 排除本地已构建的二进制文件
# 排除依赖目录
vendor/
go/pkg/
db
scripts
shared_data
# 排除版本控制和日志文件
.git/
.gitignore
logs/
*.log
*.md
*.sql
# 排除IDE配置文件
.idea/
.vscode/

View File

@@ -0,0 +1,26 @@
# 排除Go编译产物
*.exe
*.exe~
*.dll
*.so
*.dylib
app # 排除本地已构建的二进制文件
# 排除依赖目录
vendor/
go/pkg/
db
scripts
shared_data
# 排除版本控制和日志文件
.git/
.gitignore
logs/
*.log
*.md
*.sql
# 排除IDE配置文件
.idea/
.vscode/

View File

@@ -0,0 +1,26 @@
# 排除Go编译产物
*.exe
*.exe~
*.dll
*.so
*.dylib
app # 排除本地已构建的二进制文件
# 排除依赖目录
vendor/
go/pkg/
db
scripts
shared_data
# 排除版本控制和日志文件
.git/
.gitignore
logs/
*.log
*.md
*.sql
# 排除IDE配置文件
.idea/
.vscode/

View File

@@ -0,0 +1,26 @@
# 排除Go编译产物
*.exe
*.exe~
*.dll
*.so
*.dylib
app # 排除本地已构建的二进制文件
# 排除依赖目录
vendor/
go/pkg/
db
scripts
shared_data
# 排除版本控制和日志文件
.git/
.gitignore
logs/
*.log
*.md
*.sql
# 排除IDE配置文件
.idea/
.vscode/

93
deploy.sh Normal file
View File

@@ -0,0 +1,93 @@
#!/bin/bash
set -e # 遇到错误立即退出,确保部署流程的可靠性
# 颜色输出配置(增强可读性)
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # 重置颜色
# 步骤1停止当前运行的 docker-compose 编排
echo -e "${YELLOW}===== 第一步:停止当前 docker-compose 服务 ====="${NC}
if [ -f "./docker-compose.yaml" ]; then
echo "正在停止现有服务..."
docker-compose -f ./docker-compose.yaml down
if [ $? -eq 0 ]; then
echo -e "${GREEN}现有 docker-compose 服务已成功停止${NC}"
else
echo -e "${RED}停止 docker-compose 服务失败!${NC}"
exit 1
fi
else
echo -e "${RED}错误:未找到当前目录下的 docker-compose.yaml 文件${NC}"
exit 1
fi
# 步骤2遍历 api_ 开头的目录并执行 release.sh
echo -e "\n${YELLOW}===== 第二步:处理 api_ 开头的服务目录 ====="${NC}
for dir in ./api_*/; do
# 提取目录名称(移除路径和末尾斜杠)
dir_name=$(basename "${dir%/}")
# 步骤3跳过 api_template 目录
if [ "$dir_name" = "api_template" ]; then
echo -e "${YELLOW} 跳过目录:$dir_name${NC}"
continue
fi
# 检查目录是否有效
if [ ! -d "$dir" ]; then
echo -e "${RED} 警告:$dir 不是有效目录,已跳过${NC}"
continue
fi
echo -e "\n处理目录$dir_name"
# 进入目标目录
cd "$dir" || {
echo -e "${RED} 错误:无法进入目录 $dir_name${NC}"
exit 1
}
# 检查并执行 release.sh
if [ -f "release.sh" ]; then
# 添加执行权限
chmod +x release.sh
echo " 已为 release.sh 添加执行权限"
# 执行脚本
echo " 正在执行 release.sh..."
./release.sh
if [ $? -eq 0 ]; then
echo -e " ${GREEN}release.sh 执行成功${NC}"
else
echo -e " ${RED}release.sh 执行失败!${NC}"
exit 1
fi
else
echo -e "${YELLOW} 警告:目录 $dir_name 中未找到 release.sh已跳过${NC}"
fi
# 返回上级目录,继续处理其他目录
cd .. || {
echo -e "${RED} 错误:无法返回上级目录${NC}"
exit 1
}
done
# 步骤4启动新的 docker-compose 编排
echo -e "\n${YELLOW}===== 第三步:启动新的 docker-compose 服务 ====="${NC}
if [ -f "./docker-compose.yaml" ]; then
echo "正在启动服务..."
docker-compose -f ./docker-compose.yaml up -d
if [ $? -eq 0 ]; then
echo -e "${GREEN}docker-compose 服务启动成功!${NC}"
else
echo -e "${RED}启动 docker-compose 服务失败!${NC}"
exit 1
fi
else
echo -e "${RED}错误:未找到当前目录下的 docker-compose.yaml 文件${NC}"
exit 1
fi
echo -e "\n${GREEN}===== 所有部署步骤已完成 ====="${NC}