feat(update): add Onebox self-upgrade flow

This commit is contained in:
2026-05-24 11:49:43 +00:00
parent 4812621376
commit 05235ec284
10 changed files with 487 additions and 48 deletions
+9
View File
@@ -5,6 +5,7 @@
*/
import { logger } from '../logging.ts';
import { projectInfo } from '../info.ts';
import { getErrorMessage } from '../utils/error.ts';
import { hashPassword } from '../utils/auth.ts';
import { OneboxDatabase } from './database.ts';
@@ -26,6 +27,7 @@ import { BackupManager } from './backup-manager.ts';
import { BackupScheduler } from './backup-scheduler.ts';
import { ExternalGatewayManager } from './external-gateway.ts';
import { ManagedDcRouterManager } from './managed-dcrouter.ts';
import { OneboxUpdateManager } from './update-manager.ts';
import { OpsServer } from '../opsserver/index.ts';
export class Onebox {
@@ -48,6 +50,7 @@ export class Onebox {
public backupScheduler: BackupScheduler;
public managedDcRouter: ManagedDcRouterManager;
public externalGateway: ExternalGatewayManager;
public updateManager: OneboxUpdateManager;
public opsServer: OpsServer;
private initialized = false;
@@ -93,6 +96,7 @@ export class Onebox {
// Initialize optional dcrouter gateway integration
this.managedDcRouter = new ManagedDcRouterManager(this);
this.externalGateway = new ExternalGatewayManager(this);
this.updateManager = new OneboxUpdateManager();
// Initialize OpsServer (TypedRequest-based server)
this.opsServer = new OpsServer(this);
@@ -305,6 +309,7 @@ export class Onebox {
const proxyStatus = this.reverseProxy.getStatus();
const dnsConfigured = this.dns.isConfigured();
const sslConfigured = this.ssl.isConfigured();
const oneboxUpdate = await this.updateManager.getUpdateStatus();
const services = this.services.listServices();
const runningServices = services.filter((s) => s.status === 'running').length;
@@ -407,6 +412,10 @@ export class Onebox {
}
return {
onebox: {
version: projectInfo.version,
update: oneboxUpdate,
},
docker: {
running: dockerRunning,
version: dockerRunning ? await this.docker.getDockerVersion() : null,