fix(deploy): 调整 xboard 更新脚本执行流程

更新脚本改为先拉取镜像,再通过一次性 web 容器执行
xboard:update,最后重新启动服务

移除 --migrate 参数并补充非交互终端下的执行说明,
同时更新 README、部署模块文档并新增测试 compose 配置
This commit is contained in:
yinjianm
2026-04-28 13:41:04 +08:00
parent a4e78b864a
commit c24a1495ff
5 changed files with 97 additions and 17 deletions
+13 -13
View File
@@ -3,21 +3,16 @@ set -eu
cd "$(dirname "$0")/.."
run_migrate=false
for arg in "$@"; do
case "$arg" in
--migrate)
run_migrate=true
;;
-h|--help)
echo "Usage: sh ./scripts/update.sh [--migrate]"
echo " --migrate Run 'php artisan migrate --force' after containers are updated."
echo "Usage: sh ./scripts/update.sh"
echo "Runs: docker compose pull && docker compose run -it --rm web php artisan xboard:update && docker compose up -d"
exit 0
;;
*)
echo "Unknown option: $arg"
echo "Usage: sh ./scripts/update.sh [--migrate]"
echo "Usage: sh ./scripts/update.sh"
exit 1
;;
esac
@@ -34,12 +29,17 @@ if ! docker compose version >/dev/null 2>&1; then
fi
docker compose pull
docker compose up -d
if [ "$run_migrate" = "true" ]; then
docker compose exec -T web php artisan migrate --force
else
echo "Migration skipped. Re-run with --migrate when the release requires database migrations."
run_tty_args="-it"
if [ ! -t 0 ] || [ ! -t 1 ]; then
run_tty_args=""
fi
if [ -n "$run_tty_args" ]; then
docker compose run -it --rm web php artisan xboard:update
else
docker compose run --rm web php artisan xboard:update
fi
docker compose up -d
docker compose ps