chore: harden production deploy scripts
This commit is contained in:
@@ -50,11 +50,20 @@ rsync -az --delete \
|
|||||||
--filter='P /api/.env.production' \
|
--filter='P /api/.env.production' \
|
||||||
--exclude='/.git/' \
|
--exclude='/.git/' \
|
||||||
--exclude='/.memory/' \
|
--exclude='/.memory/' \
|
||||||
|
--exclude='/.backups/' \
|
||||||
--exclude='/.logs/' \
|
--exclude='/.logs/' \
|
||||||
--exclude='/.pids/' \
|
--exclude='/.pids/' \
|
||||||
|
--exclude='/.playwright-mcp/' \
|
||||||
|
--exclude='/.DS_Store' \
|
||||||
|
--exclude='*.log' \
|
||||||
|
--exclude='__pycache__/' \
|
||||||
|
--exclude='*.pyc' \
|
||||||
--exclude='/data/' \
|
--exclude='/data/' \
|
||||||
|
--exclude='/data-local/' \
|
||||||
--exclude='/jobs/' \
|
--exclude='/jobs/' \
|
||||||
|
--exclude='/output/' \
|
||||||
--exclude='/secrets/' \
|
--exclude='/secrets/' \
|
||||||
|
--exclude='/api/.venv/' \
|
||||||
--exclude='/api/jobs/' \
|
--exclude='/api/jobs/' \
|
||||||
--exclude='/api/.env' \
|
--exclude='/api/.env' \
|
||||||
--exclude='/api/.env.local' \
|
--exclude='/api/.env.local' \
|
||||||
@@ -63,6 +72,8 @@ rsync -az --delete \
|
|||||||
--exclude='/web/node_modules/' \
|
--exclude='/web/node_modules/' \
|
||||||
--exclude='/web/.next/' \
|
--exclude='/web/.next/' \
|
||||||
--exclude='/web/out/' \
|
--exclude='/web/out/' \
|
||||||
|
--exclude='/web/canvas-app/node_modules/' \
|
||||||
|
--exclude='/web/canvas-app/dist/' \
|
||||||
--exclude='/node_modules/' \
|
--exclude='/node_modules/' \
|
||||||
--exclude='内部分享-口播脚本.md' \
|
--exclude='内部分享-口播脚本.md' \
|
||||||
./ "$HOST:$APP_DIR/"
|
./ "$HOST:$APP_DIR/"
|
||||||
|
|||||||
@@ -13,12 +13,27 @@ ssh "$HOST" "cd '$APP_DIR' && \
|
|||||||
echo \"ERROR: local API/dev URL leaked into web static bundle\" >&2
|
echo \"ERROR: local API/dev URL leaked into web static bundle\" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
for p in / /login/ /_next/does-not-exist.js /api/health; do
|
check_route() {
|
||||||
code=\$(curl -sS -o /tmp/skg-smoke.out -w \"%{http_code}\" \"http://127.0.0.1\$p\")
|
p=\"\$1\"
|
||||||
case \"\$p:\$code\" in
|
expected=\"\$2\"
|
||||||
/:302|/login/:200|/_next/does-not-exist.js:404|/api/health:401) echo \"web:\$p \$code\" ;;
|
attempts=\"\${3:-30}\"
|
||||||
*) echo \"ERROR: unexpected web route status \$p \$code\" >&2; head -c 200 /tmp/skg-smoke.out >&2; exit 1 ;;
|
i=1
|
||||||
esac
|
while [ \"\$i\" -le \"\$attempts\" ]; do
|
||||||
|
code=\$(curl -sS -o /tmp/skg-smoke.out -w \"%{http_code}\" \"http://127.0.0.1\$p\" || echo 000)
|
||||||
|
if [ \"\$code\" = \"\$expected\" ]; then
|
||||||
|
echo \"web:\$p \$code\"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
i=\$((i + 1))
|
||||||
|
done
|
||||||
|
echo \"ERROR: unexpected web route status \$p \$code\" >&2
|
||||||
|
head -c 200 /tmp/skg-smoke.out >&2 || true
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
for route in \"/ 302\" \"/login/ 200\" \"/_next/does-not-exist.js 404\" \"/api/health 401\"; do
|
||||||
|
set -- \$route
|
||||||
|
check_route \"\$1\" \"\$2\"
|
||||||
done
|
done
|
||||||
' && \
|
' && \
|
||||||
docker exec skg-marketing-api sh -lc '
|
docker exec skg-marketing-api sh -lc '
|
||||||
|
|||||||
Reference in New Issue
Block a user