Files
ai_site/start.sh
whm 0445fc6fcc chore: mark Linux deploy scripts executable in git
Avoid Permission denied on production when running ./restart.sh after pull.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 16:32:09 +08:00

50 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# AI 建站 — Linux 一键启动Docker Compose
# 用法cd 项目根 && ./start.sh [--rebuild] [--no-pull]
# 默认从 Gitea 强制对齐最新代码再启动(可用 --no-pull / AIJZ_SKIP_GIT_PULL=1 跳过)
# 生产一键更新也可用:./restart.sh --pull 或 ./pull-and-restart.sh
# 行尾LF
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
# shellcheck disable=SC1091
. "$ROOT/scripts/lib-aijz-deploy.sh"
REBUILD=0
DO_PULL=1
for a in "$@"; do
case "$a" in
--rebuild|-r) REBUILD=1 ;;
--no-pull) DO_PULL=0 ;;
--pull) DO_PULL=1 ;;
-h|--help)
echo "用法: $0 [--rebuild] [--no-pull|--pull]"
echo " 默认拉取并硬对齐: ${AIJZ_GIT_URL:-https://gitea.yuxindazhineng.com/whm/ai_site.git} 分支 ${GIT_BRANCH:-main}"
echo " 跳过拉取: --no-pull 或 AIJZ_SKIP_GIT_PULL=1"
echo " 仅更新重启: ./restart.sh --pull"
exit 0
;;
esac
done
if [ "${AIJZ_SKIP_GIT_PULL:-0}" = "1" ]; then
DO_PULL=0
fi
echo "========================================"
echo " AI 建站 启动"
echo " 路径: $ROOT"
echo "========================================"
if [ "$DO_PULL" = "1" ]; then
git_pull_hard
else
echo "已跳过代码拉取(--no-pull / AIJZ_SKIP_GIT_PULL"
fi
ensure_docker
ensure_env_file
export_defaults
stack_up "$REBUILD"
healthcheck
print_endpoints