Wire up to start

This commit is contained in:
Owen
2026-09-09 16:50:37 -04:00
parent 6297759b15
commit 9524a11f25
6 changed files with 45 additions and 19 deletions
+8
View File
@@ -0,0 +1,8 @@
export async function startCertificateManager() {
// No-op: ACME certificate generation/management is only available in
// builds that include the private/enterprise feature set.
}
export async function stopCertificateManager() {
// No-op counterpart to startCertificateManager.
}
+3
View File
@@ -26,6 +26,7 @@ import { TraefikConfigManager } from "@server/lib/traefik/TraefikConfigManager";
import { initCleanup } from "#dynamic/cleanup"; import { initCleanup } from "#dynamic/cleanup";
import { startSchedulers } from "#dynamic/startSchedulers"; import { startSchedulers } from "#dynamic/startSchedulers";
import { startDnsServer } from "#dynamic/dns"; import { startDnsServer } from "#dynamic/dns";
import { startCertificateManager } from "#dynamic/certificates";
import license from "#dynamic/license/license"; import license from "#dynamic/license/license";
import { fetchServerIp } from "@server/lib/serverIpService"; import { fetchServerIp } from "@server/lib/serverIpService";
import { initAiModelCatalog } from "@server/lib/aiModelCatalog"; import { initAiModelCatalog } from "@server/lib/aiModelCatalog";
@@ -48,6 +49,8 @@ async function startServers() {
await startDnsServer(); await startDnsServer();
await startCertificateManager();
// Start all servers // Start all servers
const apiServer = createApiServer(); const apiServer = createApiServer();
const internalServer = createInternalServer(); const internalServer = createInternalServer();
+1 -1
View File
@@ -1,4 +1,4 @@
import logger from "@lib/logger"; import logger from "@server/logger";
export async function withRetry<T>( export async function withRetry<T>(
fn: () => Promise<T>, fn: () => Promise<T>,
+17
View File
@@ -0,0 +1,17 @@
/*
* This file is part of a proprietary work.
*
* Copyright (c) 2025-2026 Fossorial, Inc.
* All rights reserved.
*
* This file is licensed under the Fossorial Commercial License.
* You may not use this file except in compliance with the License.
* Unauthorized use, copying, modification, or distribution is strictly prohibited.
*
* This file is not licensed under the AGPLv3.
*/
export {
startCertificateManager,
stopCertificateManager
} from "./lib/certificates";
+2
View File
@@ -21,6 +21,7 @@ import { stopPingAccumulator } from "@server/routers/newt/pingAccumulator";
import { shutdownUsageRecorder } from "@server/lib/aiBudgetEnforcement"; import { shutdownUsageRecorder } from "@server/lib/aiBudgetEnforcement";
import { shutdownAiSessionLogger } from "@server/routers/aiGateway/logAiSession"; import { shutdownAiSessionLogger } from "@server/routers/aiGateway/logAiSession";
import { stopDnsServer } from "./dns"; import { stopDnsServer } from "./dns";
import { stopCertificateManager } from "./certificates";
async function cleanup() { async function cleanup() {
await stopPingAccumulator(); await stopPingAccumulator();
@@ -33,6 +34,7 @@ async function cleanup() {
await wsCleanup(); await wsCleanup();
await logStreamingManager.shutdown(); await logStreamingManager.shutdown();
await stopDnsServer(); await stopDnsServer();
await stopCertificateManager();
process.exit(0); process.exit(0);
} }
+14 -18
View File
@@ -12,29 +12,25 @@
*/ */
import logger from "@server/logger"; import logger from "@server/logger";
import { privateConfig } from "#private/lib/config";
import { acmeClientManager } from "./acme-client"; import { acmeClientManager } from "./acme-client";
import { jobScheduler } from "./scheduler"; import { jobScheduler } from "./scheduler";
// Request a new certificate export async function startCertificateManager() {
// await certificateService.addCertificateRequest(domain); const acmeConfig = privateConfig.getRawPrivateConfig().acme;
if (!acmeConfig || acmeConfig.cert_mode !== "pangolin") {
return;
}
logger.info("Starting certificate management server..."); logger.info("Starting certificate management server...");
// Initialize ACME client // Initialize ACME client
await acmeClientManager.initialize(); await acmeClientManager.initialize();
// Start job scheduler // Start job scheduler
await jobScheduler.start(); await jobScheduler.start();
}
// Graceful shutdown export async function stopCertificateManager() {
process.on("SIGTERM", async () => {
logger.info("Received SIGTERM, shutting down gracefully");
await jobScheduler.stop(); await jobScheduler.stop();
process.exit(0); }
});
process.on("SIGINT", async () => {
logger.info("Received SIGINT, shutting down gracefully");
await jobScheduler.stop();
process.exit(0);
});