mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-11 21:41:41 +02:00
Wire up to start
This commit is contained in:
@@ -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.
|
||||||
|
}
|
||||||
@@ -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
@@ -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>,
|
||||||
|
|||||||
@@ -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";
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user