underpost 2.85.1 → 2.89.0

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 (53) hide show
  1. package/.env.development +2 -1
  2. package/.env.production +2 -1
  3. package/.env.test +2 -1
  4. package/.github/workflows/release.cd.yml +3 -3
  5. package/.vscode/zed.keymap.json +22 -0
  6. package/README.md +3 -3
  7. package/bin/build.js +8 -10
  8. package/bin/deploy.js +4 -2
  9. package/bin/file.js +4 -0
  10. package/bin/vs.js +4 -4
  11. package/cli.md +16 -11
  12. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  13. package/manifests/deployment/dd-test-development/deployment.yaml +50 -50
  14. package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
  15. package/package.json +2 -2
  16. package/src/api/file/file.service.js +29 -3
  17. package/src/cli/baremetal.js +4 -5
  18. package/src/cli/deploy.js +26 -4
  19. package/src/cli/index.js +8 -3
  20. package/src/cli/repository.js +42 -45
  21. package/src/cli/run.js +217 -48
  22. package/src/client/components/core/AgGrid.js +42 -3
  23. package/src/client/components/core/CommonJs.js +5 -0
  24. package/src/client/components/core/Css.js +95 -48
  25. package/src/client/components/core/CssCore.js +0 -1
  26. package/src/client/components/core/LoadingAnimation.js +2 -2
  27. package/src/client/components/core/Logger.js +2 -9
  28. package/src/client/components/core/Modal.js +22 -14
  29. package/src/client/components/core/ObjectLayerEngine.js +300 -9
  30. package/src/client/components/core/ObjectLayerEngineModal.js +686 -148
  31. package/src/client/components/core/ObjectLayerEngineViewer.js +1061 -0
  32. package/src/client/components/core/Pagination.js +15 -5
  33. package/src/client/components/core/Router.js +5 -1
  34. package/src/client/components/core/SocketIo.js +5 -1
  35. package/src/client/components/core/Translate.js +4 -0
  36. package/src/client/components/core/Worker.js +8 -1
  37. package/src/client/services/default/default.management.js +86 -16
  38. package/src/client/sw/default.sw.js +193 -97
  39. package/src/client.dev.js +1 -1
  40. package/src/db/mariadb/MariaDB.js +2 -2
  41. package/src/index.js +1 -1
  42. package/src/proxy.js +1 -1
  43. package/src/runtime/express/Express.js +4 -1
  44. package/src/server/auth.js +2 -1
  45. package/src/server/client-build.js +57 -2
  46. package/src/server/conf.js +132 -15
  47. package/src/server/object-layer.js +44 -0
  48. package/src/server/proxy.js +53 -26
  49. package/src/server/start.js +25 -3
  50. package/src/server/tls.js +1 -1
  51. package/src/ws/IoInterface.js +2 -3
  52. package/AUTHORS.md +0 -21
  53. package/src/server/network.js +0 -72
package/.env.development CHANGED
@@ -42,4 +42,5 @@ RPI4_MAC_ADDRESS=changethis
42
42
  NVIDIA_API_KEY=changethis
43
43
  DEFAULT_ADMIN_EMAIL=admin@default.net
44
44
  DEFAULT_ADMIN_PASSWORD=changethis
45
- BASE_API=api
45
+ BASE_API=api
46
+ DEV_PROXY_PORT_OFFSET=200
package/.env.production CHANGED
@@ -51,4 +51,5 @@ NPM_USER=changethis
51
51
  NPM_PASSWORD=changethis
52
52
  BASE_API=api
53
53
  CERTBOT_LIVE_PATH=changethis
54
- CERTBOT_LIVE_PATH_WINDOWS=changethis
54
+ CERTBOT_LIVE_PATH_WINDOWS=changethis
55
+ DEV_PROXY_PORT_OFFSET=200
package/.env.test CHANGED
@@ -42,4 +42,5 @@ RPI4_MAC_ADDRESS=changethis
42
42
  NVIDIA_API_KEY=changethis
43
43
  DEFAULT_ADMIN_EMAIL=admin@default.net
44
44
  DEFAULT_ADMIN_PASSWORD=changethis
45
- BASE_API=api
45
+ BASE_API=api
46
+ DEV_PROXY_PORT_OFFSET=200
@@ -29,8 +29,8 @@ jobs:
29
29
  set -e
30
30
  echo "Starting remote release deploy"
31
31
  underpost run pull
32
- underpost run git-conf
33
32
  underpost run secret
34
33
  cd /home/dd/engine
35
- underpost run template-deploy-image
36
- underpost run ssh-deploy sync-engine-test
34
+ node bin run --dev git-conf
35
+ node bin run --dev template-deploy-image
36
+ node bin run --dev ssh-deploy sync-engine-test
@@ -1,4 +1,26 @@
1
1
  [
2
+ {
3
+ "context": "Editor",
4
+ "bindings": {
5
+ "ctrl-c": "editor::Copy",
6
+ "ctrl-x": "editor::Cut",
7
+ "ctrl-v": "editor::Paste",
8
+ "ctrl-shift-c": "editor::CopyAndTrim",
9
+ "ctrl-shift-v": "editor::Paste",
10
+ "cmd-c": "editor::Copy",
11
+ "cmd-x": "editor::Cut",
12
+ "cmd-v": "editor::Paste"
13
+ }
14
+ },
15
+ {
16
+ "context": "Terminal",
17
+ "bindings": {
18
+ "ctrl-shift-c": "terminal::Copy",
19
+ "ctrl-shift-v": "terminal::Paste",
20
+ "cmd-shift-c": "terminal::Copy",
21
+ "cmd-shift-v": "terminal::Paste"
22
+ }
23
+ },
2
24
  {
3
25
  "context": "Editor && edit_prediction",
4
26
  "bindings": {
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.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)
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.0)](https://socket.dev/npm/package/underpost/overview/2.89.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)
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.1
69
+ ## underpost ci/cd cli v2.89.0
70
70
 
71
71
  ### Usage: `underpost [options] [command]`
72
72
  ```
@@ -75,7 +75,7 @@ npm run dev
75
75
  -h, --help display help for command
76
76
 
77
77
  Commands:
78
- new [options] <app-name> Initializes a new Underpost project, service, or configuration.
78
+ new [options] [app-name] Initializes a new Underpost project, service, or configuration.
79
79
  start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
80
80
  clone [options] <uri> Clones a specified GitHub repository into the current directory.
81
81
  pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
package/bin/build.js CHANGED
@@ -53,14 +53,14 @@ if (process.argv.includes('conf')) {
53
53
  fs.removeSync(toPath);
54
54
  fs.mkdirSync(toPath, { recursive: true });
55
55
  fs.copySync(`./engine-private/conf/${_confName}`, toPath);
56
- if (process.argv.includes('remove-replica') && fs.existsSync(`../${privateRepoName}/replica`)) {
57
- fs.removeSync(`../${privateRepoName}/replica`);
58
- } else if (fs.existsSync(`./engine-private/replica`)) {
56
+ fs.removeSync(`../${privateRepoName}/replica`);
57
+ if (fs.existsSync(`./engine-private/replica`)) {
59
58
  const replicas = await fs.readdir(`./engine-private/replica`);
60
59
  for (const replica of replicas)
61
60
  if (replica.match(_confName))
62
61
  fs.copySync(`./engine-private/replica/${replica}`, `../${privateRepoName}/replica/${replica}`);
63
62
  }
63
+
64
64
  if (fs.existsSync(`./engine-private/itc-scripts`)) {
65
65
  const itcScripts = await fs.readdir(`./engine-private/itc-scripts`);
66
66
  for (const itcScript of itcScripts)
@@ -149,10 +149,6 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
149
149
  }
150
150
  }
151
151
 
152
- shellExec(`node bin/deploy update-default-conf ${confName}`);
153
-
154
- fs.copyFileSync(`./conf.${confName}.js`, `${basePath}/conf.js`);
155
-
156
152
  if (!fs.existsSync(`${basePath}/.github/workflows`))
157
153
  fs.mkdirSync(`${basePath}/.github/workflows`, {
158
154
  recursive: true,
@@ -170,11 +166,12 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
170
166
  );
171
167
  delete packageJson.bin.underpost;
172
168
  packageJson.bin.cyberia = 'bin/index.js';
173
- packageJson.keywords = ['cyberia', 'object-layer', 'game-engine', 'assets-management'];
174
-
169
+ packageJson.keywords = ['cyberia', 'object-layer', 'game-engine', 'assets-management', 'web3'];
170
+ packageJson.description = 'Cyberia Engine - Object Layer and Assets Management Microservice';
175
171
  fs.writeFileSync(`${basePath}/bin/index.js`, fs.readFileSync(`./bin/cyberia.js`, 'utf8'), 'utf8');
176
172
  fs.copyFileSync(`./src/api/object-layer/README.md`, `${basePath}/README.md`);
177
-
173
+ fs.copySync(`./hardhat`, `${basePath}/hardhat`);
174
+ fs.copySync(`./hardhat/white-paper.md`, `${basePath}/white-paper.md`);
178
175
  default:
179
176
  break;
180
177
  }
@@ -200,6 +197,7 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
200
197
  fs.copyFileSync(`./.github/workflows/${repoName}.ci.yml`, `${basePath}/.github/workflows/${repoName}.ci.yml`);
201
198
  fs.copyFileSync(`./.github/workflows/${repoName}.cd.yml`, `${basePath}/.github/workflows/${repoName}.cd.yml`);
202
199
 
200
+ // Copy conf.<deploy-id>.js to conf.js for the respective deployment
203
201
  fs.copyFileSync(`./conf.${confName}.js`, `${basePath}/conf.js`);
204
202
  fs.copyFileSync(`./manifests/deployment/${confName}-development/proxy.yaml`, `${basePath}/proxy.yaml`);
205
203
  fs.copyFileSync(`./manifests/deployment/${confName}-development/deployment.yaml`, `${basePath}/deployment.yaml`);
package/bin/deploy.js CHANGED
@@ -380,6 +380,7 @@ try {
380
380
  }
381
381
 
382
382
  case 'version-build': {
383
+ dotenv.config({ path: `./engine-private/conf/dd-cron/.env.production`, override: true });
383
384
  shellCd(`/home/dd/engine`);
384
385
  shellExec(`node bin/deploy clean-core-repo`);
385
386
  shellExec(`node bin pull . ${process.env.GITHUB_USERNAME}/engine`);
@@ -493,6 +494,7 @@ try {
493
494
  }
494
495
 
495
496
  case 'version-deploy': {
497
+ dotenv.config({ path: `./engine-private/conf/dd-cron/.env.production`, override: true });
496
498
  shellExec(
497
499
  `underpost secret underpost --create-from-file /home/dd/engine/engine-private/conf/dd-cron/.env.production`,
498
500
  );
@@ -1302,8 +1304,8 @@ nvidia/gpu-operator \
1302
1304
 
1303
1305
  case 'tls': {
1304
1306
  fs.mkdirSync(`./engine-private/ssl/localhost`, { recursive: true });
1305
- const targetDir = `./engine-private/ssl/localhost`;
1306
- const domains = ['localhost', '127.0.0.1', '::1'];
1307
+ const targetDir = `./engine-private/ssl/${process.argv[3] ? process.argv[3] : 'localhost'}`;
1308
+ const domains = ['localhost', '127.0.0.1', '::1'].concat(process.argv[3] ? process.argv[3] : []);
1307
1309
  shellExec(`chmod +x ./scripts/ssl.sh`);
1308
1310
  shellExec(`./scripts/ssl.sh ${targetDir} "${domains.join(' ')}"`);
1309
1311
  break;
package/bin/file.js CHANGED
@@ -11,9 +11,12 @@ import {
11
11
  import { shellCd, shellExec } from '../src/server/process.js';
12
12
  import walk from 'ignore-walk';
13
13
  import { validateTemplatePath } from '../src/server/conf.js';
14
+ import dotenv from 'dotenv';
14
15
 
15
16
  const logger = loggerFactory(import.meta);
16
17
 
18
+ dotenv.config({ path: `./engine-private/conf/dd-cron/.env.production`, override: true });
19
+
17
20
  logger.info('argv', process.argv);
18
21
 
19
22
  let [exe, dir, type] = process.argv;
@@ -69,6 +72,7 @@ try {
69
72
  }
70
73
 
71
74
  for (const copyPath of result) {
75
+ if (copyPath === 'NaN') continue;
72
76
  const folder = getDirname(`${toPath}/${copyPath}`);
73
77
  const absolutePath = `${rawPath}/${copyPath}`;
74
78
 
package/bin/vs.js CHANGED
@@ -4,11 +4,11 @@ import { loggerFactory } from '../src/server/logger.js';
4
4
 
5
5
  const logger = loggerFactory(import.meta);
6
6
 
7
- // const vsCodeRootPath = '/root/.vscode-root';
8
- // const vsProgram = 'code';
7
+ const vsCodeRootPath = '/root/.vscode-root';
8
+ const vsProgram = 'code';
9
9
 
10
- const vsCodeRootPath = '/root/.windsurf';
11
- const vsProgram = 'windsurf';
10
+ // const vsCodeRootPath = '/root/.windsurf';
11
+ // const vsProgram = 'windsurf';
12
12
 
13
13
  switch (process.argv[2]) {
14
14
  case 'info': {
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.85.1
1
+ ## underpost ci/cd cli v2.89.0
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -7,7 +7,7 @@
7
7
  -h, --help display help for command
8
8
 
9
9
  Commands:
10
- new [options] <app-name> Initializes a new Underpost project, service, or configuration.
10
+ new [options] [app-name] Initializes a new Underpost project, service, or configuration.
11
11
  start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
12
12
  clone [options] <uri> Clones a specified GitHub repository into the current directory.
13
13
  pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
@@ -42,20 +42,20 @@ Commands:
42
42
 
43
43
  ### `new` :
44
44
  ```
45
- Usage: underpost new [options] <app-name>
45
+ Usage: underpost new [options] [app-name]
46
46
 
47
47
  Initializes a new Underpost project, service, or configuration.
48
48
 
49
49
  Arguments:
50
- app-name The name or deploy-id of the application to create.
50
+ app-name The name of the new project.
51
51
 
52
52
  Options:
53
- --deploy-id Crete deploy ID conf env files
54
- --cluster Create deploy ID cluster files and sync to current
55
- cluster
56
- --dev Sets the development cli context
57
- --sub-conf <sub-conf> Create sub conf env files
58
- -h, --help display help for command
53
+ --deploy-id <deploy-id> Crete deploy ID conf env files
54
+ --sub-conf <sub-conf> Create sub conf env files
55
+ --cluster Create deploy ID cluster files and sync to current
56
+ cluster
57
+ --dev Sets the development cli context
58
+ -h, --help display help for command
59
59
 
60
60
  ```
61
61
 
@@ -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, dev-container, monitor, db-client, git-conf, promote, metrics, cluster, deploy, service, 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, cluster-build, template-deploy, template-deploy-image, clean, pull, release-deploy, ssh-deploy, ide, sync, tz, cron, ls-deployments, ls-images, host-update, dev-container, monitor, db-client, git-conf, promote, metrics, cluster, deploy, dev, service, sh, log, release-cmt, 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:
@@ -642,6 +642,11 @@ Options:
642
642
  --kubeadm Flag to indicate Kubeadm cluster type context
643
643
  --k3s Flag to indicate K3s cluster type context
644
644
  --force Forces operation, overriding any warnings or conflicts.
645
+ --tls Enables TLS for the runner execution.
646
+ --reset Resets the runner state before execution.
647
+ --terminal Enables terminal mode for interactive script execution.
648
+ --dev-proxy-port-offset <port-offset> Sets a custom port offset for development proxy.
649
+ --conf-server-path <conf-server-path> Sets a custom configuration server path.
645
650
  -h, --help display help for command
646
651
 
647
652
  ```
@@ -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.1
20
+ image: localhost/rockylinux9-underpost:v2.89.0
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.1
103
+ image: localhost/rockylinux9-underpost:v2.89.0
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.1
20
+ image: localhost/rockylinux9-underpost:v2.89.0
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "96294Ki"
@@ -49,41 +49,41 @@ spec:
49
49
  selector:
50
50
  app: dd-test-development-blue
51
51
  ports:
52
- - name: 'tcp-4041'
52
+ - name: 'tcp-4030'
53
53
  protocol: TCP
54
- port: 4041
55
- targetPort: 4041
56
- - name: 'udp-4041'
54
+ port: 4030
55
+ targetPort: 4030
56
+ - name: 'udp-4030'
57
57
  protocol: UDP
58
- port: 4041
59
- targetPort: 4041
58
+ port: 4030
59
+ targetPort: 4030
60
60
 
61
- - name: 'tcp-4042'
61
+ - name: 'tcp-4031'
62
62
  protocol: TCP
63
- port: 4042
64
- targetPort: 4042
65
- - name: 'udp-4042'
63
+ port: 4031
64
+ targetPort: 4031
65
+ - name: 'udp-4031'
66
66
  protocol: UDP
67
- port: 4042
68
- targetPort: 4042
67
+ port: 4031
68
+ targetPort: 4031
69
69
 
70
- - name: 'tcp-4043'
70
+ - name: 'tcp-4032'
71
71
  protocol: TCP
72
- port: 4043
73
- targetPort: 4043
74
- - name: 'udp-4043'
72
+ port: 4032
73
+ targetPort: 4032
74
+ - name: 'udp-4032'
75
75
  protocol: UDP
76
- port: 4043
77
- targetPort: 4043
76
+ port: 4032
77
+ targetPort: 4032
78
78
 
79
- - name: 'tcp-4044'
79
+ - name: 'tcp-4033'
80
80
  protocol: TCP
81
- port: 4044
82
- targetPort: 4044
83
- - name: 'udp-4044'
81
+ port: 4033
82
+ targetPort: 4033
83
+ - name: 'udp-4033'
84
84
  protocol: UDP
85
- port: 4044
86
- targetPort: 4044
85
+ port: 4033
86
+ targetPort: 4033
87
87
  type: LoadBalancer
88
88
  ---
89
89
  apiVersion: apps/v1
@@ -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.1
107
+ image: localhost/rockylinux9-underpost:v2.89.0
108
108
  # resources:
109
109
  # requests:
110
110
  # memory: "96294Ki"
@@ -136,39 +136,39 @@ spec:
136
136
  selector:
137
137
  app: dd-test-development-green
138
138
  ports:
139
- - name: 'tcp-4041'
139
+ - name: 'tcp-4030'
140
140
  protocol: TCP
141
- port: 4041
142
- targetPort: 4041
143
- - name: 'udp-4041'
141
+ port: 4030
142
+ targetPort: 4030
143
+ - name: 'udp-4030'
144
144
  protocol: UDP
145
- port: 4041
146
- targetPort: 4041
145
+ port: 4030
146
+ targetPort: 4030
147
147
 
148
- - name: 'tcp-4042'
148
+ - name: 'tcp-4031'
149
149
  protocol: TCP
150
- port: 4042
151
- targetPort: 4042
152
- - name: 'udp-4042'
150
+ port: 4031
151
+ targetPort: 4031
152
+ - name: 'udp-4031'
153
153
  protocol: UDP
154
- port: 4042
155
- targetPort: 4042
154
+ port: 4031
155
+ targetPort: 4031
156
156
 
157
- - name: 'tcp-4043'
157
+ - name: 'tcp-4032'
158
158
  protocol: TCP
159
- port: 4043
160
- targetPort: 4043
161
- - name: 'udp-4043'
159
+ port: 4032
160
+ targetPort: 4032
161
+ - name: 'udp-4032'
162
162
  protocol: UDP
163
- port: 4043
164
- targetPort: 4043
163
+ port: 4032
164
+ targetPort: 4032
165
165
 
166
- - name: 'tcp-4044'
166
+ - name: 'tcp-4033'
167
167
  protocol: TCP
168
- port: 4044
169
- targetPort: 4044
170
- - name: 'udp-4044'
168
+ port: 4033
169
+ targetPort: 4033
170
+ - name: 'udp-4033'
171
171
  protocol: UDP
172
- port: 4044
173
- targetPort: 4044
172
+ port: 4033
173
+ targetPort: 4033
174
174
  type: LoadBalancer
@@ -13,7 +13,7 @@ spec:
13
13
  enableWebsockets: true
14
14
  services:
15
15
  - name: dd-test-development-blue-service
16
- port: 4041
16
+ port: 4030
17
17
  weight: 100
18
18
 
19
19
  - conditions:
@@ -21,7 +21,7 @@ spec:
21
21
  enableWebsockets: true
22
22
  services:
23
23
  - name: dd-test-development-blue-service
24
- port: 4042
24
+ port: 4031
25
25
  weight: 100
26
26
 
27
27
  ---
@@ -38,7 +38,7 @@ spec:
38
38
  enableWebsockets: true
39
39
  services:
40
40
  - name: dd-test-development-blue-service
41
- port: 4043
41
+ port: 4032
42
42
  weight: 100
43
43
 
44
44
  - conditions:
@@ -46,6 +46,6 @@ spec:
46
46
  enableWebsockets: true
47
47
  services:
48
48
  - name: dd-test-development-blue-service
49
- port: 4044
49
+ port: 4033
50
50
  weight: 100
51
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.85.1",
5
+ "version": "2.89.0",
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",
@@ -15,7 +15,7 @@
15
15
  "monitor": "pm2 start src/monitor.js --name monitor -- dd production",
16
16
  "dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
17
17
  "dev-client": "env-cmd -f .env.development node src/client.dev",
18
- "proxy": "node src/proxy proxy",
18
+ "dev-proxy": "env-cmd -f .env.development node src/proxy proxy",
19
19
  "docs": "jsdoc -c jsdoc.json",
20
20
  "install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd",
21
21
  "install-test": "npm install -g mocha && npm install -g c8 && npm install -g coveralls",
@@ -7,9 +7,35 @@ const logger = loggerFactory(import.meta);
7
7
  const FileFactory = {
8
8
  filesExtract: (req) => {
9
9
  const files = [];
10
- if (Array.isArray(req.files.file)) for (const file of req.files.file) files.push(file);
11
- else if (Object.keys(req.files).length > 0)
12
- for (const keyFile of Object.keys(req.files)) files.push(req.files[keyFile]);
10
+ if (!req.files || Object.keys(req.files).length === 0) {
11
+ return files;
12
+ }
13
+
14
+ // Handle standard 'file' field
15
+ if (Array.isArray(req.files.file)) {
16
+ for (const file of req.files.file) files.push(file);
17
+ } else if (req.files.file) {
18
+ files.push(req.files.file);
19
+ }
20
+
21
+ // Handle all other fields (like direction codes)
22
+ for (const keyFile of Object.keys(req.files)) {
23
+ if (keyFile === 'file') continue; // Already handled above
24
+
25
+ const fileOrFiles = req.files[keyFile];
26
+ if (Array.isArray(fileOrFiles)) {
27
+ // Multiple files with same field name
28
+ for (const file of fileOrFiles) {
29
+ if (file && file.data) {
30
+ files.push(file);
31
+ }
32
+ }
33
+ } else if (fileOrFiles && fileOrFiles.data) {
34
+ // Single file
35
+ files.push(fileOrFiles);
36
+ }
37
+ }
38
+
13
39
  return files;
14
40
  },
15
41
  upload: async function (req, File) {
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Baremetal module for managing the generation and deployment of cloud-init configuration files
3
- * and associated scripts for baremetal provisioning.
2
+ * Provides baremetal provisioning and configuration functionalities.
4
3
  * @module src/cli/baremetal.js
5
4
  * @namespace UnderpostBaremetal
6
5
  */
@@ -76,9 +75,9 @@ class UnderpostBaremetal {
76
75
  const underpostRoot = options?.dev === true ? '.' : `${npmRoot}/underpost`;
77
76
 
78
77
  // Set default values if not provided.
79
- workflowId = workflowId ?? 'rpi4mb';
80
- hostname = hostname ?? workflowId;
81
- ipAddress = ipAddress ?? '192.168.1.192';
78
+ workflowId = workflowId ? workflowId : 'rpi4mb';
79
+ hostname = hostname ? hostname : workflowId;
80
+ ipAddress = ipAddress ? ipAddress : '192.168.1.192';
82
81
 
83
82
  // Set default MAC address
84
83
  let macAddress = '00:00:00:00:00:00';
package/src/cli/deploy.js CHANGED
@@ -80,7 +80,7 @@ class UnderpostDeploy {
80
80
  process.env.PORT = initEnvObj.PORT;
81
81
  process.env.NODE_ENV = env;
82
82
  await Config.build('proxy', deployList);
83
- return buildPortProxyRouter(env === 'development' ? 80 : 443, buildProxyRouter());
83
+ return buildPortProxyRouter({ port: env === 'development' ? 80 : 443, proxyRouter: buildProxyRouter() });
84
84
  },
85
85
  /**
86
86
  * Creates a YAML service configuration for a deployment.
@@ -689,15 +689,37 @@ EOF`);
689
689
  /**
690
690
  * Creates a hosts file for a deployment.
691
691
  * @param {Array<string>} hosts - List of hosts to be added to the hosts file.
692
+ * @param {object} options - Options for the hosts file creation.
693
+ * @param {boolean} options.append - Whether to append to the existing hosts file.
694
+ * @returns {object} - Object containing the rendered hosts file.
692
695
  * @memberof UnderpostDeploy
693
696
  */
694
- etcHostFactory(hosts = []) {
697
+ etcHostFactory(hosts = [], options = { append: false }) {
698
+ hosts = hosts.map((host) => {
699
+ try {
700
+ if (!host.startsWith('http')) host = `http://${host}`;
701
+ const hostname = new URL(host).hostname;
702
+ logger.info('Hostname extract valid', { host, hostname });
703
+ return hostname;
704
+ } catch (e) {
705
+ logger.warn('No hostname extract valid', host);
706
+ return host;
707
+ }
708
+ });
695
709
  const renderHosts = `127.0.0.1 ${hosts.join(
696
710
  ' ',
697
711
  )} localhost localhost.localdomain localhost4 localhost4.localdomain4
698
712
  ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6`;
699
713
 
700
- fs.writeFileSync(`/etc/hosts`, renderHosts, 'utf8');
714
+ if (options && options.append && fs.existsSync(`/etc/hosts`)) {
715
+ fs.writeFileSync(
716
+ `/etc/hosts`,
717
+ fs.readFileSync(`/etc/hosts`, 'utf8') +
718
+ `
719
+ ${renderHosts}`,
720
+ 'utf8',
721
+ );
722
+ } else fs.writeFileSync(`/etc/hosts`, renderHosts, 'utf8');
701
723
  return { renderHosts };
702
724
  },
703
725
  /**
@@ -768,7 +790,7 @@ EOF`);
768
790
  .filter((o) => o.image);
769
791
  }
770
792
  if (node === 'kind-worker') {
771
- const raw = shellExec(`docker exec -i kind-control-plane crictl images`, {
793
+ const raw = shellExec(`docker exec -i ${node} crictl images`, {
772
794
  stdout: true,
773
795
  silent: true,
774
796
  });
package/src/cli/index.js CHANGED
@@ -22,11 +22,11 @@ program.name('underpost').description(`underpost ci/cd cli ${Underpost.version}`
22
22
  // 'new' command: Create a new project
23
23
  program
24
24
  .command('new')
25
- .argument('<app-name>', 'The name or deploy-id of the application to create.')
26
- .option('--deploy-id', 'Crete deploy ID conf env files')
25
+ .argument('[app-name]', 'The name of the new project.')
26
+ .option('--deploy-id <deploy-id>', 'Crete deploy ID conf env files')
27
+ .option('--sub-conf <sub-conf>', 'Create sub conf env files')
27
28
  .option('--cluster', 'Create deploy ID cluster files and sync to current cluster')
28
29
  .option('--dev', 'Sets the development cli context')
29
- .option('--sub-conf <sub-conf>', 'Create sub conf env files')
30
30
  .description('Initializes a new Underpost project, service, or configuration.')
31
31
  .action(Underpost.repo.new);
32
32
 
@@ -389,6 +389,11 @@ program
389
389
  .option('--kubeadm', 'Flag to indicate Kubeadm cluster type context')
390
390
  .option('--k3s', 'Flag to indicate K3s cluster type context')
391
391
  .option('--force', 'Forces operation, overriding any warnings or conflicts.')
392
+ .option('--tls', 'Enables TLS for the runner execution.')
393
+ .option('--reset', 'Resets the runner state before execution.')
394
+ .option('--terminal', 'Enables terminal mode for interactive script execution.')
395
+ .option('--dev-proxy-port-offset <port-offset>', 'Sets a custom port offset for development proxy.')
396
+ .option('--conf-server-path <conf-server-path>', 'Sets a custom configuration server path.')
392
397
  .description('Runs a script from the specified path.')
393
398
  .action(UnderpostRun.API.callback);
394
399