mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-03 04:11:51 +08:00
feat(deploy,gateway): add dual-edition deployment/migration/rollback and TUN route reconciliation
- Add standalone edition (`Dockerfile.standalone`, `docker-compose.standalone.yml`) alongside sandbox edition and publish both in `.github/workflows/release.yml`. - Implement `scripts/deploy-lib.sh`, `install.sh`, `update.sh`, and `scripts/artex-sandbox-firewall.sh --cleanup` with edition detection, legacy standalone -> sandbox migration (symlink-safe workspace permissions), automatic snapshots with pinned `artex-rollback/*` images + PG dump, auto/manual cross-edition rollback, and post-rollback upstream unpinning. - Update `ensureWritableDir` in `internal/sandbox/manager.go` to safely migrate nested root-owned workspace files without following symlinks. - Expose `deploy_edition` in `/api/update/check` and update `UpdateCard` UI/i18n warnings for sandbox vs standalone in-app update/rollback. - Reconcile `artex-gateway` TUN policy routing (`priority 218`, `raw PREROUTING`, `nat POSTROUTING`, `DOCKER-USER`) every 15s to self-heal after host network rule flushes or bridge changes. - Add unit and shell tests (`scripts/deploy_test.sh`, `cmd/artex-gateway/tun_linux_test.go`, `internal/sandbox/sandbox_test.go`, `server/update_test.go`) and update `README.md` / `.env.example`.
This commit is contained in:
1 parent
d786de90af
commit
07309e4530
23 files changed
+2107
-144
No files matched your search
@@ -186,16 +186,25 @@ export function UpdateCard() {
|
||||
[waitForNewVersion, liveT],
|
||||
);
|
||||
|
||||
const isSandboxDocker = info?.mode === "docker" && info?.deploy_edition === "sandbox";
|
||||
let editionBadgeLabel = t("settings.standalone");
|
||||
if (info?.mode === "docker") {
|
||||
editionBadgeLabel = isSandboxDocker ? t("settings.dockerSandboxEdition") : t("settings.dockerStandaloneEdition");
|
||||
}
|
||||
|
||||
const doUpdate = () => {
|
||||
if (!info) return;
|
||||
const from = info.current;
|
||||
let dockerWarn = "";
|
||||
if (info.mode === "docker") {
|
||||
dockerWarn = isSandboxDocker
|
||||
? t("settings.sandboxUpdateWarning")
|
||||
: t("settings.dockerUpdateWarningStart") + t("settings.dockerUpdateWarningEnd");
|
||||
}
|
||||
const ok = window.confirm(
|
||||
t("settings.confirmUpdateVersion", { version: info.latest }) +
|
||||
t("settings.updateInterruptWarning") +
|
||||
(info.mode === "docker" ? t("settings.dockerUpdateWarningStart") + t("settings.dockerUpdateWarningEnd") : ""),
|
||||
t("settings.confirmUpdateVersion", { version: info.latest }) + t("settings.updateInterruptWarning") + dockerWarn,
|
||||
);
|
||||
if (!ok) return;
|
||||
|
||||
setBusy(true);
|
||||
setProgress({ phase: "downloading", percent: 0, message: t("settings.preparing") });
|
||||
api
|
||||
@@ -212,7 +221,10 @@ export function UpdateCard() {
|
||||
|
||||
const doRollback = () => {
|
||||
if (!info) return;
|
||||
if (!window.confirm(t("settings.confirmRollback"))) return;
|
||||
const confirmMsg = isSandboxDocker
|
||||
? t("settings.confirmRollback") + t("settings.sandboxRollbackWarning")
|
||||
: t("settings.confirmRollback");
|
||||
if (!window.confirm(confirmMsg)) return;
|
||||
const from = info.current;
|
||||
setBusy(true);
|
||||
api
|
||||
@@ -292,7 +304,7 @@ export function UpdateCard() {
|
||||
<Badge variant="outline" className="font-mono">
|
||||
{info.os}/{info.arch}
|
||||
</Badge>
|
||||
<Badge variant="outline">{info.mode === "docker" ? "Docker" : t("settings.standalone")}</Badge>
|
||||
<Badge variant="outline">{editionBadgeLabel}</Badge>
|
||||
</>
|
||||
)}
|
||||
{info?.latest && (
|
||||
@@ -365,12 +377,25 @@ export function UpdateCard() {
|
||||
</p>
|
||||
)}
|
||||
|
||||
{info?.mode === "docker" && info.has_update && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("settings.dockerUpdateHelpStart")}
|
||||
<span className="font-mono"> docker compose up -d </span>
|
||||
{t("settings.dockerUpdateHelpMiddle")}
|
||||
<span className="font-mono"> docker compose pull artex && docker compose up -d artex</span>。
|
||||
{info?.mode === "docker" && (info.has_update || info.has_backup) && (
|
||||
<p className="text-muted-foreground text-xs">
|
||||
{isSandboxDocker ? (
|
||||
<>
|
||||
{t("settings.sandboxUpdateHelpStart")}
|
||||
<span className="font-mono"> ./update.sh </span>
|
||||
{t("settings.sandboxUpdateHelpMiddle")}
|
||||
<span className="font-mono"> ./update.sh --rollback</span>
|
||||
{t("settings.sandboxUpdateHelpEnd")}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{t("settings.dockerUpdateHelpStart")}
|
||||
<span className="font-mono"> docker compose up -d </span>
|
||||
{t("settings.dockerUpdateHelpMiddle")}
|
||||
<span className="font-mono"> ./update.sh</span>
|
||||
{t("settings.dockerUpdateHelpEnd")}
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
|
||||
|
||||
@@ -687,8 +687,16 @@ export const settingsMessages = {
|
||||
"\nNote: Updating inside a container replaces only ARTEX, not tools such as playwright / nmap in the image. ",
|
||||
],
|
||||
"settings.dockerUpdateWarningEnd": [
|
||||
"若新版本依赖新工具,请改用 docker compose pull。",
|
||||
"Use docker compose pull if the new version requires new tools.",
|
||||
"若新版本依赖新工具或需跨版本迁移,请改用 ./update.sh。",
|
||||
"Use ./update.sh if the new version requires updated tools or edition migration.",
|
||||
],
|
||||
"settings.sandboxUpdateWarning": [
|
||||
"\n注意:当前为沙箱隔离版,容器内更新仅替换 artex 主控程序,不会同步更新 artex-gateway 透明网关与 artex-sandbox 沙箱镜像。推荐使用 ./update.sh 完成整套升级并自动生成回滚快照。",
|
||||
"\nNote: In Sandbox edition, in-app updates replace only the artex control-plane binary and do not update artex-gateway or artex-sandbox images. Use ./update.sh for a full-stack upgrade with automatic rollback snapshots.",
|
||||
],
|
||||
"settings.sandboxRollbackWarning": [
|
||||
"\n\n注意:当前为沙箱隔离版,页面回滚仅回退 artex 主控程序,不会回滚 artex-gateway 与 artex-sandbox 镜像。如需整套回滚或切回单容器版,请执行 ./update.sh --rollback。",
|
||||
"\n\nNote: In Sandbox edition, in-app rollback reverts only the artex control-plane binary, not artex-gateway or artex-sandbox images. Run ./update.sh --rollback for a full-stack rollback or to switch back to standalone.",
|
||||
],
|
||||
"settings.preparing": ["准备中…", "Preparing…"],
|
||||
"settings.updateStartFailedPrefix": ["启动更新失败:", "Could not start update: "],
|
||||
@@ -714,6 +722,8 @@ export const settingsMessages = {
|
||||
],
|
||||
"settings.currentVersion": ["当前版本", "Current version"],
|
||||
"settings.standalone": ["独立程序", "Standalone"],
|
||||
"settings.dockerSandboxEdition": ["Docker · 沙箱隔离版", "Docker · Sandbox"],
|
||||
"settings.dockerStandaloneEdition": ["Docker · 单容器版", "Docker · Standalone"],
|
||||
"settings.latestVersion": ["最新版本", "Latest version"],
|
||||
"settings.changelog": ["更新日志", "Changelog"],
|
||||
"settings.githubUnavailablePrefix": ["无法连接 GitHub:", "Unable to connect to GitHub: "],
|
||||
@@ -735,9 +745,19 @@ export const settingsMessages = {
|
||||
"Updates in Docker replace only ARTEX, not tools such as playwright / nmap in the image. Running ",
|
||||
],
|
||||
"settings.dockerUpdateHelpMiddle": [
|
||||
"重建容器后会退回镜像自带的版本。需要连镜像一起升级请执行",
|
||||
" to recreate the container restores the version in the image. To upgrade the image as well, run ",
|
||||
"重建容器后会退回镜像自带的版本。需要连镜像一起升级、迁移到沙箱隔离版或回滚,请执行",
|
||||
" to recreate the container restores the version in the image. To upgrade images, migrate to Sandbox edition, or roll back, run ",
|
||||
],
|
||||
"settings.dockerUpdateHelpEnd": [
|
||||
"(回滚执行 ./update.sh --rollback)。",
|
||||
" (or ./update.sh --rollback to roll back).",
|
||||
],
|
||||
"settings.sandboxUpdateHelpStart": [
|
||||
"沙箱隔离版下页面一键更新/回滚仅作用于 artex 主控程序,不会同步切换 artex-gateway 与 artex-sandbox 镜像;完整升级、切换单容器版请执行",
|
||||
"In Sandbox edition, in-app update/rollback affects only the artex control-plane binary, not artex-gateway or artex-sandbox images. For full-stack upgrades or edition switching, run ",
|
||||
],
|
||||
"settings.sandboxUpdateHelpMiddle": [",整套回滚请执行", ", and for full-stack rollback run "],
|
||||
"settings.sandboxUpdateHelpEnd": ["。", "."],
|
||||
"settings.restarting": [
|
||||
"正在重启并应用新版本,请稍候(页面会自动刷新)…",
|
||||
"Restarting and applying the new version. Please wait; the page will reload automatically…",
|
||||
|
||||
@@ -1781,6 +1781,8 @@ export interface UpdateCheck {
|
||||
current: string;
|
||||
/** 运行形态。docker 下换装只作用于容器可写层,重建容器会退回镜像版本。 */
|
||||
mode: "docker" | "binary";
|
||||
/** 部署架构:sandbox(多容器沙箱隔离版)或 standalone(单容器/独立程序版)。 */
|
||||
deploy_edition?: "sandbox" | "standalone";
|
||||
os: string;
|
||||
arch: string;
|
||||
repo: string;
|
||||
|
||||
Reference in new issue
Block a user