underpost 2.85.0 → 2.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,18 +28,9 @@ jobs:
28
28
  script: |
29
29
  set -e
30
30
  echo "Starting remote release deploy"
31
- cd /home/dd/engine
32
- npm install -g underpost
33
- underpost run secret
34
31
  underpost run pull
32
+ underpost run git-conf
35
33
  underpost run secret
36
- node bin run git-conf
37
- node bin run template-deploy-image
38
- underpost config set GITHUB_USERNAME underpostnet
39
- mkdir -p /home/dd
40
- sudo rm -rf /home/dd/engine
41
- cd /home/dd
42
- underpost clone underpostnet/engine
43
- cd engine
44
- npm install
45
- node bin run ssh-deploy sync-engine-test
34
+ cd /home/dd/engine
35
+ underpost run template-deploy-image
36
+ underpost run ssh-deploy sync-engine-test
package/Dockerfile CHANGED
@@ -34,7 +34,9 @@ RUN npm --version
34
34
  RUN npm install -g underpost
35
35
  RUN underpost --version
36
36
 
37
- # Set working directory
37
+ # Create working directory
38
+ RUN mkdir /home/dd
39
+ VOLUME /home/dd
38
40
  WORKDIR /home/dd
39
41
 
40
42
  # Expose necessary ports
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  <!-- badges -->
20
20
 
21
- [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.85.0)](https://socket.dev/npm/package/underpost/overview/2.85.0) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
21
+ [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.85.1)](https://socket.dev/npm/package/underpost/overview/2.85.1) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
22
22
 
23
23
  <!-- end-badges -->
24
24
 
@@ -66,7 +66,7 @@ Run dev client server
66
66
  npm run dev
67
67
  ```
68
68
  <!-- -->
69
- ## underpost ci/cd cli v2.85.0
69
+ ## underpost ci/cd cli v2.85.1
70
70
 
71
71
  ### Usage: `underpost [options] [command]`
72
72
  ```
package/bin/zed.js CHANGED
@@ -1,11 +1,14 @@
1
1
  import { shellExec } from '../src/server/process.js';
2
2
  import fs from 'fs-extra';
3
3
  import { loggerFactory } from '../src/server/logger.js';
4
+ import { getUnderpostRootPath } from '../src/server/conf.js';
4
5
 
5
6
  const logger = loggerFactory(import.meta);
7
+ const underpostRoot = getUnderpostRootPath();
6
8
 
7
- fs.copyFileSync(`./.vscode/zed.settings.json`, `/root/.config/zed/settings.json`);
8
- fs.copyFileSync(`./.vscode/zed.keymap.json`, `/root/.config/zed/keymap.json`);
9
+ if (!fs.existsSync('/root/.config/zed')) fs.mkdirSync('/root/.config/zed', { recursive: true });
10
+ fs.copyFileSync(`${underpostRoot}/.vscode/zed.settings.json`, `/root/.config/zed/settings.json`);
11
+ fs.copyFileSync(`${underpostRoot}/.vscode/zed.keymap.json`, `/root/.config/zed/keymap.json`);
9
12
 
10
13
  shellExec(`ZED_ALLOW_ROOT=true zed ${process.argv[2] ? process.argv[2] : '.'}`);
11
14
 
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.85.0
1
+ ## underpost ci/cd cli v2.85.1
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -623,7 +623,7 @@ Options:
623
623
  Runs a script from the specified path.
624
624
 
625
625
  Arguments:
626
- runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, underpost-config, gpu-env, tf-gpu-test, dev-cluster, ssh-cluster-info, dev-hosts-expose, dev-hosts-restore, cyberia-ide, engine-ide, cluster-build, template-deploy, template-deploy-image, clean, pull, release-deploy, ssh-deploy, ide, sync, ls-deployments, host-update, monitor, db-client, git-conf, promote, metrics, cluster, deploy, sync-replica, tf-vae-test, deploy-job.
626
+ runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, underpost-config, gpu-env, tf-gpu-test, dev-cluster, ssh-cluster-info, dev-hosts-expose, dev-hosts-restore, cyberia-ide, engine-ide, cluster-build, template-deploy, template-deploy-image, clean, pull, release-deploy, ssh-deploy, ide, sync, ls-deployments, host-update, dev-container, monitor, db-client, git-conf, promote, metrics, cluster, deploy, service, sync-replica, tf-vae-test, deploy-job.
627
627
  path The absolute or relative directory path where the script is located.
628
628
 
629
629
  Options:
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: localhost/rockylinux9-underpost:v2.85.0
20
+ image: localhost/rockylinux9-underpost:v2.85.1
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "124Ki"
@@ -100,7 +100,7 @@ spec:
100
100
  spec:
101
101
  containers:
102
102
  - name: dd-default-development-green
103
- image: localhost/rockylinux9-underpost:v2.85.0
103
+ image: localhost/rockylinux9-underpost:v2.85.1
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-test-development-blue
20
- image: localhost/rockylinux9-underpost:v2.85.0
20
+ image: localhost/rockylinux9-underpost:v2.85.1
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "96294Ki"
@@ -104,7 +104,7 @@ spec:
104
104
  spec:
105
105
  containers:
106
106
  - name: dd-test-development-green
107
- image: localhost/rockylinux9-underpost:v2.85.0
107
+ image: localhost/rockylinux9-underpost:v2.85.1
108
108
  # resources:
109
109
  # requests:
110
110
  # memory: "96294Ki"
@@ -30,6 +30,8 @@ spec:
30
30
  # secretKeyRef:
31
31
  # name: mongodb-secret
32
32
  # key: password
33
+ - name: ME_CONFIG_SITE_BASEURL
34
+ value: '/mongo/'
33
35
  - name: ME_CONFIG_BASICAUTH_USERNAME
34
36
  valueFrom:
35
37
  secretKeyRef:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.85.0",
5
+ "version": "2.85.1",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
package/src/cli/deploy.js CHANGED
@@ -85,21 +85,28 @@ class UnderpostDeploy {
85
85
  /**
86
86
  * Creates a YAML service configuration for a deployment.
87
87
  * @param {string} deployId - Deployment ID for which the service is being created.
88
+ * @param {string} path - Path for which the service is being created.
88
89
  * @param {string} env - Environment for which the service is being created.
89
90
  * @param {number} port - Port number for the service.
90
91
  * @param {Array<string>} deploymentVersions - List of deployment versions.
91
92
  * @returns {string} - YAML service configuration for the specified deployment.
93
+ * @param {string} [serviceId] - Custom service name (optional).
92
94
  * @memberof UnderpostDeploy
93
95
  */
94
- deploymentYamlServiceFactory({ deployId, env, port, deploymentVersions }) {
95
- return deploymentVersions
96
- .map(
97
- (version, i) => ` - name: ${deployId}-${env}-${version}-service
96
+ deploymentYamlServiceFactory({ deployId, path, env, port, deploymentVersions, serviceId }) {
97
+ return `
98
+ - conditions:
99
+ - prefix: ${path}
100
+ enableWebsockets: true
101
+ services:
102
+ ${deploymentVersions
103
+ .map(
104
+ (version, i) => ` - name: ${serviceId ? serviceId : `${deployId}-${env}-${version}-service`}
98
105
  port: ${port}
99
106
  weight: ${i === 0 ? 100 : 0}
100
107
  `,
101
- )
102
- .join('');
108
+ )
109
+ .join('')}`;
103
110
  },
104
111
  /**
105
112
  * Creates a YAML deployment configuration for a deployment.
@@ -214,6 +221,9 @@ ${UnderpostDeploy.API.deploymentYamlPartsFactory({
214
221
 
215
222
  let proxyYaml = '';
216
223
  let secretYaml = '';
224
+ const customServices = fs.existsSync(`./engine-private/conf/${deployId}/conf.services.json`)
225
+ ? JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.services.json`))
226
+ : [];
217
227
 
218
228
  for (const host of Object.keys(confServer)) {
219
229
  if (env === 'production') secretYaml += UnderpostDeploy.API.buildCertManagerCertificate({ host });
@@ -236,20 +246,33 @@ spec:
236
246
  secretName: ${host}`
237
247
  }
238
248
  routes:`;
249
+ const deploymentVersions =
250
+ options.traffic && typeof options.traffic === 'string' ? options.traffic.split(',') : ['blue'];
239
251
  for (const conditionObj of pathPortAssignment) {
240
252
  const { path, port } = conditionObj;
241
- proxyYaml += `
242
- - conditions:
243
- - prefix: ${path}
244
- enableWebsockets: true
245
- services:
246
- ${UnderpostDeploy.API.deploymentYamlServiceFactory({
247
- deployId,
248
- env,
249
- port,
250
- deploymentVersions:
251
- options.traffic && typeof options.traffic === 'string' ? options.traffic.split(',') : ['blue'],
252
- })}`;
253
+ proxyYaml += UnderpostDeploy.API.deploymentYamlServiceFactory({
254
+ path,
255
+ deployId,
256
+ env,
257
+ port,
258
+ deploymentVersions,
259
+ });
260
+ }
261
+ for (const customService of customServices) {
262
+ const { path: _path, port, serviceId, host: _host } = customService;
263
+ if (host === _host) {
264
+ switch (serviceId) {
265
+ case 'mongo-express-service': {
266
+ proxyYaml += UnderpostDeploy.API.deploymentYamlServiceFactory({
267
+ path: _path,
268
+ port,
269
+ serviceId,
270
+ deploymentVersions,
271
+ });
272
+ break;
273
+ }
274
+ }
275
+ }
253
276
  }
254
277
  }
255
278
  const yamlPath = `./engine-private/conf/${deployId}/build/${env}/proxy.yaml`;
@@ -579,6 +602,23 @@ EOF`);
579
602
  * @memberof UnderpostDeploy
580
603
  */
581
604
  existsContainerFile({ podName, path }) {
605
+ if (podName === 'kind-worker') {
606
+ const isFile = JSON.parse(
607
+ shellExec(`docker exec ${podName} sh -c 'test -f "$1" && echo true || echo false' sh ${path}`, {
608
+ stdout: true,
609
+ disableLog: true,
610
+ silent: true,
611
+ }).trim(),
612
+ );
613
+ const isFolder = JSON.parse(
614
+ shellExec(`docker exec ${podName} sh -c 'test -d "$1" && echo true || echo false' sh ${path}`, {
615
+ stdout: true,
616
+ disableLog: true,
617
+ silent: true,
618
+ }).trim(),
619
+ );
620
+ return isFolder || isFile;
621
+ }
582
622
  return JSON.parse(
583
623
  shellExec(`kubectl exec ${podName} -- test -f ${path} && echo "true" || echo "false"`, {
584
624
  stdout: true,
@@ -704,6 +744,61 @@ EOF`);
704
744
  }
705
745
  logger.info(`${iteratorTag} | Deployment ready. | Total delay number check iterations: ${checkStatusIteration}`);
706
746
  },
747
+
748
+ /**
749
+ * Retrieves the currently loaded images in the Kubernetes cluster.
750
+ * @returns {Array<object>} - Array of objects containing pod names and their corresponding images.
751
+ * @memberof UnderpostDeploy
752
+ */
753
+ getCurrentLoadedImages(node = 'kind-worker', specContainers = false) {
754
+ if (specContainers) {
755
+ const raw = shellExec(
756
+ `kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{"\\n"}{.metadata.name}{":\\t"}{range .spec.containers[*]}{.image}{", "}{end}{end}'`,
757
+ {
758
+ stdout: true,
759
+ silent: true,
760
+ },
761
+ );
762
+ return raw
763
+ .split(`\n`)
764
+ .map((lines) => ({
765
+ pod: lines.split('\t')[0].replaceAll(':', '').trim(),
766
+ image: lines.split('\t')[1] ? lines.split('\t')[1].replaceAll(',', '').trim() : null,
767
+ }))
768
+ .filter((o) => o.image);
769
+ }
770
+ if (node === 'kind-worker') {
771
+ const raw = shellExec(`docker exec -i kind-control-plane crictl images`, {
772
+ stdout: true,
773
+ silent: true,
774
+ });
775
+
776
+ const heads = raw
777
+ .split(`\n`)[0]
778
+ .split(' ')
779
+ .filter((_r) => _r.trim());
780
+
781
+ const pods = raw
782
+ .split(`\n`)
783
+ .filter((r) => !r.match('IMAGE'))
784
+ .map((r) => r.split(' ').filter((_r) => _r.trim()));
785
+
786
+ const result = [];
787
+
788
+ for (const row of pods) {
789
+ if (row.length === 0) continue;
790
+ const pod = {};
791
+ let index = -1;
792
+ for (const head of heads) {
793
+ if (head in pod) continue;
794
+ index++;
795
+ pod[head] = row[index];
796
+ }
797
+ result.push(pod);
798
+ }
799
+ return result;
800
+ }
801
+ },
707
802
  };
708
803
  }
709
804
 
package/src/cli/image.js CHANGED
@@ -53,7 +53,7 @@ class UnderpostImage {
53
53
  const baseCommand = options.dev ? 'node bin' : 'underpost';
54
54
  const baseCommandOption = options.dev ? ' --dev' : '';
55
55
  const IMAGE_NAME = `rockylinux9-underpost`;
56
- const IMAGE_NAME_FULL = `${IMAGE_NAME}:${options.version ?? Underpost.version}`;
56
+ const IMAGE_NAME_FULL = `${IMAGE_NAME}:${options.version ? options.version : Underpost.version}`;
57
57
  let LOAD_TYPE = '';
58
58
  if (options.kindLoad === true) {
59
59
  LOAD_TYPE = `--kind-load`;
@@ -105,7 +105,7 @@ class UnderpostImage {
105
105
  dev: false,
106
106
  },
107
107
  ) {
108
- const {
108
+ let {
109
109
  path,
110
110
  imageName,
111
111
  imagePath,
@@ -119,6 +119,7 @@ class UnderpostImage {
119
119
  reset,
120
120
  dev,
121
121
  } = options;
122
+ if (!path) path = '.';
122
123
  const podManImg = `localhost/${imageName}`;
123
124
  if (imagePath && typeof imagePath === 'string' && !fs.existsSync(imagePath))
124
125
  fs.mkdirSync(imagePath, { recursive: true });
@@ -111,8 +111,10 @@ class UnderpostRepository {
111
111
  ) {
112
112
  if (!repoPath) repoPath = '.';
113
113
  if (options.msg) {
114
- let key = Object.keys(commitData).find((k) => k && options.msg.toLocaleLowerCase().match(k));
115
- if (!key) key == 'chore';
114
+ options.msg = options.msg.replaceAll('"', '').replaceAll(`'`, '').replaceAll('`', '');
115
+ let key = Object.keys(commitData).find((k) => k && options.msg.toLocaleLowerCase().slice(0, 16).match(k));
116
+ if (!key) key = Object.keys(commitData).find((k) => k && options.msg.toLocaleLowerCase().match(k));
117
+ if (!key || key === undefined) key = 'chore';
116
118
  shellExec(
117
119
  `underpost cmt ${repoPath} ${key} ${options.deployId ? options.deployId : `''`} '${options.msg.replaceAll(`${key}(${key}`, '')}'`,
118
120
  );
package/src/cli/run.js CHANGED
@@ -274,7 +274,7 @@ class UnderpostRun {
274
274
  * @param {Object} options - The default underpost runner options for customizing workflow
275
275
  * @memberof UnderpostRun
276
276
  */
277
- 'template-deploy': (path, options = UnderpostRun.DEFAULT_OPTION) => {
277
+ 'template-deploy': (path = '', options = UnderpostRun.DEFAULT_OPTION) => {
278
278
  const baseCommand = options.dev ? 'node bin' : 'underpost';
279
279
  shellExec(`${baseCommand} run clean`);
280
280
  shellExec(
@@ -314,16 +314,23 @@ class UnderpostRun {
314
314
  },
315
315
  /**
316
316
  * @method pull
317
- * @description Cleans the core repository and pulls the latest content for `engine` and `engine-private` repositories from the remote.
317
+ * @description Clones or pulls updates for the `engine` and `engine-private` repositories into `/home/dd/engine` and `/home/dd/engine/engine-private`.
318
318
  * @param {string} path - The input value, identifier, or path for the operation.
319
319
  * @param {Object} options - The default underpost runner options for customizing workflow
320
320
  * @memberof UnderpostRun
321
321
  */
322
322
  pull: (path, options = UnderpostRun.DEFAULT_OPTION) => {
323
- shellCd(`/home/dd/engine`);
324
- shellExec(`node bin/deploy clean-core-repo`);
325
- shellExec(`underpost pull . ${process.env.GITHUB_USERNAME}/engine`);
326
- shellExec(`underpost pull ./engine-private ${process.env.GITHUB_USERNAME}/engine-private`);
323
+ if (!fs.existsSync(`/home/dd`) || !fs.existsSync(`/home/dd/engine`)) {
324
+ fs.mkdirSync(`/home/dd`, { recursive: true });
325
+ shellExec(`cd /home/dd && underpost clone ${process.env.GITHUB_USERNAME}/engine`);
326
+ } else {
327
+ shellExec(`underpost run clean`);
328
+ shellExec(`cd /home/dd/engine && underpost pull . ${process.env.GITHUB_USERNAME}/engine`);
329
+ }
330
+ if (!fs.existsSync(`/home/dd/engine/engine-private`))
331
+ shellExec(`cd /home/dd/engine && underpost clone ${process.env.GITHUB_USERNAME}/engine-private`);
332
+ else
333
+ shellExec(`cd /home/dd/engine/engine-private underpost pull . ${process.env.GITHUB_USERNAME}/engine-private`);
327
334
  },
328
335
  /**
329
336
  * @method release-deploy
@@ -412,7 +419,7 @@ class UnderpostRun {
412
419
 
413
420
  shellExec(
414
421
  `${baseCommand} deploy --kubeadm --build-manifest --sync --info-router --replicas ${
415
- replicas ?? 1
422
+ replicas ? replicas : 1
416
423
  } --node ${node}${image ? ` --image ${image}` : ''}${versions ? ` --versions ${versions}` : ''} dd ${env}`,
417
424
  );
418
425
 
@@ -447,6 +454,43 @@ class UnderpostRun {
447
454
  shellExec(`${options.underpostRoot}/scripts/rocky-setup.sh --yes${options.dev ? ' --install-dev' : ``}`);
448
455
  },
449
456
 
457
+ /**
458
+ * @method dev-container
459
+ * @description Runs a development container pod named `underpost-dev-container` with specified volume mounts and opens a terminal to follow its logs.
460
+ * @param {string} path - The input value, identifier, or path for the operation (used as an optional command to run inside the container).
461
+ * @param {Object} options - The default underpost runner options for customizing workflow
462
+ * @memberof UnderpostRun
463
+ */
464
+ 'dev-container': async (path = '', options = UnderpostRun.DEFAULT_OPTION) => {
465
+ options.dev = true;
466
+ const baseCommand = options.dev ? 'node bin' : 'underpost';
467
+ const baseClusterCommand = options.dev ? ' --dev' : '';
468
+ const currentImage = UnderpostDeploy.API.getCurrentLoadedImages('kind-worker', false).find((o) =>
469
+ o.IMAGE.match('underpost'),
470
+ );
471
+ const podName = `underpost-dev-container`;
472
+ if (!UnderpostDeploy.API.existsContainerFile({ podName: 'kind-worker', path: '/home/dd/engine' })) {
473
+ shellExec(`docker exec -i kind-worker bash -c "mkdir -p /home/dd"`);
474
+ shellExec(`docker cp /home/dd/engine kind-worker:/home/dd/engine`);
475
+ shellExec(`docker exec -i kind-worker bash -c "chown -R 1000:1000 /home/dd || true; chmod -R 755 /home/dd"`);
476
+ }
477
+ if (!currentImage) shellExec(`${baseCommand} dockerfile-pull-base-images${baseClusterCommand} --kind-load`);
478
+ // shellExec(`kubectl delete pod ${podName} --ignore-not-found`);
479
+ await UnderpostRun.RUNNERS['deploy-job']('', {
480
+ dev: true,
481
+ podName,
482
+ imageName: currentImage ? currentImage.image : `localhost/rockylinux9-underpost:${Underpost.version}`,
483
+ volumeHostPath: '/home/dd',
484
+ volumeMountPath: '/home/dd',
485
+ on: {
486
+ init: async () => {
487
+ // openTerminal(`kubectl logs -f ${podName}`);
488
+ },
489
+ },
490
+ args: [daemonProcess(path ? path : `cd /home/dd/engine && npm run test`)],
491
+ });
492
+ },
493
+
450
494
  /**
451
495
  * @method monitor
452
496
  * @description Monitors a specific pod (identified by `path`) for the existence of a file (`/await`), and performs conditional actions (like file copying and opening Firefox) when the file is removed.
@@ -706,6 +750,64 @@ class UnderpostRun {
706
750
  UnderpostDeploy.API.switchTraffic(deployId, env, targetTraffic);
707
751
  },
708
752
 
753
+ /**
754
+ * @method service
755
+ * @description Deploys and exposes specific services (like `mongo-express-service`) on the cluster, updating deployment configurations and monitoring status.
756
+ * @param {string} path - The input value, identifier, or path for the operation (formatted as `deployId,serviceId,host,path,replicas,image,node`).
757
+ * @param {Object} options - The default underpost runner options for customizing workflow
758
+ * @memberof UnderpostRun
759
+ */
760
+ service: async (path = '', options = UnderpostRun.DEFAULT_OPTION) => {
761
+ const env = options.dev ? 'development' : 'production';
762
+ const baseCommand = options.dev ? 'node bin' : 'underpost';
763
+ // const baseClusterCommand = options.dev ? ' --dev' : '';
764
+ shellCd(`/home/dd/engine`);
765
+ let [deployId, serviceId, host, _path, replicas, image, node] = path.split(',');
766
+ const services = fs.existsSync(`./engine-private/deploy/${deployId}/conf.services.json`)
767
+ ? JSON.parse(fs.readFileSync(`./engine-private/deploy/${deployId}/conf.services.json`, 'utf8'))
768
+ : [];
769
+ switch (serviceId) {
770
+ case 'mongo-express-service': {
771
+ let serviceData = services.findIndex((s) => s.serviceId === serviceId);
772
+ const payload = {
773
+ serviceId,
774
+ path: _path,
775
+ port: 8081,
776
+ host,
777
+ };
778
+ if (serviceData == -1) {
779
+ services.push(payload);
780
+ } else {
781
+ services[serviceData] = payload;
782
+ }
783
+ fs.writeFileSync(
784
+ `./engine-private/conf/${deployId}/conf.services.json`,
785
+ JSON.stringify(services, null, 4),
786
+ 'utf8',
787
+ );
788
+ shellExec(`kubectl delete svc mongo-express-service --ignore-not-found`);
789
+ shellExec(`kubectl delete deployment mongo-express --ignore-not-found`);
790
+ shellExec(`kubectl apply -f manifests/deployment/mongo-express/deployment.yaml`);
791
+
792
+ const success = await UnderpostTest.API.statusMonitor('mongo-express');
793
+
794
+ if (success) {
795
+ const versions = UnderpostDeploy.API.getCurrentTraffic(deployId) || 'blue';
796
+ if (!node) node = os.hostname();
797
+ shellExec(
798
+ `${baseCommand} deploy --kubeadm --build-manifest --sync --info-router --replicas ${
799
+ replicas ? replicas : 1
800
+ } --node ${node}${image ? ` --image ${image}` : ''}${versions ? ` --versions ${versions}` : ''} dd ${env}`,
801
+ );
802
+ shellExec(
803
+ `${baseCommand} deploy --kubeadm --disable-update-deployment ${deployId} ${env} --versions ${versions}`,
804
+ );
805
+ } else logger.error('Mongo Express deployment failed');
806
+ break;
807
+ }
808
+ }
809
+ },
810
+
709
811
  /**
710
812
  * @method sync-replica
711
813
  * @description Syncs a replica for the dd.router
package/src/index.js CHANGED
@@ -35,7 +35,7 @@ class Underpost {
35
35
  * @type {String}
36
36
  * @memberof Underpost
37
37
  */
38
- static version = 'v2.85.0';
38
+ static version = 'v2.85.1';
39
39
  /**
40
40
  * Repository cli API
41
41
  * @static