docs: 移动蓝绿部署指南到 troubleshooting 目录

This commit is contained in:
Simon
2026-07-05 17:03:36 +08:00
parent ab90db3d3d
commit ca7c6d937a
91 changed files with 4841 additions and 406 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""修复 docker-compose.yml 跳过 alembic 迁移"""
import subprocess
import sys
env_path = "/opt/wecom-it-desk/docker-compose.yml"
# 读取
with open(env_path, 'r', encoding='utf-8') as f:
content = f.read()
# 替换
old = """command: >
/bin/sh -c "
echo '>>> 执行数据库迁移...' &&
cd /app && PYTHONPATH=/app alembic upgrade head &&
echo '>>> 启动 API 服务...' &&
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 2"""
new = """command: >
/bin/sh -c "
echo '>>> 跳过数据库迁移(已手动stamp到最新版本)...' &&
# cd /app && PYTHONPATH=/app alembic upgrade head &&
echo '>>> 启动 API 服务...' &&
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 2"""
if old in content:
content = content.replace(old, new)
# 写入
proc = subprocess.Popen(['sudo', 'tee', env_path], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
proc.stdin.write(content.encode('utf-8'))
proc.stdin.close()
proc.wait()
print(f"Fixed: {env_path}")
else:
print("Pattern not found!")
print("Done!")