feat(appstore): add service volumes and published ports

This commit is contained in:
2026-05-24 07:28:18 +00:00
parent e6ebac76b4
commit 5228eeaa23
26 changed files with 1790 additions and 348 deletions
+39
View File
@@ -133,6 +133,45 @@ export class ExternalGatewayManager {
}
await this.syncDomains();
await this.syncServiceRoutes();
}
public async syncServiceRoutes(): Promise<void> {
const services = this.database.getAllServices()
.filter((service) => service.domain && service.status === 'running');
const activeHostnames = new Set(services.map((service) => service.domain!));
for (const service of services) {
try {
await this.syncServiceRoute(service);
} catch (error) {
logger.warn(`Failed to sync external gateway route for ${service.domain}: ${getErrorMessage(error)}`);
}
}
await this.deleteStaleServiceRoutes(activeHostnames);
}
private async deleteStaleServiceRoutes(activeHostnamesArg: Set<string>): Promise<void> {
const records = await this.getGatewayDnsRecords();
const staleRecordsByHostname = new Map<string, IGatewayDnsRecord>();
for (const record of records) {
if (!record.hostname || activeHostnamesArg.has(record.hostname)) continue;
if (!record.routeId && !record.appId && !record.serviceName) continue;
staleRecordsByHostname.set(record.hostname, record);
}
for (const record of staleRecordsByHostname.values()) {
try {
await this.deleteServiceRoute({
name: record.serviceName || record.appId,
domain: record.hostname,
});
} catch (error) {
logger.warn(`Failed to delete stale external gateway route for ${record.hostname}: ${getErrorMessage(error)}`);
}
}
}
public async isConfigured(): Promise<boolean> {