mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-04 20:41:51 +08:00
refactor(deploy,update): drop standalone edition and add sandbox upgrade confirmation
- Remove standalone Docker edition (Dockerfile.standalone, docker-compose.standalone.yml, release.yml standalone jobs, and dual-edition env/script branches). - Remove deploy_edition field from /api/update/check and dual-edition UI/i18n branching in UpdateCard. - Replace window.confirm on upgrade with AlertDialog informing users of the irreversible Standalone -> Sandbox security upgrade.
This commit is contained in:
1 parent
8efd26b8b7
commit
f5b446e3bf
15 files changed
+330
-944
No files matched your search
+29
-44
@@ -1,12 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# ARTEX 安装脚本:
|
||||
# 1) Docker 沙箱隔离版(推荐,当前完整版:独立沙箱容器 + 全流量透明网关 + 出口代理控制)
|
||||
# 2) Docker 单容器版(兼容上一版本:仅 postgres + artex,无需 docker-socket-proxy / /dev/net/tun)
|
||||
# 3) 本地编译运行(Go 编译)
|
||||
# 1) Docker 部署(推荐:独立沙箱容器 + 全流量透明网关 + 出口代理控制)
|
||||
# 2) 本地编译运行(Go 编译)
|
||||
#
|
||||
# 非交互用法示例:
|
||||
# ./install.sh --edition sandbox --yes
|
||||
# ./install.sh --edition standalone --tag standalone --yes
|
||||
# ./install.sh --docker --yes
|
||||
# ./install.sh --docker --tag v0.3.33 --yes
|
||||
# ./install.sh --local
|
||||
set -euo pipefail
|
||||
cd "$(cd "$(dirname "$0")" && pwd)"
|
||||
@@ -34,24 +33,17 @@ ensure_docker(){
|
||||
esac
|
||||
}
|
||||
|
||||
# ── ① Docker 安装(支持 sandbox / standalone 双形态)───────────────
|
||||
# ── ① Docker 部署 ───────────────────────────────────────────────
|
||||
install_docker(){
|
||||
local edition="${1:-sandbox}" tag="${2:-}"
|
||||
local tag="${1:-}"
|
||||
ensure_docker
|
||||
|
||||
if [ "$edition" = "sandbox" ]; then
|
||||
preflight_sandbox
|
||||
fi
|
||||
preflight_docker
|
||||
|
||||
umask 077
|
||||
local is_fresh=0
|
||||
[ -f .env ] || is_fresh=1
|
||||
|
||||
if [ "$edition" = "sandbox" ]; then
|
||||
prepare_env_for_sandbox "$tag" .env
|
||||
else
|
||||
prepare_env_for_standalone "$tag" .env
|
||||
fi
|
||||
prepare_env_for_docker "$tag" .env
|
||||
|
||||
if [ "$is_fresh" -eq 1 ] && [ "${ARTEX_NONINTERACTIVE:-0}" != "1" ]; then
|
||||
local key
|
||||
@@ -59,16 +51,14 @@ install_docker(){
|
||||
[ -n "$key" ] && env_set ANTHROPIC_API_KEY "$key" .env
|
||||
fi
|
||||
|
||||
local compose_file
|
||||
compose_file="$(compose_file_for_edition "$edition")"
|
||||
pull_edition_images "$edition"
|
||||
info "启动 $(edition_label "$edition")(${compose_file})…"
|
||||
docker compose -f "$compose_file" up -d --remove-orphans
|
||||
wait_for_health "$compose_file" || warn "服务仍在启动中,请执行 docker compose -f ${compose_file} logs -f artex 观察"
|
||||
pull_docker_images
|
||||
info "启动服务(${COMPOSE_FILE})…"
|
||||
docker compose -f "$COMPOSE_FILE" up -d --remove-orphans
|
||||
wait_for_health "$COMPOSE_FILE" || warn "服务仍在启动中,请执行 docker compose -f ${COMPOSE_FILE} logs -f artex 观察"
|
||||
|
||||
ok "启动完成($(edition_label "$edition"))→ http://localhost:8787"
|
||||
info "查看日志:docker compose -f ${compose_file} logs -f artex"
|
||||
info "后续升级 / 切换版本形态 / 回滚:./update.sh"
|
||||
ok "启动完成 → http://localhost:8787"
|
||||
info "查看日志:docker compose -f ${COMPOSE_FILE} logs -f artex"
|
||||
info "后续升级 / 回滚:./update.sh"
|
||||
}
|
||||
|
||||
# ── ② 本地编译运行 ──────────────────────────────
|
||||
@@ -131,22 +121,22 @@ usage(){
|
||||
用法: ./install.sh [选项]
|
||||
|
||||
选项:
|
||||
--edition sandbox|standalone 直接指定 Docker 部署形态(sandbox=沙箱隔离版,standalone=单容器版)
|
||||
--tag <TAG> 指定镜像版本 tag(如 v0.3.33 / v0.3.32 / latest / standalone)
|
||||
--local 使用本地 Go 编译运行
|
||||
--skip-pull 跳过镜像拉取(适用于本地已构建镜像)
|
||||
-y, --yes 非交互模式(自动填充默认值)
|
||||
-h, --help 显示本帮助
|
||||
--docker 直接执行 Docker 部署(docker-compose.yml)
|
||||
--tag <TAG> 指定镜像版本 tag(如 v0.3.33 / latest)
|
||||
--local 使用本地 Go 编译运行
|
||||
--skip-pull 跳过镜像拉取(适用于本地已构建镜像)
|
||||
-y, --yes 非交互模式(自动填充默认值)
|
||||
-h, --help 显示本帮助
|
||||
USAGE
|
||||
}
|
||||
|
||||
OPT_EDITION=""
|
||||
OPT_DOCKER=0
|
||||
OPT_TAG=""
|
||||
OPT_LOCAL=0
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--edition) shift; [ "$#" -gt 0 ] || die "--edition 需要参数"; OPT_EDITION="$1" ;;
|
||||
--docker) OPT_DOCKER=1 ;;
|
||||
--tag) shift; [ "$#" -gt 0 ] || die "--tag 需要参数"; OPT_TAG="$1" ;;
|
||||
--local) OPT_LOCAL=1 ;;
|
||||
--skip-pull) export ARTEX_SKIP_PULL=1 ;;
|
||||
@@ -162,23 +152,18 @@ if [ "$OPT_LOCAL" -eq 1 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$OPT_EDITION" ]; then
|
||||
case "$OPT_EDITION" in
|
||||
sandbox|standalone) install_docker "$OPT_EDITION" "$OPT_TAG" ;;
|
||||
*) die "无效 --edition 值:${OPT_EDITION}(仅支持 sandbox 或 standalone)" ;;
|
||||
esac
|
||||
if [ "$OPT_DOCKER" -eq 1 ]; then
|
||||
install_docker "$OPT_TAG"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
echo " ARTEX 安装部署"
|
||||
echo " 1) Docker 沙箱隔离版(推荐:独立沙箱 + 全流量网关)"
|
||||
echo " 2) Docker 单容器版(兼容上一版本:仅 postgres + artex)"
|
||||
echo " 3) 本地运行(Go 编译)"
|
||||
echo " 1) Docker 部署(推荐:独立沙箱 + 全流量网关)"
|
||||
echo " 2) 本地运行(Go 编译)"
|
||||
echo "=========================================="
|
||||
case "$(ask '选择' 1)" in
|
||||
1) install_docker sandbox "$OPT_TAG" ;;
|
||||
2) install_docker standalone "$OPT_TAG" ;;
|
||||
3) install_local ;;
|
||||
1) install_docker "$OPT_TAG" ;;
|
||||
2) install_local ;;
|
||||
*) die "无效选择" ;;
|
||||
esac
|
||||
Reference in new issue
Block a user