fix(core): update

This commit is contained in:
Philipp Kunz 2024-02-02 12:46:59 +01:00
parent da656866a6
commit 2ef8bdb072
10 changed files with 110 additions and 70 deletions

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/interfaces', name: '@serve.zone/interfaces',
version: '1.0.11', version: '1.0.12',
description: 'interfaces for working with containers' description: 'interfaces for working with containers'
} }

View File

@ -1,33 +0,0 @@
import { type IDockerRegistryInfo, type IServiceRessources } from './docker.js';
import type { IServerConfig } from './server.js';
export interface IClusterConfig {
id: string;
name: string;
zone: 'servezone' | 'gitzone' | 'shipzone' | 'umbrellazone' | 'trafficzone' | 'proxyzone';
type: 'cluster';
secretKey: string;
jumpCode: string;
jumpCodeUsedAt: number;
manager_domain: string;
manager_ip: string;
servers: IServerConfig[];
containers: IClusterConfigContainer[];
acmeInfo: {
serverAddress: string;
serverSecret: string;
};
registryInfo: IDockerRegistryInfo;
}
export interface IClusterConfigContainer {
name: string;
image: string;
ports: {
web: number;
custom?: { [domain: string]: string };
};
resources?: IServiceRessources;
domains: string[];
secrets: { [key: string]: string };
}

View File

@ -1,23 +0,0 @@
import { type IDockerRegistryInfo } from './docker.js';
export interface IServerConfig {
type: 'server';
/**
* a list of debian packages to be installed
*/
requiredDebianPackages: string[];
/**
* a list of SSH keys to deploy
*/
sshKeys: IServezoneSshKey[];
dockerRegistryInfo: IDockerRegistryInfo;
}
export interface IServezoneSshKey {
keyName: string;
public: string;
private?: string;
}

View File

@ -1,4 +1,52 @@
import { type IDockerRegistryInfo, type IServiceRessources } from '../data/docker.js';
import type { IServerConfig } from './server.js';
export interface IClusterIdentifier { export interface IClusterIdentifier {
clusterName: string; clusterName: string;
secretKey: string; secretKey: string;
} }
export interface IClusterConfig {
id: string;
data: {
name: string;
secretKey: string;
jumpCode: string;
jumpCodeUsedAt: number;
/**
* how can the cluster reach cloudly
*/
cloudlyUrl: string;
/**
* what servers are expected to be part of the cluster
*/
servers: IServerConfig[];
/**
* the containers running
*/
containers: IClusterConfigContainer[];
/**
*
*/
acmeInfo: {
serverAddress: string;
serverSecret: string;
};
registryInfo: IDockerRegistryInfo;
};
}
export interface IClusterConfigContainer {
name: string;
image: string;
ports: {
web: number;
custom?: { [domain: string]: string };
};
resources?: IServiceRessources;
domains: string[];
secrets: { [key: string]: string };
}

View File

@ -1,7 +1 @@
/* ==========
This file exports all config interfaces for easier access under module.config.[anyconfig]
// ========== */
export * from '../config/cluster.js';
export * from '../config/server.js';
export type TConfigType = 'server' | 'cluster' | 'coreflow' | 'service'; export type TConfigType = 'server' | 'cluster' | 'coreflow' | 'service';

View File

@ -1,8 +1,10 @@
export * from './cluster.js'; export * from './cluster.js';
export * from './config.js'; export * from './config.js';
export * from './docker.js';
export * from './env.js'; export * from './env.js';
export * from './event.js'; export * from './event.js';
export * from './secret.js' export * from './secret.js'
export * from './server.js';
export * from './status.js'; export * from './status.js';
export * from './traffic.js'; export * from './traffic.js';
export * from './version.js'; export * from './version.js';

View File

@ -1,3 +1,5 @@
import { type IDockerRegistryInfo } from './docker.js';
export interface IServerMetrics { export interface IServerMetrics {
serverId: string; serverId: string;
cpuUsageInPercent: number; cpuUsageInPercent: number;
@ -10,4 +12,26 @@ export interface IServerMetrics {
cpuUsageInPercent: number; cpuUsageInPercent: number;
memoryUsageInMB: number; memoryUsageInMB: number;
}>; }>;
} }
export interface IServerConfig {
type: 'server';
/**
* a list of debian packages to be installed
*/
requiredDebianPackages: string[];
/**
* a list of SSH keys to deploy
*/
sshKeys: IServezoneSshKey[];
dockerRegistryInfo: IDockerRegistryInfo;
}
export interface IServezoneSshKey {
keyName: string;
public: string;
private?: string;
}

28
ts/requests/cluster.ts Normal file
View File

@ -0,0 +1,28 @@
import type { IClusterConfig } from '../data/cluster.js';
import * as plugins from '../plugins.js';
export interface IRequest_CreateCluster extends plugins.typedrequestInterfaces.implementsTR<
plugins.typedrequestInterfaces.ITypedRequest,
IRequest_CreateCluster
> {
method: 'createCluster';
request: {
clusterName: string;
};
response: {
clusterConfig: IClusterConfig;
};
}
export interface IRequest_UpdateCluster extends plugins.typedrequestInterfaces.implementsTR<
plugins.typedrequestInterfaces.ITypedRequest,
IRequest_UpdateCluster
> {
method: 'updateCluster';
request: {
clusterConfig: IClusterConfig;
};
response: {
clusterConfig: IClusterConfig;
};
}

View File

@ -1,6 +1,6 @@
import * as plugins from '../plugins.js'; import * as plugins from '../plugins.js';
import * as clusterInterfaces from '../data/cluster.js'; import * as clusterInterfaces from '../data/cluster.js';
import * as configInterfaces from '../data/config.js'; import * as serverInterfaces from '../data/server.js';
export interface IRequest_Any_Cloudly_GetServerConfig export interface IRequest_Any_Cloudly_GetServerConfig
extends plugins.typedrequestInterfaces.implementsTR< extends plugins.typedrequestInterfaces.implementsTR<
@ -12,7 +12,7 @@ extends plugins.typedrequestInterfaces.implementsTR<
clusterIdentifier: clusterInterfaces.IClusterIdentifier; clusterIdentifier: clusterInterfaces.IClusterIdentifier;
}; };
response: { response: {
configData: configInterfaces.IServerConfig; configData: serverInterfaces.IServerConfig;
}; };
} }
@ -26,7 +26,7 @@ extends plugins.typedrequestInterfaces.implementsTR<
clusterIdentifier: clusterInterfaces.IClusterIdentifier; clusterIdentifier: clusterInterfaces.IClusterIdentifier;
}; };
response: { response: {
configData: configInterfaces.IClusterConfig; configData: clusterInterfaces.IClusterConfig;
}; };
} }
@ -37,7 +37,7 @@ extends plugins.typedrequestInterfaces.implementsTR<
> { > {
method: 'pushClusterConfig'; method: 'pushClusterConfig';
request: { request: {
configData: configInterfaces.IClusterConfig; configData: clusterInterfaces.IClusterConfig;
}; };
response: {}; response: {};
} }
@ -49,8 +49,8 @@ extends plugins.typedrequestInterfaces.implementsTR<
> { > {
method: 'pushContainerUpdate' method: 'pushContainerUpdate'
request: { request: {
configData: configInterfaces.IClusterConfig; configData: clusterInterfaces.IClusterConfig;
specificContainerConfigToUpdate: configInterfaces.IClusterConfigContainer; specificContainerConfigToUpdate: clusterInterfaces.IClusterConfigContainer;
}; };
response: {} response: {}
} }