65 lines
1.7 KiB
Bash
65 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
||
# 轻量重载配置(不 rebuild 镜像、不重建 web/dist、不 down 整栈)
|
||
# 用法:
|
||
# ./reload-config.sh # 全部
|
||
# ./reload-config.sh web # 容器 nginx(web/nginx.conf)
|
||
# ./reload-config.sh platform # restart platform(platform/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
|