diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 30dd5f4..3755400 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/interfaces', - version: '1.0.11', + version: '1.0.12', description: 'interfaces for working with containers' } diff --git a/ts/config/cluster.ts b/ts/config/cluster.ts deleted file mode 100644 index 0dc5d3d..0000000 --- a/ts/config/cluster.ts +++ /dev/null @@ -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 }; -} diff --git a/ts/config/server.ts b/ts/config/server.ts deleted file mode 100644 index eacc310..0000000 --- a/ts/config/server.ts +++ /dev/null @@ -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; -} diff --git a/ts/data/cluster.ts b/ts/data/cluster.ts index 3facaf6..36b609d 100644 --- a/ts/data/cluster.ts +++ b/ts/data/cluster.ts @@ -1,4 +1,52 @@ +import { type IDockerRegistryInfo, type IServiceRessources } from '../data/docker.js'; +import type { IServerConfig } from './server.js'; + export interface IClusterIdentifier { clusterName: 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 }; +} diff --git a/ts/data/config.ts b/ts/data/config.ts index 5c49a8b..5806ab1 100644 --- a/ts/data/config.ts +++ b/ts/data/config.ts @@ -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'; diff --git a/ts/config/docker.ts b/ts/data/docker.ts similarity index 100% rename from ts/config/docker.ts rename to ts/data/docker.ts diff --git a/ts/data/index.ts b/ts/data/index.ts index 51d0ee7..2245d52 100644 --- a/ts/data/index.ts +++ b/ts/data/index.ts @@ -1,8 +1,10 @@ export * from './cluster.js'; export * from './config.js'; +export * from './docker.js'; export * from './env.js'; export * from './event.js'; export * from './secret.js' +export * from './server.js'; export * from './status.js'; export * from './traffic.js'; export * from './version.js'; diff --git a/ts/data/server.ts b/ts/data/server.ts index 8f6d5d0..7bf96b4 100644 --- a/ts/data/server.ts +++ b/ts/data/server.ts @@ -1,3 +1,5 @@ +import { type IDockerRegistryInfo } from './docker.js'; + export interface IServerMetrics { serverId: string; cpuUsageInPercent: number; @@ -10,4 +12,26 @@ export interface IServerMetrics { cpuUsageInPercent: number; memoryUsageInMB: number; }>; -} \ No newline at end of file +} + +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; +} diff --git a/ts/requests/cluster.ts b/ts/requests/cluster.ts new file mode 100644 index 0000000..b9382f9 --- /dev/null +++ b/ts/requests/cluster.ts @@ -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; + }; +} \ No newline at end of file diff --git a/ts/requests/config.ts b/ts/requests/config.ts index b3f9d18..e8e58ae 100644 --- a/ts/requests/config.ts +++ b/ts/requests/config.ts @@ -1,6 +1,6 @@ import * as plugins from '../plugins.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 extends plugins.typedrequestInterfaces.implementsTR< @@ -12,7 +12,7 @@ extends plugins.typedrequestInterfaces.implementsTR< clusterIdentifier: clusterInterfaces.IClusterIdentifier; }; response: { - configData: configInterfaces.IServerConfig; + configData: serverInterfaces.IServerConfig; }; } @@ -26,7 +26,7 @@ extends plugins.typedrequestInterfaces.implementsTR< clusterIdentifier: clusterInterfaces.IClusterIdentifier; }; response: { - configData: configInterfaces.IClusterConfig; + configData: clusterInterfaces.IClusterConfig; }; } @@ -37,7 +37,7 @@ extends plugins.typedrequestInterfaces.implementsTR< > { method: 'pushClusterConfig'; request: { - configData: configInterfaces.IClusterConfig; + configData: clusterInterfaces.IClusterConfig; }; response: {}; } @@ -49,8 +49,8 @@ extends plugins.typedrequestInterfaces.implementsTR< > { method: 'pushContainerUpdate' request: { - configData: configInterfaces.IClusterConfig; - specificContainerConfigToUpdate: configInterfaces.IClusterConfigContainer; + configData: clusterInterfaces.IClusterConfig; + specificContainerConfigToUpdate: clusterInterfaces.IClusterConfigContainer; }; response: {} }