fix(updater): recover interrupted swaps reliably across deployments

- Ship one POSIX launcher that repairs an interrupted code swap before Node
  starts, install it atomically before the swap, and keep it out of
  CODE_ENTRIES so it always survives at the install root.
- Restore from the in-progress task backup (state.json task.id ->
  backups/<id>) first, then the newest complete backup, so a leftover older
  backup never resurrects an obsolete build.
- Add exact-window SIGKILL recovery tests, including the stale-backup case.
- Gate Linux arm64 apply behind a capability check; add five-language copy
  and i18n labels for arm64, lock and unavailable errors.
- Harden the L2 runner handshake and recheck runner health before exit.
This commit is contained in:
OddTurtleHead committed 2026-11-24 03:13:32 +08:00
1 parent 699e606da5
commit 82b58dbd61
16 files changed
+699 -24

No files matched your search

+10
View File
@@ -23,6 +23,7 @@ const zh = {
updateBlockedSource: "源码运行没有捆绑运行时,控制台无法安全切换版本。请拉取源码后自行构建(npm ci && npm run build && npm run web:build),或改用发布包/Docker Compose。",
updateBlockedPlatform: "当前平台没有官方发布包,只能检查版本。", updateBlockedArch: "当前架构没有官方发布包,只能检查版本。",
updateBlockedWindows: "Windows 发布包的控制台更新尚未在真实 Windows 环境验证,已禁用;请下载新版发布包后手动替换。",
updateBlockedArm64: "Linux arm64 发布包的控制台更新尚未在真实硬件实测,已禁用;请下载新版发布包后手动替换。",
updateChecksumNotice: "SHA256SUMS.txt 只用于 SHA-256 完整性校验和,不是数字签名。",
updateBlockedUnavailable: "此实例未启用控制台更新。", updateTaskTitle: "更新任务",
updateStatusDownloading: "正在下载", updateStatusVerifying: "正在校验", updateStatusExtracting: "正在解包", updateStatusStaging: "正在暂存",
@@ -35,6 +36,7 @@ const zh = {
updateErrorRollbackFailed: "更新失败且自动回滚也失败。请按备份手动恢复上一版本。",
updateErrorSwap: "替换程序文件失败,已尝试恢复上一版本;请查看日志。",
updateErrorInProgress: "已有更新任务正在进行。", updateErrorGeneric: "更新未能完成,请查看日志。", updateStartedEvent: "已开始更新",
updateErrorLockFailed: "无法接管更新锁,请确认没有其他更新任务在运行后重试。", updateErrorUnavailable: "此实例未启用控制台更新。",
adminWsOverviewTitle: "WebSpeak 管理服务已就绪", adminWsOverviewLead: "先管理实例接入与访客体验;需要管理 TS 服务时,再按需配置独立连接。",
adminWsManageLead: "接入策略、站点公告、语音传输、皮肤商店和浏览器会话。",
adminTsManageLead: "服务器设置、频道、在线成员、服务器组和封禁。需单独配置 Query 凭据,常规语音连接不需要。",
@@ -70,6 +72,7 @@ const en = {
updateBlockedSource: "Source installs have no bundled runtime, so the console cannot switch versions safely. Pull the source and rebuild (npm ci && npm run build && npm run web:build), or use a release package/Docker Compose.",
updateBlockedPlatform: "No official package exists for this platform; only version checks are available.", updateBlockedArch: "No official package exists for this architecture; only version checks are available.",
updateBlockedWindows: "Console updates for Windows release packages are disabled until they are verified on a real Windows install. Download the new package and replace it manually.",
updateBlockedArm64: "Console updates for Linux arm64 release packages are disabled until they are verified on real hardware. Download the new package and replace it manually.",
updateChecksumNotice: "SHA256SUMS.txt is an integrity checksum only, not a digital signature.",
updateBlockedUnavailable: "Console updates are not enabled for this instance.", updateTaskTitle: "Update task",
updateStatusDownloading: "Downloading", updateStatusVerifying: "Verifying", updateStatusExtracting: "Extracting", updateStatusStaging: "Staging",
@@ -82,6 +85,7 @@ const en = {
updateErrorRollbackFailed: "The update failed and automatic rollback also failed. Restore the previous version manually from the backup.",
updateErrorSwap: "Replacing application files failed; the previous version was restored where possible. Check the logs.",
updateErrorInProgress: "Another update task is already running.", updateErrorGeneric: "The update could not be completed; check the logs.", updateStartedEvent: "Update started",
updateErrorLockFailed: "The update lock could not be taken over; make sure no other update is running and try again.", updateErrorUnavailable: "Console updates are not enabled for this instance.",
adminWsOverviewTitle: "WebSpeak management is ready", adminWsOverviewLead: "Manage instance access and the guest experience first. Configure an independent TS management connection when you need it.",
adminWsManageLead: "Access policy, site announcements, voice transport, the skin store and browser sessions.",
adminTsManageLead: "Server settings, channels, clients, server groups and bans. Separate Query credentials are required; ordinary voice connections do not need them.",
@@ -116,6 +120,7 @@ const de = {
updateBlockedSource: "Quellinstallationen haben keine mitgelieferte Laufzeit; die Konsole kann Versionen nicht sicher wechseln. Quellen aktualisieren und neu bauen (npm ci && npm run build && npm run web:build) oder Release-Paket/Docker Compose verwenden.",
updateBlockedPlatform: "Für diese Plattform gibt es kein offizielles Paket; nur Versionsprüfungen sind möglich.", updateBlockedArch: "Für diese Architektur gibt es kein offizielles Paket; nur Versionsprüfungen sind möglich.",
updateBlockedWindows: "Konsolen-Updates für Windows-Release-Pakete sind deaktiviert, bis sie auf einer echten Windows-Installation geprüft wurden. Laden Sie das neue Paket herunter und ersetzen Sie es manuell.",
updateBlockedArm64: "Konsolen-Updates für Linux-arm64-Release-Pakete sind deaktiviert, bis sie auf echter Hardware geprüft wurden. Laden Sie das neue Paket herunter und ersetzen Sie es manuell.",
updateChecksumNotice: "SHA256SUMS.txt ist nur eine Integritätsprüfsumme, keine digitale Signatur.",
updateBlockedUnavailable: "Konsolen-Updates sind für diese Instanz nicht aktiviert.", updateTaskTitle: "Update-Aufgabe",
updateStatusDownloading: "Wird heruntergeladen", updateStatusVerifying: "Wird geprüft", updateStatusExtracting: "Wird entpackt", updateStatusStaging: "Wird bereitgestellt",
@@ -128,6 +133,7 @@ const de = {
updateErrorRollbackFailed: "Das Update ist fehlgeschlagen und auch die automatische Wiederherstellung. Stellen Sie die vorherige Version manuell aus der Sicherung wieder her.",
updateErrorSwap: "Das Ersetzen der Anwendungsdateien ist fehlgeschlagen; die vorherige Version wurde nach Möglichkeit wiederhergestellt. Protokolle prüfen.",
updateErrorInProgress: "Eine andere Update-Aufgabe läuft bereits.", updateErrorGeneric: "Das Update konnte nicht abgeschlossen werden; Protokolle prüfen.", updateStartedEvent: "Update gestartet",
updateErrorLockFailed: "Die Update-Sperre konnte nicht übernommen werden. Stellen Sie sicher, dass keine andere Update-Aufgabe läuft, und versuchen Sie es erneut.", updateErrorUnavailable: "Konsolen-Updates sind für diese Instanz nicht aktiviert.",
adminWsOverviewTitle: "WebSpeak-Verwaltung ist bereit", adminWsOverviewLead: "Zuerst Instanzzugang und Gastoberfläche verwalten. Eine separate TS-Verbindung nur bei Bedarf einrichten.",
adminWsManageLead: "Zugriffsregeln, Website-Ankündigungen, Sprachtransport, Skin-Store und Browsersitzungen.",
adminTsManageLead: "Servereinstellungen, Kanäle, Mitglieder, Servergruppen und Sperren. Separate Query-Zugangsdaten sind nötig; normale Sprachverbindungen benötigen sie nicht.",
@@ -162,6 +168,7 @@ const ru = {
updateBlockedSource: "В установке из исходников нет встроенной среды выполнения, поэтому консоль не может безопасно сменить версию. Обновите исходники и пересоберите (npm ci && npm run build && npm run web:build) или используйте пакет релиза/Docker Compose.",
updateBlockedPlatform: "Для этой платформы нет официального пакета; доступна только проверка версий.", updateBlockedArch: "Для этой архитектуры нет официального пакета; доступна только проверка версий.",
updateBlockedWindows: "Обновление из консоли для релизных пакетов Windows отключено до проверки на реальной установке Windows. Скачайте новый пакет и замените его вручную.",
updateBlockedArm64: "Обновление из консоли для релизных пакетов Linux arm64 отключено до проверки на реальном оборудовании. Скачайте новый пакет и замените его вручную.",
updateChecksumNotice: "SHA256SUMS.txt — только контрольная сумма целостности, а не цифровая подпись.",
updateBlockedUnavailable: "Обновление из консоли для этого экземпляра не включено.", updateTaskTitle: "Задача обновления",
updateStatusDownloading: "Скачивание", updateStatusVerifying: "Проверка", updateStatusExtracting: "Распаковка", updateStatusStaging: "Подготовка",
@@ -174,6 +181,7 @@ const ru = {
updateErrorRollbackFailed: "Обновление не удалось, и автоматический откат тоже не удался. Восстановите предыдущую версию вручную из резервной копии.",
updateErrorSwap: "Не удалось заменить файлы приложения; предыдущая версия восстановлена по возможности. Проверьте журналы.",
updateErrorInProgress: "Другая задача обновления уже выполняется.", updateErrorGeneric: "Не удалось завершить обновление; проверьте журналы.", updateStartedEvent: "Обновление начато",
updateErrorLockFailed: "Не удалось перехватить блокировку обновления. Убедитесь, что другая задача обновления не выполняется, и повторите попытку.", updateErrorUnavailable: "Обновление из консоли для этого экземпляра не включено.",
adminWsOverviewTitle: "Управление WebSpeak готово", adminWsOverviewLead: "Настройте доступ и гостевой интерфейс. Отдельное управление TS подключайте по мере необходимости.",
adminWsManageLead: "Политика доступа, объявления сайта, голосовой транспорт, магазин тем и сеансы браузеров.",
adminTsManageLead: "Настройки сервера, каналы, участники, серверные группы и блокировки. Нужны отдельные данные Query; для обычного голосового подключения они не требуются.",
@@ -208,6 +216,7 @@ const ja = {
updateBlockedSource: "ソース実行には同梱ランタイムがないため、安全にバージョンを切り替えられません。ソースを取得して再ビルドする(npm ci && npm run build && npm run web:build)か、リリースパッケージ/Docker Compose を使用してください。",
updateBlockedPlatform: "このプラットフォーム向けの公式パッケージがないため、バージョン確認のみ可能です。", updateBlockedArch: "このアーキテクチャ向けの公式パッケージがないため、バージョン確認のみ可能です。",
updateBlockedWindows: "Windows リリースパッケージのコンソール更新は、実際の Windows 環境で検証するまで無効です。新しいパッケージをダウンロードして手動で置き換えてください。",
updateBlockedArm64: "Linux arm64 リリースパッケージのコンソール更新は、実機で検証するまで無効です。新しいパッケージをダウンロードして手動で置き換えてください。",
updateChecksumNotice: "SHA256SUMS.txt は整合性確認用のチェックサムであり、デジタル署名ではありません。",
updateBlockedUnavailable: "このインスタンスではコンソール更新が有効になっていません。", updateTaskTitle: "更新タスク",
updateStatusDownloading: "ダウンロード中", updateStatusVerifying: "検証中", updateStatusExtracting: "展開中", updateStatusStaging: "ステージング中",
@@ -220,6 +229,7 @@ const ja = {
updateErrorRollbackFailed: "更新に失敗し、自動ロールバックも失敗しました。バックアップから以前のバージョンを手動で復元してください。",
updateErrorSwap: "アプリケーションのファイル置き換えに失敗しました。可能な範囲で以前のバージョンに戻しました。ログを確認してください。",
updateErrorInProgress: "別の更新タスクが実行中です。", updateErrorGeneric: "更新を完了できませんでした。ログを確認してください。", updateStartedEvent: "更新を開始",
updateErrorLockFailed: "更新ロックを引き継げませんでした。ほかの更新タスクが実行中でないことを確認して再試行してください。", updateErrorUnavailable: "このインスタンスではコンソール更新が有効になっていません。",
adminWsOverviewTitle: "WebSpeak 管理を利用できます", adminWsOverviewLead: "まず接続方針と訪問者向け画面を管理します。必要な場合だけ、独立した TS 管理接続を設定します。",
adminWsManageLead: "アクセス方針、サイトのお知らせ、音声転送、スキンストア、ブラウザー接続。",
adminTsManageLead: "サーバー設定、チャンネル、メンバー、サーバーグループ、禁止リスト。専用 Query 認証情報が必要ですが、通常の音声接続には不要です。",