feat(update): add Onebox self-upgrade flow
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user