fix(deploy): serialize model migration and pin nginx

This commit is contained in:
stefanfeng
2026-08-25 16:59:15 +08:00
parent dc34a03357
commit e24e89d326
2 changed files with 16 additions and 11 deletions
+4
View File
@@ -66,6 +66,8 @@ async def init_db():
PendingReplyTask, TokenStat, AIModelConfig, SystemConfig, LoginLog
)
async with engine.begin() as conn:
await conn.execute(text("SELECT GET_LOCK('ai_model_usage_scope_migration', 30)"))
try:
result = await conn.execute(text(
"SELECT COUNT(*) FROM information_schema.COLUMNS "
"WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ai_model_configs' "
@@ -77,6 +79,8 @@ async def init_db():
"VARCHAR(16) NOT NULL DEFAULT 'general' AFTER provider"
))
logger.info("AI模型配置表已增加 usage_scope 字段")
finally:
await conn.execute(text("SELECT RELEASE_LOCK('ai_model_usage_scope_migration')"))
logger.info("✅ 数据库模型注册成功")
logger.info("✅ 数据库初始化完成")
+2 -1
View File
@@ -6,7 +6,8 @@ RUN npm install
COPY . .
RUN npm run build
FROM nginx:alpine
# Nginx 1.31 uses syscalls that are blocked by the test server's legacy kernel.
FROM nginx:1.28.3-alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80