underpost 2.89.35 → 2.89.37

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.
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.ci.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.89.35)](https://socket.dev/npm/package/underpost/overview/2.89.35) [![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.ci.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.89.37)](https://socket.dev/npm/package/underpost/overview/2.89.37) [![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.89.35
69
+ ## underpost ci/cd cli v2.89.37
70
70
 
71
71
  ### Usage: `underpost [options] [command]`
72
72
  ```
@@ -106,3 +106,4 @@ Commands:
106
106
  ```
107
107
 
108
108
  <a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
109
+
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.89.35
1
+ ## underpost ci/cd cli v2.89.37
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -764,3 +764,4 @@ Options:
764
764
  -h, --help display help for command
765
765
 
766
766
  ```
767
+
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: localhost/rockylinux9-underpost:v2.89.35
20
+ image: localhost/rockylinux9-underpost:v2.89.37
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.89.35
103
+ image: localhost/rockylinux9-underpost:v2.89.37
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.89.35
20
+ image: localhost/rockylinux9-underpost:v2.89.37
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "96294Ki"
@@ -35,11 +35,11 @@ spec:
35
35
  underpost start --build --run dd-test development
36
36
 
37
37
  volumeMounts:
38
- - name: config-volume
38
+ - name: config-volume-dd-test-development-blue
39
39
  mountPath: /etc/config
40
40
 
41
41
  volumes:
42
- - name: config-volume
42
+ - name: config-volume-dd-test-development-blue
43
43
  configMap:
44
44
  name: underpost-config
45
45
 
@@ -108,7 +108,7 @@ spec:
108
108
  spec:
109
109
  containers:
110
110
  - name: dd-test-development-green
111
- image: localhost/rockylinux9-underpost:v2.89.35
111
+ image: localhost/rockylinux9-underpost:v2.89.37
112
112
  # resources:
113
113
  # requests:
114
114
  # memory: "96294Ki"
@@ -126,11 +126,11 @@ spec:
126
126
  underpost start --build --run dd-test development
127
127
 
128
128
  volumeMounts:
129
- - name: config-volume
129
+ - name: config-volume-dd-test-development-green
130
130
  mountPath: /etc/config
131
131
 
132
132
  volumes:
133
- - name: config-volume
133
+ - name: config-volume-dd-test-development-green
134
134
  configMap:
135
135
  name: underpost-config
136
136
 
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.89.35",
5
+ "version": "2.89.37",
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",
@@ -73,7 +73,16 @@ const ProviderSchema = UserSchema;
73
73
  const UserDto = {
74
74
  select: {
75
75
  get: () => {
76
- return { _id: 1, username: 1, email: 1, role: 1, emailConfirmed: 1, profileImageId: 1 };
76
+ return {
77
+ _id: 1,
78
+ username: 1,
79
+ email: 1,
80
+ role: 1,
81
+ emailConfirmed: 1,
82
+ profileImageId: 1,
83
+ createdAt: 1,
84
+ updatedAt: 1,
85
+ };
77
86
  },
78
87
  getAll: () => {
79
88
  return { _id: 1 };
package/src/cli/deploy.js CHANGED
@@ -179,7 +179,7 @@ spec:
179
179
  npm install -g underpost &&
180
180
  underpost secret underpost --create-from-file /etc/config/.env.${env} &&
181
181
  underpost start --build --run ${deployId} ${env}
182
- ${UnderpostDeploy.API.volumeFactory(volumes)
182
+ ${UnderpostDeploy.API.volumeFactory(volumes.map((v) => ((v.version = `${deployId}-${env}-${suffix}`), v)))
183
183
  .render.split(`\n`)
184
184
  .map((l) => ' ' + l)
185
185
  .join(`\n`)}
@@ -443,6 +443,7 @@ node bin run template-deploy
443
443
  node bin run ssh-deploy (sync-)engine-core
444
444
  node bin run cluster --dev 'express,dd-test+dd-core'
445
445
  node bin run dd-container --dev
446
+ node bin run promote dd-default production
446
447
  node bin dockerfile-pull-base-images --dev --path 'image-path' --kind-load
447
448
  node bin/deploy update-default-conf <deploy-id>
448
449
 
@@ -532,30 +533,34 @@ EOF`);
532
533
  continue;
533
534
  }
534
535
 
535
- if (!options.disableUpdateDeployment)
536
- for (const version of options.versions.split(',')) {
537
- shellExec(`sudo kubectl delete svc ${deployId}-${env}-${version}-service`);
538
- shellExec(`sudo kubectl delete deployment ${deployId}-${env}-${version}`);
539
- }
540
-
541
536
  const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8'));
542
537
  const confVolume = fs.existsSync(`./engine-private/conf/${deployId}/conf.volume.json`)
543
538
  ? JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.volume.json`, 'utf8'))
544
539
  : [];
545
540
 
546
- if (!options.disableUpdateVolume) {
547
- for (const volume of confVolume) {
548
- shellExec(`kubectl delete pvc ${volume.claimName}`);
549
- shellExec(`kubectl delete pv ${volume.claimName.replace('pvc-', 'pv-')}`);
550
- shellExec(`kubectl apply -f - <<EOF
541
+ if (!options.disableUpdateDeployment)
542
+ for (const version of options.versions.split(',')) {
543
+ shellExec(`sudo kubectl delete svc ${deployId}-${env}-${version}-service`);
544
+ shellExec(`sudo kubectl delete deployment ${deployId}-${env}-${version}`);
545
+ if (!options.disableUpdateVolume) {
546
+ for (const volume of confVolume) {
547
+ const pvcId = `${volume.claimName}-${deployId}-${env}-${version}`;
548
+ const pvId = `${volume.claimName.replace('pvc-', 'pv-')}-${deployId}-${env}-${version}`;
549
+ const rootVolumeHostPath = `/home/dd/engine/volume/${pvId}`;
550
+ if (!fs.existsSync(rootVolumeHostPath)) fs.mkdirSync(rootVolumeHostPath, { recursive: true });
551
+ fs.copySync(volume.volumeMountPath, rootVolumeHostPath);
552
+ shellExec(`kubectl delete pvc ${pvcId}`);
553
+ shellExec(`kubectl delete pv ${pvId}`);
554
+ shellExec(`kubectl apply -f - <<EOF
551
555
  ${UnderpostDeploy.API.persistentVolumeFactory({
552
- hostPath: volume.volumeMountPath,
553
- pvcId: volume.claimName,
556
+ hostPath: rootVolumeHostPath,
557
+ pvcId,
554
558
  })}
555
559
  EOF
556
560
  `);
561
+ }
562
+ }
557
563
  }
558
- }
559
564
 
560
565
  for (const host of Object.keys(confServer)) {
561
566
  if (!options.disableUpdateProxy) {
@@ -760,6 +765,7 @@ EOF
760
765
  volumeType: 'Directory',
761
766
  claimName: null,
762
767
  configMap: null,
768
+ version: null,
763
769
  },
764
770
  ],
765
771
  ) {
@@ -768,7 +774,11 @@ EOF
768
774
  let _volumes = `
769
775
  volumes:`;
770
776
  volumes.map((volumeData) => {
771
- const { volumeName, volumeMountPath, volumeHostPath, volumeType, claimName, configMap } = volumeData;
777
+ let { volumeName, volumeMountPath, volumeHostPath, volumeType, claimName, configMap, version } = volumeData;
778
+ if (version) {
779
+ volumeName = `${volumeName}-${version}`;
780
+ claimName = claimName ? `${claimName}-${version}` : null;
781
+ }
772
782
  _volumeMounts += `
773
783
  - name: ${volumeName}
774
784
  mountPath: ${volumeMountPath}
package/src/cli/run.js CHANGED
@@ -340,9 +340,10 @@ class UnderpostRun {
340
340
  * @memberof UnderpostRun
341
341
  */
342
342
  'cluster-build': (path, options = UnderpostRun.DEFAULT_OPTION) => {
343
+ const nodeOptions = options.nodeName ? ` --node-name ${options.nodeName}` : '';
343
344
  shellExec(`node bin run clean`);
344
- shellExec(`node bin run --dev sync-replica template-deploy`);
345
- shellExec(`node bin run sync-replica template-deploy`);
345
+ shellExec(`node bin run --dev sync-replica template-deploy${nodeOptions}`);
346
+ shellExec(`node bin run sync-replica template-deploy${nodeOptions}`);
346
347
  shellExec(`node bin env clean`);
347
348
  for (const deployId of fs.readFileSync('./engine-private/deploy/dd.router', 'utf8').split(','))
348
349
  shellExec(`node bin/deploy update-default-conf ${deployId.trim()}`);
@@ -1143,7 +1144,11 @@ class UnderpostRun {
1143
1144
  shellExec(`${baseCommand} env ${deployId} ${env}`);
1144
1145
  for (const host of Object.keys(confServer))
1145
1146
  if (_path in confServer[host]) shellExec(`node bin/deploy build-single-replica ${deployId} ${host} ${_path}`);
1146
- const node = options.dev || !isDeployRunnerContext(path, options) ? 'kind-control-plane' : os.hostname();
1147
+ const node = options.nodeName
1148
+ ? options.nodeName
1149
+ : options.dev || !isDeployRunnerContext(path, options)
1150
+ ? 'kind-control-plane'
1151
+ : os.hostname();
1147
1152
  // deployId, replicas, versions, image, node
1148
1153
  let defaultPath = [deployId, 1, ``, ``, node];
1149
1154
  shellExec(`${baseCommand} run${options.dev === true ? ' --dev' : ''} --build sync ${defaultPath}`);
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.89.35';
38
+ static version = 'v2.89.37';
39
39
  /**
40
40
  * Repository cli API
41
41
  * @static
@@ -133,7 +133,7 @@ class UnderpostStartUp {
133
133
  const repoName = `engine-${deployId.split('-')[1]}`;
134
134
  shellExec(`cd ${buildBasePath} && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}`);
135
135
  shellExec(`mkdir -p ${buildBasePath}/engine`);
136
- shellExec(`cd ${buildBasePath} && sudo cp -a ./${repoName}/* ./engine`);
136
+ shellExec(`cd ${buildBasePath} && sudo cp -a ./${repoName}/. ./engine`);
137
137
  shellExec(`cd ${buildBasePath} && sudo rm -rf ./${repoName}`);
138
138
  shellExec(`cd ${buildBasePath}/engine && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}-private`);
139
139
  shellExec(`cd ${buildBasePath}/engine && sudo mv ./${repoName}-private ./engine-private`);