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:
ji ruo committed 2026-12-02 13:31:05 +08:00
1 parent d786de90af
commit 07309e4530
23 files changed
+2107 -144

No files matched your search

+14 -8
View File
@@ -11,6 +11,7 @@ import (
"sync"
"time"
"github.com/Autumn-27/artex/internal/sandbox"
"github.com/Autumn-27/artex/selfupdate"
)
@@ -214,16 +215,21 @@ func (s *Server) updateCheck(w http.ResponseWriter, r *http.Request) {
if selfupdate.InDocker() {
mode = "docker"
}
deployEdition := "standalone"
if mgr := sandbox.Default(); mgr != nil && mgr.Enabled() {
deployEdition = "sandbox"
}
boot := bootUpdateState()
out := map[string]any{
"current": current,
"mode": mode,
"os": runtime.GOOS,
"arch": runtime.GOARCH,
"has_backup": selfupdate.HasBackup(),
"repo": selfupdate.Repo,
"boot_notice": boot.Detail,
"rolled_back": boot.RolledBack,
"current": current,
"mode": mode,
"deploy_edition": deployEdition,
"os": runtime.GOOS,
"arch": runtime.GOARCH,
"has_backup": selfupdate.HasBackup(),
"repo": selfupdate.Repo,
"boot_notice": boot.Detail,
"rolled_back": boot.RolledBack,
}
// 顶栏提示走缓存(默认);用户点"检查更新"时带 force=1 强制回源。