chore: update cloudly dependency stack

Align Cloudly with the current typedserver, smartconfig, smartstate, and Docker tooling releases so builds and Docker output stay compatible with the upgraded stack.
This commit is contained in:
2026-05-08 13:56:20 +00:00
parent 80226c8a1c
commit f40ef6b7c0
75 changed files with 4003 additions and 6406 deletions
+30 -48
View File
@@ -11,13 +11,13 @@ export class CloudlyServer {
* a reference to the cloudly instance
*/
public cloudlyRef: Cloudly;
public additionalHandlers: plugins.typedserver.servertools.Handler[] = [];
public additionalHandlers: plugins.typedserver.IRouteHandler[] = [];
/**
* the smartexpress server handling the actual requests
*/
public typedServer: plugins.typedserver.TypedServer;
public typedsocketServer: plugins.typedsocket.TypedSocket;
public typedServer!: plugins.typedserver.TypedServer;
public typedsocketServer!: plugins.typedsocket.TypedSocket;
/**
* typedrouter
@@ -39,13 +39,13 @@ export class CloudlyServer {
*/
public async start() {
logger.log('info', `cloudly domain is ${this.cloudlyRef.config.data.publicUrl}`);
let sslCert: plugins.smartacme.Cert;
let sslCert: plugins.smartacme.Cert | undefined;
if (this.cloudlyRef.config.data.sslMode === 'letsencrypt') {
logger.log('info', `Using letsencrypt for ssl mode. Trying to obtain a certificate...`);
logger.log('info', `This might take 10 minutes...`);
sslCert = await this.cloudlyRef.letsencryptConnector.getCertificateForDomain(
this.cloudlyRef.config.data.publicUrl,
this.cloudlyRef.config.data.publicUrl!,
);
logger.log(
'success',
@@ -58,23 +58,6 @@ export class CloudlyServer {
);
}
interface IRequestGuardData {
req: plugins.typedserver.Request;
res: plugins.typedserver.Response;
}
// guards
const guardIp = new plugins.smartguard.Guard<IRequestGuardData>(async (dataArg) => {
if (true) {
return true;
} else {
dataArg.res.status(500);
dataArg.res.send(`Not allowed to perform this operation!`);
dataArg.res.end();
return false;
}
});
// server
this.typedServer = new plugins.typedserver.TypedServer({
cors: true,
@@ -89,43 +72,42 @@ export class CloudlyServer {
injectReload: true,
serveDir: paths.distServeDir,
watch: true,
enableCompression: true,
preferredCompressionMethod: 'gzip',
compression: {
enabled: true,
algorithms: ['gzip'],
},
});
this.typedsocketServer = this.typedServer.typedsocket;
this.typedServer.typedrouter.addTypedRouter(this.typedrouter);
this.typedServer.server.addRoute(
this.typedServer.addRoute(
'/v2',
new plugins.typedserver.servertools.Handler('ALL', async (req, res) => {
await this.cloudlyRef.registryManager.handleHttpRequest(req, res);
}),
'ALL',
async (ctx) => this.cloudlyRef.registryManager.handleHttpRequest(ctx),
);
this.typedServer.server.addRoute(
'/v2/{*splat}',
new plugins.typedserver.servertools.Handler('ALL', async (req, res) => {
await this.cloudlyRef.registryManager.handleHttpRequest(req, res);
}),
this.typedServer.addRoute(
'/v2/*',
'ALL',
async (ctx) => this.cloudlyRef.registryManager.handleHttpRequest(ctx),
);
this.typedServer.server.addRoute(
this.typedServer.addRoute(
'/curlfresh/:scriptname',
this.cloudlyRef.nodeManager.curlfreshInstance.handler,
'ALL',
async (ctx) => this.cloudlyRef.nodeManager.curlfreshInstance.handleRequest(ctx),
);
this.typedServer.server.addRoute(
this.typedServer.addRoute(
'/baseos/v1/nodes/register',
new plugins.typedserver.servertools.Handler('POST', async (req, res) => {
await this.cloudlyRef.baseOsManager.handleRegisterHttpRequest(req, res);
}),
'POST',
async (ctx) => this.cloudlyRef.baseOsManager.handleRegisterHttpRequest(ctx),
);
this.typedServer.server.addRoute(
this.typedServer.addRoute(
'/baseos/v1/nodes/heartbeat',
new plugins.typedserver.servertools.Handler('POST', async (req, res) => {
await this.cloudlyRef.baseOsManager.handleHeartbeatHttpRequest(req, res);
}),
'POST',
async (ctx) => this.cloudlyRef.baseOsManager.handleHeartbeatHttpRequest(ctx),
);
this.typedServer.server.addRoute(
this.typedServer.addRoute(
'/baseos/v1/images/:buildId/download',
new plugins.typedserver.servertools.Handler('GET', async (req, res) => {
await this.cloudlyRef.baseOsManager.handleImageDownloadHttpRequest(req, res);
}),
'GET',
async (ctx) => this.cloudlyRef.baseOsManager.handleImageDownloadHttpRequest(ctx),
);
await this.typedServer.start();
}
@@ -134,6 +116,6 @@ export class CloudlyServer {
* stop the reception instance
*/
public async stop() {
await this.typedServer.stop();
await this.typedServer?.stop();
}
}