Files
ai_site/reload-config.sh
2026-07-31 10:19:22 +08:00

65 lines
1.7 KiB
Bash
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
# 轻量重载配置(不 rebuild 镜像、不重建 web/dist、不 down 整栈)
# 用法:
# ./reload-config.sh # 全部
# ./reload-config.sh web # 容器 nginxweb/nginx.conf
# ./reload-config.sh platform # restart platformplatform/etc/platform.docker.yaml
# ./reload-config.sh gateway # restart gateway
# ./reload-config.sh ai # recreate ai.env
# ./reload-config.sh host-nginx # 宿主机 Nginx + 证书 + verify-root
# 行尾LF
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
# shellcheck disable=SC1091
. "$ROOT/scripts/lib-aijz-deploy.sh"
usage() {
cat <<EOF
用法: $0 [web|platform|gateway|ai|host-nginx|all]
web 容器内 nginx -s reload改 web/nginx.conf 后)
platform restart platform改 platform/etc/platform.docker.yaml 或 AIJZ_PUBLIC_BASE_URL
gateway restart gateway改 gateway/etc/gateway.docker.yaml
ai recreate ai改 .env 密钥或 etc/llm.yaml 供应商)
host-nginx 同步证书 + 生成站点 + reload 宿主机 nginx需 AIJZ_ENABLE_HOST_NGINX=1
all 以上全部(默认)
详见 nginx/README.md
EOF
}
ensure_docker
ensure_env_file
export_defaults
TARGET="${1:-all}"
case "$TARGET" in
-h|--help|help) usage; exit 0 ;;
web)
reload_web_nginx
;;
platform)
apply_public_base_url
restart_service platform
;;
gateway)
restart_service gateway
;;
ai)
compose_cmd up -d --force-recreate ai
echo "已 recreate ai.env + etc/llm.yaml"
;;
host-nginx|host)
reload_host_nginx
;;
all)
reload_all_config
;;
*)
echo "未知目标: $TARGET" >&2
usage >&2
exit 1
;;
esac