@underpostnet/underpost 2.8.0 → 2.8.4

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.
Files changed (91) hide show
  1. package/.dockerignore +1 -0
  2. package/.github/workflows/ghpkg.yml +14 -11
  3. package/.github/workflows/pwa-microservices-template.page.yml +10 -3
  4. package/.vscode/extensions.json +17 -71
  5. package/.vscode/settings.json +12 -5
  6. package/AUTHORS.md +16 -5
  7. package/CHANGELOG.md +63 -3
  8. package/Dockerfile +41 -62
  9. package/README.md +1 -28
  10. package/bin/build.js +278 -0
  11. package/bin/db.js +2 -24
  12. package/bin/deploy.js +107 -71
  13. package/bin/file.js +33 -4
  14. package/bin/index.js +35 -54
  15. package/bin/ssl.js +19 -11
  16. package/bin/util.js +27 -89
  17. package/bin/vs.js +25 -2
  18. package/conf.js +32 -132
  19. package/docker-compose.yml +1 -1
  20. package/manifests/core/kustomization.yaml +11 -0
  21. package/manifests/core/underpost-engine-backup-access.yaml +16 -0
  22. package/manifests/core/underpost-engine-backup-pv-pvc.yaml +22 -0
  23. package/manifests/core/underpost-engine-headless-service.yaml +10 -0
  24. package/manifests/core/underpost-engine-mongodb-backup-cronjob.yaml +40 -0
  25. package/manifests/core/underpost-engine-mongodb-configmap.yaml +26 -0
  26. package/manifests/core/underpost-engine-pv-pvc.yaml +23 -0
  27. package/manifests/core/underpost-engine-statefulset.yaml +91 -0
  28. package/manifests/deployment/mongo-express.yaml +60 -0
  29. package/manifests/deployment/phpmyadmin.yaml +54 -0
  30. package/manifests/kind-config.yaml +12 -0
  31. package/manifests/letsencrypt-prod.yaml +15 -0
  32. package/manifests/mariadb/config.yaml +10 -0
  33. package/manifests/mariadb/kustomization.yaml +9 -0
  34. package/manifests/mariadb/pv.yaml +12 -0
  35. package/manifests/mariadb/pvc.yaml +10 -0
  36. package/manifests/mariadb/secret.yaml +8 -0
  37. package/manifests/mariadb/service.yaml +10 -0
  38. package/manifests/mariadb/statefulset.yaml +55 -0
  39. package/manifests/valkey/kustomization.yaml +7 -0
  40. package/manifests/valkey/underpost-engine-valkey-service.yaml +17 -0
  41. package/manifests/valkey/underpost-engine-valkey-statefulset.yaml +39 -0
  42. package/package.json +16 -35
  43. package/src/api/user/user.model.js +16 -3
  44. package/src/api/user/user.service.js +1 -1
  45. package/src/client/components/core/Account.js +4 -2
  46. package/src/client/components/core/Auth.js +2 -2
  47. package/src/client/components/core/CalendarCore.js +115 -49
  48. package/src/client/components/core/CommonJs.js +150 -19
  49. package/src/client/components/core/Css.js +1 -1
  50. package/src/client/components/core/CssCore.js +6 -0
  51. package/src/client/components/core/Docs.js +2 -1
  52. package/src/client/components/core/DropDown.js +5 -1
  53. package/src/client/components/core/Input.js +17 -3
  54. package/src/client/components/core/JoyStick.js +8 -5
  55. package/src/client/components/core/Modal.js +17 -11
  56. package/src/client/components/core/Panel.js +85 -25
  57. package/src/client/components/core/PanelForm.js +11 -19
  58. package/src/client/components/core/SignUp.js +4 -1
  59. package/src/client/components/core/Translate.js +57 -9
  60. package/src/client/components/core/Validator.js +9 -1
  61. package/src/client/public/default/plantuml/client-conf.svg +1 -1
  62. package/src/client/public/default/plantuml/server-conf.svg +1 -1
  63. package/src/client/public/default/plantuml/server-schema.svg +1 -1
  64. package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
  65. package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
  66. package/src/client/services/core/core.service.js +2 -0
  67. package/src/client/services/default/default.management.js +4 -2
  68. package/src/client/ssr/body/CacheControl.js +2 -1
  69. package/src/client/ssr/body/DefaultSplashScreen.js +3 -3
  70. package/src/client/ssr/offline/Maintenance.js +63 -0
  71. package/src/client/sw/default.sw.js +23 -3
  72. package/src/db/mongo/MongooseDB.js +13 -1
  73. package/src/index.js +15 -0
  74. package/src/runtime/lampp/Lampp.js +1 -13
  75. package/src/runtime/xampp/Xampp.js +0 -13
  76. package/src/server/auth.js +3 -3
  77. package/src/server/client-build.js +8 -17
  78. package/src/server/client-icons.js +1 -1
  79. package/src/server/conf.js +299 -32
  80. package/src/server/dns.js +2 -3
  81. package/src/server/logger.js +18 -11
  82. package/src/server/network.js +0 -36
  83. package/src/server/process.js +25 -2
  84. package/src/server/project.js +39 -0
  85. package/src/server/proxy.js +4 -26
  86. package/src/server/runtime.js +6 -7
  87. package/src/server/ssl.js +1 -1
  88. package/src/server/valkey.js +3 -0
  89. package/startup.cjs +12 -0
  90. package/src/server/prompt-optimizer.js +0 -28
  91. package/startup.js +0 -11
@@ -5,10 +5,9 @@ import dotenv from 'dotenv';
5
5
 
6
6
  import { createProxyMiddleware } from 'http-proxy-middleware';
7
7
  import { loggerFactory, loggerMiddleware } from './logger.js';
8
- import { listenPortController, network } from './network.js';
9
- import { orderArrayFromAttrInt } from '../client/components/core/CommonJs.js';
8
+ import { listenPortController } from './network.js';
10
9
  import { createSslServer, sslRedirectMiddleware } from './ssl.js';
11
- import { buildProxyRouter, maintenanceMiddleware } from './conf.js';
10
+ import { buildPortProxyRouter, buildProxyRouter, maintenanceMiddleware } from './conf.js';
12
11
 
13
12
  dotenv.config();
14
13
 
@@ -16,7 +15,7 @@ const logger = loggerFactory(import.meta);
16
15
 
17
16
  const buildProxy = async () => {
18
17
  // default target
19
- await network.port.portClean(process.env.PORT);
18
+
20
19
  express().listen(process.env.PORT);
21
20
 
22
21
  const proxyRouter = buildProxyRouter();
@@ -57,27 +56,7 @@ const buildProxy = async () => {
57
56
  // '^/target-path': '/',
58
57
  },
59
58
  };
60
- if (!process.argv.includes('maintenance')) {
61
- // build router
62
- Object.keys(hosts).map((hostKey) => {
63
- let { host, path, target, proxy, peer } = hosts[hostKey];
64
- if (process.env.NODE_ENV === 'development') host = `localhost`;
65
-
66
- if (!proxy.includes(port)) return;
67
- const absoluteHost = [80, 443].includes(port)
68
- ? `${host}${path === '/' ? '' : path}`
69
- : `${host}:${port}${path === '/' ? '' : path}`;
70
-
71
- if (!(absoluteHost in options.router)) options.router[absoluteHost] = target;
72
- });
73
- if (Object.keys(options.router).length === 0) continue;
74
-
75
- // order router
76
- const router = {};
77
- for (const absoluteHostKey of orderArrayFromAttrInt(Object.keys(options.router), 'length'))
78
- router[absoluteHostKey] = options.router[absoluteHostKey];
79
- options.router = router;
80
- }
59
+ if (!process.argv.includes('maintenance')) options.router = buildPortProxyRouter(port, proxyRouter);
81
60
 
82
61
  const filter = false
83
62
  ? (pathname, req) => {
@@ -86,7 +65,6 @@ const buildProxy = async () => {
86
65
  }
87
66
  : proxyPath;
88
67
  app.use(proxyPath, createProxyMiddleware(filter, options));
89
- await network.port.portClean(port);
90
68
 
91
69
  switch (process.env.NODE_ENV) {
92
70
  case 'production':
@@ -9,7 +9,7 @@ import compression from 'compression';
9
9
 
10
10
  import { createServer } from 'http';
11
11
  import { getRootDirectory } from './process.js';
12
- import { network, listenPortController, saveRuntimeRouter, logRuntimeRouter, listenServerFactory } from './network.js';
12
+ import { listenPortController, saveRuntimeRouter, logRuntimeRouter, listenServerFactory } from './network.js';
13
13
  import { loggerFactory, loggerMiddleware } from './logger.js';
14
14
  import { getCapVariableName, newInstance } from '../client/components/core/CommonJs.js';
15
15
  import { Xampp } from '../runtime/xampp/Xampp.js';
@@ -295,7 +295,7 @@ export PATH=$PATH:/opt/lampp/bin`,
295
295
  logger.info('Build static server runtime', `${host}${path}`);
296
296
  currentPort += 2;
297
297
  const staticPort = newInstance(currentPort);
298
- await network.port.portClean(staticPort);
298
+
299
299
  await listenPortController(app, staticPort, runningData);
300
300
  currentPort++;
301
301
  continue;
@@ -346,7 +346,7 @@ export PATH=$PATH:/opt/lampp/bin`,
346
346
  // changeOrigin: true,
347
347
  // }),
348
348
  // );
349
- await network.port.portClean(port);
349
+
350
350
  await listenPortController(app, port, runningData);
351
351
  break;
352
352
  }
@@ -460,7 +460,7 @@ export PATH=$PATH:/opt/lampp/bin`,
460
460
  host,
461
461
  path,
462
462
  });
463
- await network.port.portClean(peerPort);
463
+
464
464
  await listenPortController(peerServer, peerPort, {
465
465
  runtime: 'nodejs',
466
466
  client: null,
@@ -470,7 +470,6 @@ export PATH=$PATH:/opt/lampp/bin`,
470
470
  });
471
471
  }
472
472
 
473
- await network.port.portClean(port);
474
473
  await listenPortController(server, port, runningData);
475
474
 
476
475
  break;
@@ -481,8 +480,8 @@ export PATH=$PATH:/opt/lampp/bin`,
481
480
  }
482
481
  }
483
482
 
484
- if (Xampp.enabled() && Xampp.router) await Xampp.initService({ daemon: true });
485
- if (Lampp.enabled() && Lampp.router) await Lampp.initService({ daemon: true });
483
+ if (Xampp.enabled() && Xampp.router) Xampp.initService();
484
+ if (Lampp.enabled() && Lampp.router) Lampp.initService();
486
485
 
487
486
  saveRuntimeRouter();
488
487
  logRuntimeRouter();
package/src/server/ssl.js CHANGED
@@ -70,7 +70,7 @@ const validateSecureContext = (host) => {
70
70
  const buildSecureContext = (host) => {
71
71
  return {
72
72
  key: fs.readFileSync(`./engine-private/ssl/${host}/key.key`, 'utf8'),
73
- cert: fs.readFileSync(`./engine-private/ssl/${host}/crt.crt`, 'utf8'),
73
+ cert: fs.readFileSync(`./engine-private/ssl/${host}/ca_bundle.crt`, 'utf8'),
74
74
  ca: fs.readFileSync(`./engine-private/ssl/${host}/ca_bundle.crt`, 'utf8'),
75
75
  };
76
76
  };
@@ -21,6 +21,8 @@ const selectDtoFactory = (payload, select) => {
21
21
 
22
22
  const valkeyClientFactory = async () => {
23
23
  const valkey = new Valkey({
24
+ // port: 6379,
25
+ // host: 'service-valkey.default.svc.cluster.local',
24
26
  retryStrategy: (attempt) => {
25
27
  if (attempt === 1) {
26
28
  valkey.disconnect();
@@ -53,6 +55,7 @@ const getValkeyObject = async (key = '') => {
53
55
  try {
54
56
  return JSON.parse(object);
55
57
  } catch (error) {
58
+ logger.error(error);
56
59
  return object;
57
60
  }
58
61
  };
package/startup.cjs ADDED
@@ -0,0 +1,12 @@
1
+ const shell = require('shelljs');
2
+
3
+ // /usr/bin/supervisord -n
4
+ // /usr/sbin/sshd -D
5
+
6
+ shell.exec(`/usr/bin/supervisord -n`, { async: true });
7
+
8
+ // shell.exec(`sudo /opt/lampp/lampp start`, { async: true });
9
+
10
+ // shell.exec(`/usr/bin/mongod -f /etc/mongod.conf`, { async: true });
11
+
12
+ shell.exec(`underpost new app`);
@@ -1,28 +0,0 @@
1
- // https://github.com/xenova/transformers.js/blob/f43d3dd348fd7b293008802590bb3a1afa218dc7/src/models.js#L10
2
-
3
- import { AutoModelForSeq2SeqLM, AutoTokenizer } from '@xenova/transformers';
4
- import { loggerFactory } from './logger.js';
5
- import dotenv from 'dotenv';
6
-
7
- dotenv.config();
8
-
9
- const logger = loggerFactory(import.meta);
10
-
11
- const tokenizer = await AutoTokenizer.from_pretrained('Xenova/t5-small');
12
-
13
- const model = await AutoModelForSeq2SeqLM.from_pretrained('Xenova/t5-small');
14
-
15
- const prompt = 'translate English to German: I love transformers!';
16
-
17
- logger.info('input', { prompt });
18
-
19
- const tokenizerData = await tokenizer(prompt);
20
-
21
- const { input_ids } = tokenizerData;
22
-
23
- const outputs = await model.generate(input_ids);
24
-
25
- for (const output of outputs) {
26
- const decoded = tokenizer.decode(output, { skip_special_tokens: true });
27
- logger.info('decoded', { decoded });
28
- }
package/startup.js DELETED
@@ -1,11 +0,0 @@
1
- import { shellExec } from './src/server/process.js';
2
-
3
- // /usr/bin/supervisord -n
4
- // /usr/sbin/sshd -D
5
- shellExec(`/usr/bin/supervisord -n`, { async: true });
6
-
7
- shellExec(`sudo /opt/lampp/lampp start`, { async: true });
8
-
9
- shellExec(`/usr/bin/mongod -f /etc/mongod.conf`, { async: true });
10
-
11
- shellExec(`underpost new app server`);