test/user-journey #3

Merged
zhangxiang merged 142 commits from test/user-journey into dev 2026-04-12 13:17:03 +08:00
3 changed files with 8 additions and 13 deletions
Showing only changes of commit bd87cdf0e6 - Show all commits
+4 -3
View File
@@ -7,10 +7,11 @@ ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
adduser --system --uid 1001 nextjs && \
apk add --no-cache curl
COPY dist/standalone ./
COPY dist/static ./dist/static
COPY dist/standalone/novalon-website/ ./
COPY dist/static/ ./.next/static/
COPY public ./public
RUN chown -R nextjs:nodejs /app
+1 -7
View File
@@ -18,19 +18,13 @@ services:
- ./data:/app/data
- ./uploads:/app/uploads
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- novalon-network
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
novalon-network:
external: true
+3 -3
View File
@@ -16,7 +16,7 @@ echo ""
echo "=== Step 1: 备份当前版本 ==="
mkdir -p $BACKUP_DIR
if [ -d "dist" ]; then
tar -czf $BACKUP_DIR/dist_$TIMESTAMP.tar.gz dist public package.json package-lock.json 2>/dev/null || echo "备份完成(部分文件可能不存在)"
tar -czf $BACKUP_DIR/dist_$TIMESTAMP.tar.gz dist public package.json package-lock.json Dockerfile.prod docker-compose.server.yml 2>/dev/null || echo "备份完成(部分文件可能不存在)"
echo "✅ 备份已保存到: $BACKUP_DIR/dist_$TIMESTAMP.tar.gz"
else
echo "⚠️ 没有找到dist目录,跳过备份"
@@ -48,7 +48,7 @@ sleep 10
echo ""
echo "=== Step 6: 健康检查 ==="
for i in {1..30}; do
if wget -q --spider http://localhost:3000/api/health 2>/dev/null; then
if curl -f http://localhost:3000/api/health >/dev/null 2>&1; then
echo "✅ 健康检查通过!"
echo ""
@@ -75,7 +75,7 @@ if [ -f "$BACKUP_DIR/dist_$TIMESTAMP.tar.gz" ]; then
docker-compose down
docker-compose up -d
sleep 10
if wget -q --spider http://localhost:3000/api/health 2>/dev/null; then
if curl -f http://localhost:3000/api/health >/dev/null 2>&1; then
echo "✅ 回滚成功"
else
echo "❌ 回滚也失败了!"