fix(core): Updated dependencies and refactored ClusterManager and CloudlyConnector for improved Docker management.
This commit is contained in:
parent
51903eff5b
commit
4b7bf5fde4
@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2024-12-20 - 1.0.134 - fix(core)
|
||||||
|
Updated dependencies and refactored ClusterManager and CloudlyConnector for improved Docker management.
|
||||||
|
|
||||||
|
- Updated `@push.rocks/tswatch` and `@push.rocks/tapbundle` to latest versions in devDependencies.
|
||||||
|
- Refactored `ClusterManager` to remove unused subscriptions and improve network and service management.
|
||||||
|
- Refactored `CloudlyConnector` to use `CloudlyApiClient` for improved cloud configuration management.
|
||||||
|
- Added logging for network and Docker service configurations.
|
||||||
|
|
||||||
## 2024-11-18 - 1.0.133 - fix(dockerfile)
|
## 2024-11-18 - 1.0.133 - fix(dockerfile)
|
||||||
Update Docker base images to use code.foss.global instead of registry.gitlab.com
|
Update Docker base images to use code.foss.global instead of registry.gitlab.com
|
||||||
|
|
||||||
|
16
package.json
16
package.json
@ -9,6 +9,7 @@
|
|||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"start": "(node --max_old_space_size=500 ./cli.js)",
|
"start": "(node --max_old_space_size=500 ./cli.js)",
|
||||||
"startTs": "(node cli.ts.js)",
|
"startTs": "(node cli.ts.js)",
|
||||||
|
"watch": "(tswatch service)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
@ -55,8 +56,8 @@
|
|||||||
"@git.zone/tsbuild": "^2.2.0",
|
"@git.zone/tsbuild": "^2.2.0",
|
||||||
"@git.zone/tsrun": "^1.3.3",
|
"@git.zone/tsrun": "^1.3.3",
|
||||||
"@git.zone/tstest": "^1.0.90",
|
"@git.zone/tstest": "^1.0.90",
|
||||||
"@git.zone/tswatch": "^2.0.25",
|
"@git.zone/tswatch": "^2.0.37",
|
||||||
"@push.rocks/tapbundle": "^5.5.0"
|
"@push.rocks/tapbundle": "^5.5.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@api.global/typedrequest": "^3.1.10",
|
"@api.global/typedrequest": "^3.1.10",
|
||||||
@ -65,7 +66,7 @@
|
|||||||
"@push.rocks/early": "^4.0.3",
|
"@push.rocks/early": "^4.0.3",
|
||||||
"@push.rocks/lik": "^6.1.0",
|
"@push.rocks/lik": "^6.1.0",
|
||||||
"@push.rocks/projectinfo": "^5.0.1",
|
"@push.rocks/projectinfo": "^5.0.1",
|
||||||
"@push.rocks/qenv": "^6.0.5",
|
"@push.rocks/qenv": "^6.1.0",
|
||||||
"@push.rocks/smartcli": "^4.0.11",
|
"@push.rocks/smartcli": "^4.0.11",
|
||||||
"@push.rocks/smartdelay": "^3.0.1",
|
"@push.rocks/smartdelay": "^3.0.1",
|
||||||
"@push.rocks/smartlog": "^3.0.7",
|
"@push.rocks/smartlog": "^3.0.7",
|
||||||
@ -75,12 +76,13 @@
|
|||||||
"@push.rocks/smartrequest": "^2.0.23",
|
"@push.rocks/smartrequest": "^2.0.23",
|
||||||
"@push.rocks/smartrx": "^3.0.2",
|
"@push.rocks/smartrx": "^3.0.2",
|
||||||
"@push.rocks/smartstate": "^2.0.19",
|
"@push.rocks/smartstate": "^2.0.19",
|
||||||
|
"@push.rocks/smartstream": "^3.2.5",
|
||||||
"@push.rocks/smartstring": "^4.0.15",
|
"@push.rocks/smartstring": "^4.0.15",
|
||||||
"@push.rocks/taskbuffer": "^3.0.10",
|
"@push.rocks/taskbuffer": "^3.0.10",
|
||||||
"@serve.zone/api": "^4.3.11",
|
"@serve.zone/api": "^4.5.1",
|
||||||
"@serve.zone/interfaces": "^4.3.11",
|
"@serve.zone/interfaces": "^4.5.1",
|
||||||
"@tsclass/tsclass": "^4.1.2",
|
"@tsclass/tsclass": "^4.2.0",
|
||||||
"@types/node": "22.9.0"
|
"@types/node": "22.10.2"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"files": [
|
"files": [
|
||||||
|
3196
pnpm-lock.yaml
generated
3196
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/coreflow',
|
name: '@serve.zone/coreflow',
|
||||||
version: '1.0.133',
|
version: '1.0.134',
|
||||||
description: 'A comprehensive tool for managing Docker-based applications and services, enabling efficient scaling, network management, and integration with cloud services.'
|
description: 'A comprehensive tool for managing Docker-based applications and services, enabling efficient scaling, network management, and integration with cloud services.'
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import { Coreflow } from './coreflow.classes.coreflow.js';
|
|||||||
|
|
||||||
export class ClusterManager {
|
export class ClusterManager {
|
||||||
public coreflowRef: Coreflow;
|
public coreflowRef: Coreflow;
|
||||||
public dockerHost: plugins.docker.DockerHost;
|
|
||||||
public configSubscription: plugins.smartrx.rxjs.Subscription;
|
public configSubscription: plugins.smartrx.rxjs.Subscription;
|
||||||
public containerSubscription: plugins.smartrx.rxjs.Subscription;
|
public containerSubscription: plugins.smartrx.rxjs.Subscription;
|
||||||
public containerVersionSubscription: plugins.smartrx.rxjs.Subscription;
|
public containerVersionSubscription: plugins.smartrx.rxjs.Subscription;
|
||||||
@ -20,7 +19,6 @@ export class ClusterManager {
|
|||||||
|
|
||||||
constructor(coreflowRefArg: Coreflow) {
|
constructor(coreflowRefArg: Coreflow) {
|
||||||
this.coreflowRef = coreflowRefArg;
|
this.coreflowRef = coreflowRefArg;
|
||||||
this.dockerHost = new plugins.docker.DockerHost();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,27 +29,13 @@ export class ClusterManager {
|
|||||||
this.readyDeferred.resolve();
|
this.readyDeferred.resolve();
|
||||||
|
|
||||||
// subscriptions
|
// subscriptions
|
||||||
|
// this subscription is the start point for most updates on the cluster
|
||||||
this.configSubscription =
|
this.configSubscription =
|
||||||
this.coreflowRef.cloudlyConnector.cloudlyClient.configUpdateSubject.subscribe(
|
this.coreflowRef.cloudlyConnector.cloudlyApiClient.configUpdateSubject.subscribe(
|
||||||
async (dataArg) => {
|
async (dataArg) => {
|
||||||
this.coreflowRef.taskManager.updateBaseServicesTask.trigger();
|
this.coreflowRef.taskManager.updateBaseServicesTask.trigger();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.containerSubscription =
|
|
||||||
this.coreflowRef.cloudlyConnector.cloudlyClient.containerUpdateSubject.subscribe(
|
|
||||||
async (dataArg) => {
|
|
||||||
this.coreflowRef.taskManager.updateBaseServicesTask.trigger();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this.containerVersionSubscription =
|
|
||||||
this.coreflowRef.cloudlyConnector.cloudlyClient.containerVersionUpdateSubject.subscribe(
|
|
||||||
async (dataArg) => {
|
|
||||||
console.log(
|
|
||||||
`Got a container version update trigger for ${dataArg.dockerImageUrl}@${dataArg.dockerImageVersion}`
|
|
||||||
);
|
|
||||||
this.coreflowRef.taskManager.updateBaseServicesTask.trigger();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,27 +51,34 @@ export class ClusterManager {
|
|||||||
public async provisionBaseServices() {
|
public async provisionBaseServices() {
|
||||||
// swarm should be enabled by lower level serverconfig package
|
// swarm should be enabled by lower level serverconfig package
|
||||||
// get current situation
|
// get current situation
|
||||||
const networks = await this.dockerHost.getNetworks();
|
const networks = await this.coreflowRef.dockerHost.getNetworks();
|
||||||
|
logger.log('info', 'There are currently ' + networks.length + ' networks');
|
||||||
|
for (const network of networks) {
|
||||||
|
logger.log('info', 'Network: ' + network.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure there is a network for the webgateway
|
||||||
let sznWebgatewayNetwork = await plugins.docker.DockerNetwork.getNetworkByName(
|
let sznWebgatewayNetwork = await plugins.docker.DockerNetwork.getNetworkByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
this.commonDockerData.networkNames.sznWebgateway
|
this.commonDockerData.networkNames.sznWebgateway
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!sznWebgatewayNetwork) {
|
if (!sznWebgatewayNetwork) {
|
||||||
sznWebgatewayNetwork = await plugins.docker.DockerNetwork.createNetwork(this.dockerHost, {
|
logger.log('info', 'Creating network: ' + this.commonDockerData.networkNames.sznWebgateway);
|
||||||
|
sznWebgatewayNetwork = await plugins.docker.DockerNetwork.createNetwork(this.coreflowRef.dockerHost, {
|
||||||
Name: this.commonDockerData.networkNames.sznWebgateway,
|
Name: this.commonDockerData.networkNames.sznWebgateway,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
logger.log('ok', 'sznWebgateway is already present');
|
logger.log('ok', 'sznWebgateway is already present');
|
||||||
}
|
}
|
||||||
|
|
||||||
// corechat network
|
// corechat network so base services can talk to each other
|
||||||
let sznCorechatNetwork = await plugins.docker.DockerNetwork.getNetworkByName(
|
let sznCorechatNetwork = await plugins.docker.DockerNetwork.getNetworkByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
this.commonDockerData.networkNames.sznCorechat
|
this.commonDockerData.networkNames.sznCorechat
|
||||||
);
|
);
|
||||||
if (!sznCorechatNetwork) {
|
if (!sznCorechatNetwork) {
|
||||||
sznCorechatNetwork = await plugins.docker.DockerNetwork.createNetwork(this.dockerHost, {
|
sznCorechatNetwork = await plugins.docker.DockerNetwork.createNetwork(this.coreflowRef.dockerHost, {
|
||||||
Name: this.commonDockerData.networkNames.sznCorechat,
|
Name: this.commonDockerData.networkNames.sznCorechat,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -102,12 +93,16 @@ export class ClusterManager {
|
|||||||
// Images
|
// Images
|
||||||
logger.log('info', `now updating docker images of base services...`);
|
logger.log('info', `now updating docker images of base services...`);
|
||||||
|
|
||||||
const coretrafficImage = await plugins.docker.DockerImage.createFromRegistry(this.dockerHost, {
|
const coretrafficImage = await plugins.docker.DockerImage.createFromRegistry(this.coreflowRef.dockerHost, {
|
||||||
imageUrl: 'registry.gitlab.com/losslessone/services/servezone/coretraffic',
|
creationObject: {
|
||||||
|
imageUrl: 'code.foss.global/serve.zone/coretraffic',
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const corelogImage = await plugins.docker.DockerImage.createFromRegistry(this.dockerHost, {
|
const corelogImage = await plugins.docker.DockerImage.createFromRegistry(this.coreflowRef.dockerHost, {
|
||||||
imageUrl: 'registry.gitlab.com/losslessone/services/servezone/corelog',
|
creationObject: {
|
||||||
|
imageUrl: 'code.foss.global/serve.zone/corelog',
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// SERVICES
|
// SERVICES
|
||||||
@ -115,7 +110,7 @@ export class ClusterManager {
|
|||||||
// coretraffic
|
// coretraffic
|
||||||
let coretrafficService: plugins.docker.DockerService;
|
let coretrafficService: plugins.docker.DockerService;
|
||||||
coretrafficService = await plugins.docker.DockerService.getServiceByName(
|
coretrafficService = await plugins.docker.DockerService.getServiceByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
'coretraffic'
|
'coretraffic'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -128,7 +123,7 @@ export class ClusterManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!coretrafficService) {
|
if (!coretrafficService) {
|
||||||
coretrafficService = await plugins.docker.DockerService.createService(this.dockerHost, {
|
coretrafficService = await plugins.docker.DockerService.createService(this.coreflowRef.dockerHost, {
|
||||||
image: coretrafficImage,
|
image: coretrafficImage,
|
||||||
labels: {},
|
labels: {},
|
||||||
name: 'coretraffic',
|
name: 'coretraffic',
|
||||||
@ -150,7 +145,7 @@ export class ClusterManager {
|
|||||||
// corelog
|
// corelog
|
||||||
let corelogService: plugins.docker.DockerService;
|
let corelogService: plugins.docker.DockerService;
|
||||||
corelogService = await plugins.docker.DockerService.getServiceByName(
|
corelogService = await plugins.docker.DockerService.getServiceByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
'corelog'
|
'corelog'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -162,7 +157,7 @@ export class ClusterManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!corelogService) {
|
if (!corelogService) {
|
||||||
corelogService = await plugins.docker.DockerService.createService(this.dockerHost, {
|
corelogService = await plugins.docker.DockerService.createService(this.coreflowRef.dockerHost, {
|
||||||
image: corelogImage,
|
image: corelogImage,
|
||||||
labels: {},
|
labels: {},
|
||||||
name: 'corelog',
|
name: 'corelog',
|
||||||
@ -182,40 +177,39 @@ export class ClusterManager {
|
|||||||
await plugins.smartdelay.delayFor(10000);
|
await plugins.smartdelay.delayFor(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public async provisionWorkloadService(
|
||||||
* provision services obtained from cloudly
|
serviceArg: plugins.servezoneInterfaces.data.IService
|
||||||
*/
|
|
||||||
public async provisionWorkloadServices(configData: plugins.servezoneInterfaces.data.ICluster) {
|
|
||||||
// lets get the config + deploymentDirectives
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (const containerConfig of configData.data.containers) {
|
|
||||||
await this.provisionSpecificWorkloadService(containerConfig);
|
|
||||||
}
|
|
||||||
logger.log('ok', 'Waiting for scheduled workload services to settle');
|
|
||||||
await plugins.smartdelay.delayFor(10000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async provisionSpecificWorkloadService(
|
|
||||||
containerConfigArg: plugins.servezoneInterfaces.data.IClusterConfigContainer
|
|
||||||
) {
|
) {
|
||||||
const containerImage = await plugins.docker.DockerImage.createFromRegistry(this.dockerHost, {
|
logger.log('info', `deploying service ${serviceArg.data.name}@${serviceArg.data.imageVersion}...`);
|
||||||
imageUrl: containerConfigArg.image,
|
|
||||||
|
// get the image from cloudly
|
||||||
|
logger.log('info', `getting image for ${serviceArg.data.name}@${serviceArg.data.imageVersion}`);
|
||||||
|
const containerImage = await this.coreflowRef.cloudlyConnector.cloudlyApiClient.images.getImageById(serviceArg.data.imageId);
|
||||||
|
const imageStream = await containerImage.pullImageVersion(serviceArg.data.imageVersion);
|
||||||
|
await plugins.docker.DockerImage.createFromTarStream(this.coreflowRef.dockerHost, {
|
||||||
|
creationObject: {
|
||||||
|
imageUrl: containerImage.id,
|
||||||
|
imageTag: serviceArg.data.imageVersion,
|
||||||
|
},
|
||||||
|
tarStream: plugins.smartstream.nodewebhelpers.convertWebReadableToNodeReadable(imageStream)
|
||||||
});
|
});
|
||||||
|
|
||||||
let containerService = await plugins.docker.DockerService.getServiceByName(
|
let containerService = await plugins.docker.DockerService.getServiceByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
containerConfigArg.name
|
serviceArg.data.name
|
||||||
);
|
);
|
||||||
|
const secretBundleId = serviceArg.data.secretBundleId;
|
||||||
|
this.coreflowRef.cloudlyConnector.cloudlyApiClient;
|
||||||
|
|
||||||
|
const dockerSecretName = `${serviceArg.id}_${serviceArg.data.name}_Secret`;
|
||||||
let containerSecret = await plugins.docker.DockerSecret.getSecretByName(
|
let containerSecret = await plugins.docker.DockerSecret.getSecretByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
`${containerConfigArg.name}Secret`
|
dockerSecretName
|
||||||
);
|
);
|
||||||
|
|
||||||
// existing network to connect to
|
// existing network to connect to
|
||||||
const webGatewayNetwork = await plugins.docker.DockerNetwork.getNetworkByName(
|
const webGatewayNetwork = await plugins.docker.DockerNetwork.getNetworkByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
this.commonDockerData.networkNames.sznWebgateway
|
this.commonDockerData.networkNames.sznWebgateway
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -230,27 +224,30 @@ export class ClusterManager {
|
|||||||
|
|
||||||
if (!containerService) {
|
if (!containerService) {
|
||||||
containerSecret = await plugins.docker.DockerSecret.getSecretByName(
|
containerSecret = await plugins.docker.DockerSecret.getSecretByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
`${containerConfigArg.name}Secret`
|
dockerSecretName
|
||||||
);
|
);
|
||||||
if (containerSecret) {
|
if (containerSecret) {
|
||||||
await containerSecret.remove();
|
await containerSecret.remove();
|
||||||
}
|
}
|
||||||
containerSecret = await plugins.docker.DockerSecret.createSecret(this.dockerHost, {
|
|
||||||
name: `${containerConfigArg.name}Secret`,
|
const secretBundle: plugins.servezoneInterfaces.data.ISecretBundle =this.coreflowRef.cloudlyConnector.cloudlyApiClient.;
|
||||||
contentArg: JSON.stringify(containerConfigArg.secrets),
|
|
||||||
|
containerSecret = await plugins.docker.DockerSecret.createSecret(this.coreflowRef.dockerHost, {
|
||||||
|
name: dockerSecretName,
|
||||||
|
contentArg: JSON.stringify(secretBundle.data.),
|
||||||
labels: {},
|
labels: {},
|
||||||
version: await containerImage.getVersion(),
|
version: await containerImage.getVersion(),
|
||||||
});
|
});
|
||||||
containerService = await plugins.docker.DockerService.createService(this.dockerHost, {
|
containerService = await plugins.docker.DockerService.createService(this.coreflowRef.dockerHost, {
|
||||||
name: containerConfigArg.name,
|
name: deploymentDirectiveArg.name,
|
||||||
image: containerImage,
|
image: containerImage,
|
||||||
networks: [webGatewayNetwork],
|
networks: [webGatewayNetwork],
|
||||||
secrets: [containerSecret],
|
secrets: [containerSecret],
|
||||||
ports: [],
|
ports: [],
|
||||||
labels: {},
|
labels: {},
|
||||||
resources: containerConfigArg.resources,
|
resources: deploymentDirectiveArg.resources,
|
||||||
networkAlias: containerConfigArg.name,
|
networkAlias: deploymentDirectiveArg.name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,9 +256,9 @@ export class ClusterManager {
|
|||||||
* update traffic routing
|
* update traffic routing
|
||||||
*/
|
*/
|
||||||
public async updateTrafficRouting(clusterConfigArg: plugins.servezoneInterfaces.data.IClusterConfig) {
|
public async updateTrafficRouting(clusterConfigArg: plugins.servezoneInterfaces.data.IClusterConfig) {
|
||||||
const services = await this.dockerHost.getServices();
|
const services = await this.coreflowRef.dockerHost.getServices();
|
||||||
const webGatewayNetwork = await plugins.docker.DockerNetwork.getNetworkByName(
|
const webGatewayNetwork = await plugins.docker.DockerNetwork.getNetworkByName(
|
||||||
this.dockerHost,
|
this.coreflowRef.dockerHost,
|
||||||
this.commonDockerData.networkNames.sznWebgateway
|
this.commonDockerData.networkNames.sznWebgateway
|
||||||
);
|
);
|
||||||
const reverseProxyConfigs: plugins.servezoneInterfaces.data.IReverseProxyConfig[] = [];
|
const reverseProxyConfigs: plugins.servezoneInterfaces.data.IReverseProxyConfig[] = [];
|
||||||
|
@ -22,7 +22,7 @@ export class Coreflow {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.serviceQenv = new plugins.qenv.Qenv('./', './.nogit');
|
this.serviceQenv = new plugins.qenv.Qenv('./', './.nogit');
|
||||||
this.dockerHost = new plugins.docker.DockerHost(); // defaults to locally mounted docker sock
|
this.dockerHost = new plugins.docker.DockerHost({}); // defaults to locally mounted docker sock
|
||||||
this.internalServer = new InternalServer(this);
|
this.internalServer = new InternalServer(this);
|
||||||
this.cloudlyConnector = new CloudlyConnector(this);
|
this.cloudlyConnector = new CloudlyConnector(this);
|
||||||
this.corechatConnector = new CoretrafficConnector(this);
|
this.corechatConnector = new CoretrafficConnector(this);
|
||||||
|
@ -7,47 +7,48 @@ import { Coreflow } from './coreflow.classes.coreflow.js';
|
|||||||
|
|
||||||
export class CloudlyConnector {
|
export class CloudlyConnector {
|
||||||
public coreflowRef: Coreflow;
|
public coreflowRef: Coreflow;
|
||||||
public cloudlyClient: plugins.servezoneApi.CloudlyClient;
|
public cloudlyApiClient: plugins.servezoneApi.CloudlyApiClient;
|
||||||
public coreflowJumpCode: string;
|
public coreflowJumpCode: string;
|
||||||
public identity: plugins.servezoneInterfaces.data.IClusterIdentifier;
|
public identity: plugins.servezoneInterfaces.data.IIdentity;
|
||||||
|
|
||||||
constructor(coreflowRefArg: Coreflow) {
|
constructor(coreflowRefArg: Coreflow) {
|
||||||
this.coreflowRef = coreflowRefArg;
|
this.coreflowRef = coreflowRefArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async start() {
|
public async start() {
|
||||||
this.cloudlyClient = new plugins.servezoneApi.CloudlyClient('coreflow');
|
this.cloudlyApiClient = new plugins.servezoneApi.CloudlyApiClient({
|
||||||
await this.cloudlyClient.start();
|
registerAs: 'coreflow',
|
||||||
|
cloudlyUrl: await this.coreflowRef.serviceQenv.getEnvVarOnDemand('CLOUDLY_URL')
|
||||||
|
});
|
||||||
|
await this.cloudlyApiClient.start();
|
||||||
this.coreflowJumpCode = await this.coreflowRef.serviceQenv.getEnvVarOnDemand('JUMPCODE');
|
this.coreflowJumpCode = await this.coreflowRef.serviceQenv.getEnvVarOnDemand('JUMPCODE');
|
||||||
|
|
||||||
// get identity and tag connection (second parameter is true -> tags the connection)
|
// get identity and tag connection (second parameter is true -> tags the connection)
|
||||||
this.identity = await this.cloudlyClient.getIdentityByJumpCode(this.coreflowJumpCode, true);
|
this.identity = await this.cloudlyApiClient.getIdentityByToken(this.coreflowJumpCode, {
|
||||||
|
statefullIdentity: true,
|
||||||
|
tagConnection: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async stop() {
|
public async stop() {
|
||||||
await this.cloudlyClient.stop();
|
await this.cloudlyApiClient.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getConfigFromCloudly(): Promise<plugins.servezoneInterfaces.data.IClusterConfig> {
|
public async getConfigFromCloudly(): Promise<plugins.servezoneInterfaces.data.ICluster> {
|
||||||
const config = await this.cloudlyClient.getClusterConfigFromCloudlyByIdentity(
|
const config = await this.cloudlyApiClient.getClusterConfigFromCloudlyByIdentity(
|
||||||
this.identity
|
this.identity
|
||||||
);
|
);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async triggerConfigEvent() {
|
|
||||||
const config = await this.getConfigFromCloudly();
|
|
||||||
this.cloudlyClient.configUpdateSubject.next({
|
|
||||||
configData: config,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public async getCertificateForDomainFromCloudly(
|
public async getCertificateForDomainFromCloudly(
|
||||||
domainNameArg: string
|
domainNameArg: string
|
||||||
): Promise<plugins.tsclass.network.ICert> {
|
): Promise<plugins.tsclass.network.ICert> {
|
||||||
const certificate = await this.cloudlyClient.getCertificateForDomainOverHttps(
|
const certificate = await this.cloudlyApiClient.getCertificateForDomain({
|
||||||
domainNameArg
|
identity: this.identity,
|
||||||
);
|
domainName: domainNameArg,
|
||||||
|
type: 'ssl',
|
||||||
|
});
|
||||||
return certificate;
|
return certificate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import * as smartpromise from '@push.rocks/smartpromise';
|
|||||||
import * as smartrequest from '@push.rocks/smartrequest';
|
import * as smartrequest from '@push.rocks/smartrequest';
|
||||||
import * as smartrx from '@push.rocks/smartrx';
|
import * as smartrx from '@push.rocks/smartrx';
|
||||||
import * as smartstate from '@push.rocks/smartstate';
|
import * as smartstate from '@push.rocks/smartstate';
|
||||||
|
import * as smartstream from '@push.rocks/smartstream';
|
||||||
import * as smartstring from '@push.rocks/smartstring';
|
import * as smartstring from '@push.rocks/smartstring';
|
||||||
import * as taskbuffer from '@push.rocks/taskbuffer';
|
import * as taskbuffer from '@push.rocks/taskbuffer';
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ export {
|
|||||||
smartrequest,
|
smartrequest,
|
||||||
smartrx,
|
smartrx,
|
||||||
smartstate,
|
smartstate,
|
||||||
|
smartstream,
|
||||||
smartstring,
|
smartstring,
|
||||||
taskbuffer,
|
taskbuffer,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user