underpost 2.8.873 → 2.8.874

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
@@ -50,12 +50,13 @@
50
50
 
51
51
 
52
52
 
53
+
53
54
 
54
55
 
55
56
  <!-- badges -->
56
57
 
57
58
 
58
- [![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.8.873)](https://socket.dev/npm/package/underpost/overview/2.8.873) [![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)
59
+ [![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.8.874)](https://socket.dev/npm/package/underpost/overview/2.8.874) [![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)
59
60
 
60
61
 
61
62
  <!-- end-badges -->
@@ -94,6 +95,7 @@
94
95
 
95
96
 
96
97
 
98
+
97
99
 
98
100
 
99
101
  </div>
@@ -140,7 +142,7 @@ Run dev client server
140
142
  npm run dev
141
143
  ```
142
144
  <!-- -->
143
- ## underpost ci/cd cli v2.8.873
145
+ ## underpost ci/cd cli v2.8.874
144
146
 
145
147
  ### Usage: `underpost [options] [command]`
146
148
  ```
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.8.873
1
+ ## underpost ci/cd cli v2.8.874
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -291,6 +291,8 @@ Options:
291
291
  management commands.
292
292
  --cert Resets TLS/SSL certificate secrets for
293
293
  deployments.
294
+ --cert-hosts <hosts> Resets TLS/SSL certificate secrets for
295
+ specified hosts.
294
296
  --node <node> Sets optional node for deployment
295
297
  operations.
296
298
  --build-manifest Builds Kubernetes YAML manifests, including
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: localhost/rockylinux9-underpost:v2.8.873
20
+ image: localhost/rockylinux9-underpost:v2.8.874
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.8.873
103
+ image: localhost/rockylinux9-underpost:v2.8.874
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.8.873
20
+ image: localhost/rockylinux9-underpost:v2.8.874
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "96294Ki"
@@ -66,6 +66,24 @@ spec:
66
66
  protocol: UDP
67
67
  port: 4022
68
68
  targetPort: 4022
69
+
70
+ - name: 'tcp-4023'
71
+ protocol: TCP
72
+ port: 4023
73
+ targetPort: 4023
74
+ - name: 'udp-4023'
75
+ protocol: UDP
76
+ port: 4023
77
+ targetPort: 4023
78
+
79
+ - name: 'tcp-4024'
80
+ protocol: TCP
81
+ port: 4024
82
+ targetPort: 4024
83
+ - name: 'udp-4024'
84
+ protocol: UDP
85
+ port: 4024
86
+ targetPort: 4024
69
87
  type: LoadBalancer
70
88
  ---
71
89
  apiVersion: apps/v1
@@ -86,7 +104,7 @@ spec:
86
104
  spec:
87
105
  containers:
88
106
  - name: dd-test-development-green
89
- image: localhost/rockylinux9-underpost:v2.8.873
107
+ image: localhost/rockylinux9-underpost:v2.8.874
90
108
  # resources:
91
109
  # requests:
92
110
  # memory: "96294Ki"
@@ -135,4 +153,22 @@ spec:
135
153
  protocol: UDP
136
154
  port: 4022
137
155
  targetPort: 4022
156
+
157
+ - name: 'tcp-4023'
158
+ protocol: TCP
159
+ port: 4023
160
+ targetPort: 4023
161
+ - name: 'udp-4023'
162
+ protocol: UDP
163
+ port: 4023
164
+ targetPort: 4023
165
+
166
+ - name: 'tcp-4024'
167
+ protocol: TCP
168
+ port: 4024
169
+ targetPort: 4024
170
+ - name: 'udp-4024'
171
+ protocol: UDP
172
+ port: 4024
173
+ targetPort: 4024
138
174
  type: LoadBalancer
@@ -23,4 +23,29 @@ spec:
23
23
  - name: dd-test-development-blue-service
24
24
  port: 4022
25
25
  weight: 100
26
+
27
+ ---
28
+ apiVersion: projectcontour.io/v1
29
+ kind: HTTPProxy
30
+ metadata:
31
+ name: stagging.nexodev.org
32
+ spec:
33
+ virtualhost:
34
+ fqdn: stagging.nexodev.org
35
+ routes:
36
+ - conditions:
37
+ - prefix: /
38
+ enableWebsockets: true
39
+ services:
40
+ - name: dd-test-development-blue-service
41
+ port: 4023
42
+ weight: 100
43
+
44
+ - conditions:
45
+ - prefix: /peer
46
+ enableWebsockets: true
47
+ services:
48
+ - name: dd-test-development-blue-service
49
+ port: 4024
50
+ weight: 100
26
51
 
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.8.873",
5
+ "version": "2.8.874",
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",
@@ -48,7 +48,9 @@ const UserRouter = (options) => {
48
48
  check: fs.readFileSync(`./src/client/public/default/assets/mailer/api-user-check.png`),
49
49
  },
50
50
  header: (res) => {
51
- res.set('Content-Type', 'image/png');
51
+ res.header('Access-Control-Allow-Origin', '*');
52
+ res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
53
+ res.header('Content-Type', 'image/png');
52
54
  },
53
55
  };
54
56
 
@@ -453,6 +453,10 @@ const UserService = {
453
453
  const user = await User.findOne({
454
454
  email: payload.email,
455
455
  });
456
+ if (process.env.NODE_ENV === 'development') {
457
+ logger.warn('Only production check image token request on mailer GET /user/recover, set fallback timeout');
458
+ user.recoverTimeOut = new Date(+new Date() + 1000 * 60 * 15);
459
+ }
456
460
  if (user && new Date().getTime() < new Date(user.recoverTimeOut).getTime()) {
457
461
  const validatePassword = validatePasswordMiddleware(req.body.password);
458
462
  if (validatePassword.status === 'error') throw new Error(validatePassword.message);
package/src/cli/deploy.js CHANGED
@@ -12,7 +12,6 @@ import { loggerFactory } from '../server/logger.js';
12
12
  import { shellExec } from '../server/process.js';
13
13
  import fs from 'fs-extra';
14
14
  import dotenv from 'dotenv';
15
- import { DataBaseProvider } from '../db/DataBaseProvider.js';
16
15
  import UnderpostRootEnv from './env.js';
17
16
  import UnderpostCluster from './cluster.js';
18
17
  import Underpost from '../index.js';
@@ -155,21 +154,7 @@ ${UnderpostDeploy.API.deploymentYamlPartsFactory({
155
154
  let secretYaml = '';
156
155
 
157
156
  for (const host of Object.keys(confServer)) {
158
- if (env === 'production')
159
- secretYaml += `
160
- ---
161
- apiVersion: cert-manager.io/v1
162
- kind: Certificate
163
- metadata:
164
- name: ${host}
165
- spec:
166
- commonName: ${host}
167
- dnsNames:
168
- - ${host}
169
- issuerRef:
170
- name: letsencrypt-prod
171
- kind: ClusterIssuer
172
- secretName: ${host}`;
157
+ if (env === 'production') secretYaml += UnderpostDeploy.API.buildCertManagerCertificate({ host });
173
158
 
174
159
  const pathPortAssignment = pathPortAssignmentData[host];
175
160
  // logger.info('', { host, pathPortAssignment });
@@ -223,6 +208,22 @@ spec:
223
208
  }
224
209
  }
225
210
  },
211
+ buildCertManagerCertificate({ host }) {
212
+ return `
213
+ ---
214
+ apiVersion: cert-manager.io/v1
215
+ kind: Certificate
216
+ metadata:
217
+ name: ${host}
218
+ spec:
219
+ commonName: ${host}
220
+ dnsNames:
221
+ - ${host}
222
+ issuerRef:
223
+ name: letsencrypt-prod
224
+ kind: ClusterIssuer
225
+ secretName: ${host}`;
226
+ },
226
227
  getCurrentTraffic(deployId) {
227
228
  // kubectl get deploy,sts,svc,configmap,secret -n default -o yaml --export > default.yaml
228
229
  const hostTest = Object.keys(
@@ -232,7 +233,7 @@ spec:
232
233
  return info.match('blue') ? 'blue' : info.match('green') ? 'green' : null;
233
234
  },
234
235
  async callback(
235
- deployList = 'default',
236
+ deployList = '',
236
237
  env = 'development',
237
238
  options = {
238
239
  remove: false,
@@ -242,6 +243,7 @@ spec:
242
243
  infoUtil: false,
243
244
  expose: false,
244
245
  cert: false,
246
+ certHosts: '',
245
247
  versions: '',
246
248
  image: '',
247
249
  traffic: '',
@@ -305,6 +307,14 @@ docker login nvcr.io
305
307
  Username: $oauthtoken
306
308
  Password: <Your Key>
307
309
  `);
310
+ if (!deployList && options.certHosts) {
311
+ for (const host of options.certHosts.split(',')) {
312
+ shellExec(`sudo kubectl apply -f - <<EOF
313
+ ${UnderpostDeploy.API.buildCertManagerCertificate({ host })}
314
+ EOF`);
315
+ }
316
+ return;
317
+ } else if (!deployList) deployList = 'dd-default';
308
318
  if (deployList === 'dd' && fs.existsSync(`./engine-private/deploy/dd.router`))
309
319
  deployList = fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8');
310
320
  if (options.infoTraffic === true) {
@@ -361,7 +371,8 @@ Password: <Your Key>
361
371
  const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8'));
362
372
  for (const host of Object.keys(confServer)) {
363
373
  shellExec(`sudo kubectl delete HTTPProxy ${host}`);
364
- if (env === 'production' && options.cert === true) shellExec(`sudo kubectl delete Certificate ${host}`);
374
+ if (UnderpostDeploy.API.isValidTLSContext({ host, env, options }))
375
+ shellExec(`sudo kubectl delete Certificate ${host}`);
365
376
  if (!options.remove === true && env === 'development') etcHosts.push(host);
366
377
  }
367
378
 
@@ -373,7 +384,7 @@ Password: <Your Key>
373
384
  if (!options.remove === true) {
374
385
  if (!options.disableUpdateDeployment) shellExec(`sudo kubectl apply -f ./${manifestsPath}/deployment.yaml`);
375
386
  shellExec(`sudo kubectl apply -f ./${manifestsPath}/proxy.yaml`);
376
- if (env === 'production' && options.cert === true)
387
+ if (UnderpostDeploy.API.isValidTLSContext({ host, env, options }))
377
388
  shellExec(`sudo kubectl apply -f ./${manifestsPath}/secret.yaml`);
378
389
  }
379
390
  }
@@ -458,7 +469,11 @@ Password: <Your Key>
458
469
  notReadyPods.push(pod);
459
470
  }
460
471
  }
461
- return { ready: notReadyPods.length === 0, notReadyPods, readyPods };
472
+ return {
473
+ ready: pods.length > 0 && notReadyPods.length === 0,
474
+ notReadyPods,
475
+ readyPods,
476
+ };
462
477
  },
463
478
  configMap(env) {
464
479
  shellExec(`kubectl delete configmap underpost-config`);
@@ -482,6 +497,10 @@ Password: <Your Key>
482
497
  fs.writeFileSync(`/etc/hosts`, renderHosts, 'utf8');
483
498
  return { renderHosts };
484
499
  },
500
+ isValidTLSContext: ({ host, env, options }) =>
501
+ env === 'production' &&
502
+ options.cert === true &&
503
+ (!options.certHosts || options.certHosts.split(',').includes(host)),
485
504
  };
486
505
  }
487
506
 
package/src/cli/index.js CHANGED
@@ -158,6 +158,7 @@ program
158
158
  .option('--expose', 'Exposes services matching the provided deployment ID list.')
159
159
  .option('--info-util', 'Displays useful `kubectl` utility management commands.')
160
160
  .option('--cert', 'Resets TLS/SSL certificate secrets for deployments.')
161
+ .option('--cert-hosts <hosts>', 'Resets TLS/SSL certificate secrets for specified hosts.')
161
162
  .option('--node <node>', 'Sets optional node for deployment operations.')
162
163
  .option(
163
164
  '--build-manifest',
@@ -107,6 +107,7 @@ const Auth = {
107
107
  });
108
108
  });
109
109
  }
110
+ // Important delete session token if guest token already exists
110
111
  Auth.deleteToken();
111
112
  localStorage.removeItem('jwt');
112
113
 
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.8.873';
38
+ static version = 'v2.8.874';
39
39
  /**
40
40
  * Repository cli API
41
41
  * @static
@@ -106,10 +106,10 @@ const Lampp = {
106
106
  break;
107
107
  }
108
108
  },
109
- createApp: async ({ port, host, path, directory, rootHostPath, redirect, redirectTarget }) => {
109
+ createApp: async ({ port, host, path, directory, rootHostPath, redirect, redirectTarget, resetRouter }) => {
110
110
  if (!Lampp.enabled()) return { disabled: true };
111
111
  if (!Lampp.ports.includes(port)) Lampp.ports.push(port);
112
- if (currentPort === initPort) Lampp.removeRouter();
112
+ if (resetRouter) Lampp.removeRouter();
113
113
  Lampp.appendRouter(`
114
114
  Listen ${port}
115
115
 
@@ -31,12 +31,12 @@ const Xampp = {
31
31
  this.router = undefined;
32
32
  if (fs.existsSync(`./tmp/xampp-router.conf`)) fs.rmSync(`./tmp/xampp-router.conf`);
33
33
  },
34
- createApp: async ({ port, host, path, directory, rootHostPath, redirect, redirectTarget }) => {
34
+ createApp: async ({ port, host, path, directory, rootHostPath, redirect, redirectTarget, resetRouter }) => {
35
35
  if (!Xampp.enabled()) {
36
36
  return { disabled: true };
37
37
  }
38
38
  if (!Xampp.ports.includes(port)) Xampp.ports.push(port);
39
- if (currentPort === initPort) Xampp.removeRouter();
39
+ if (resetRouter) Xampp.removeRouter();
40
40
  Xampp.appendRouter(`
41
41
  Listen ${port}
42
42
 
@@ -552,7 +552,7 @@ function applySecurity(app, opts = {}) {
552
552
  origin: origin || false,
553
553
  methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
554
554
  credentials: true,
555
- allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'Accept'],
555
+ allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'Accept', 'withcredentials'],
556
556
  maxAge: 600,
557
557
  }),
558
558
  );
@@ -295,6 +295,7 @@ const buildRuntime = async () => {
295
295
  rootHostPath,
296
296
  redirect,
297
297
  redirectTarget,
298
+ resetRouter: currentPort === initPort,
298
299
  });
299
300
  if (disabled) continue;
300
301
  await UnderpostStartUp.API.listenPortController(
@@ -314,6 +315,7 @@ const buildRuntime = async () => {
314
315
  rootHostPath,
315
316
  redirect,
316
317
  redirectTarget,
318
+ resetRouter: currentPort === initPort,
317
319
  });
318
320
  if (disabled) continue;
319
321
  await UnderpostStartUp.API.listenPortController(