underpost 2.8.857 → 2.8.861

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/cli.md CHANGED
@@ -1,46 +1,47 @@
1
- ## underpost ci/cd cli v2.8.857
1
+ ## underpost ci/cd cli v2.8.861
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
- ```
5
- Options:
6
- -V, --version output the version number
7
- -h, --help display help for command
4
+
5
+ ```
6
+ Options:
7
+ -V, --version output the version number
8
+ -h, --help display help for command
8
9
 
9
10
  Commands:
10
- new <app-name> Initializes a new Underpost project with a predefined structure.
11
- start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
12
- clone [options] <uri> Clones a specified GitHub repository into the current directory.
13
- pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
14
- cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
15
- push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
16
- env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
17
- config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
18
- root Displays the root path of the npm installation.
19
- cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
20
- deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
21
- secret [options] <platform> Manages secrets for various platforms.
22
- dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
23
- dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
24
- install Quickly imports Underpost npm dependencies by copying them.
25
- db [options] <deploy-list> Manages database operations, including import, export, and collection management.
26
- metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
27
- script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
28
- cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
29
- fs [options] [path] Manages file storage, defaulting to file upload operations.
30
- test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
31
- monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
32
- ssh [options] Import and start ssh server and client based on current default deployment ID.
33
- run [options] <runner-id> [path] Runs a script from the specified path.
34
- lxd [options] Manages LXD containers and virtual machines.
35
- baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
36
- help [command] display help for command
37
-
11
+ new [options] <app-name> Initializes a new Underpost project with a predefined structure.
12
+ start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
13
+ clone [options] <uri> Clones a specified GitHub repository into the current directory.
14
+ pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
15
+ cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
16
+ push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
17
+ env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
18
+ config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
19
+ root Displays the root path of the npm installation.
20
+ cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
21
+ deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
22
+ secret [options] <platform> Manages secrets for various platforms.
23
+ dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
24
+ dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
25
+ install Quickly imports Underpost npm dependencies by copying them.
26
+ db [options] <deploy-list> Manages database operations, including import, export, and collection management.
27
+ metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
28
+ script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
29
+ cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
30
+ fs [options] [path] Manages file storage, defaulting to file upload operations.
31
+ test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
32
+ monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
33
+ ssh [options] Import and start ssh server and client based on current default deployment ID.
34
+ run [options] <runner-id> [path] Runs a script from the specified path.
35
+ lxd [options] Manages LXD containers and virtual machines.
36
+ baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
37
+ help [command] display help for command
38
+
38
39
  ```
39
40
 
40
41
  ## Commands:
41
-
42
42
 
43
43
  ### `new` :
44
+
44
45
  ```
45
46
  Usage: underpost new [options] <app-name>
46
47
 
@@ -50,12 +51,13 @@ Arguments:
50
51
  app-name The name of the application to create.
51
52
 
52
53
  Options:
54
+ --dev Sets the development cli context
53
55
  -h, --help display help for command
54
-
56
+
55
57
  ```
56
-
57
58
 
58
59
  ### `start` :
60
+
59
61
  ```
60
62
  Usage: underpost start [options] <deploy-id> [env]
61
63
 
@@ -71,11 +73,11 @@ Options:
71
73
  --run Starts application servers and monitors their health.
72
74
  --build Triggers the client-side application build process.
73
75
  -h, --help display help for command
74
-
76
+
75
77
  ```
76
-
77
78
 
78
79
  ### `clone` :
80
+
79
81
  ```
80
82
  Usage: underpost clone [options] <uri>
81
83
 
@@ -88,11 +90,11 @@ Options:
88
90
  --bare Performs a bare clone, downloading only the .git files.
89
91
  -g8 Uses the g8 repository extension for cloning.
90
92
  -h, --help display help for command
91
-
93
+
92
94
  ```
93
-
94
95
 
95
96
  ### `pull` :
97
+
96
98
  ```
97
99
  Usage: underpost pull [options] <path> <uri>
98
100
 
@@ -106,11 +108,11 @@ Arguments:
106
108
  Options:
107
109
  -g8 Uses the g8 repository extension for pulling.
108
110
  -h, --help display help for command
109
-
111
+
110
112
  ```
111
-
112
113
 
113
114
  ### `cmt` :
115
+
114
116
  ```
115
117
  Usage: underpost cmt [options] <path> <commit-type> [module-tag] [message]
116
118
 
@@ -130,11 +132,11 @@ Options:
130
132
  --copy Copies the generated commit message to the clipboard.
131
133
  --info Displays information about available commit types.
132
134
  -h, --help display help for command
133
-
135
+
134
136
  ```
135
-
136
137
 
137
138
  ### `push` :
139
+
138
140
  ```
139
141
  Usage: underpost push [options] <path> <uri>
140
142
 
@@ -148,11 +150,11 @@ Options:
148
150
  -f Forces the push, overwriting the remote repository history.
149
151
  -g8 Uses the g8 repository extension for pushing.
150
152
  -h, --help display help for command
151
-
153
+
152
154
  ```
153
-
154
155
 
155
156
  ### `env` :
157
+
156
158
  ```
157
159
  Usage: underpost env [options] <deploy-id> [env]
158
160
 
@@ -167,11 +169,11 @@ Arguments:
167
169
 
168
170
  Options:
169
171
  -h, --help display help for command
170
-
172
+
171
173
  ```
172
-
173
174
 
174
175
  ### `config` :
176
+
175
177
  ```
176
178
  Usage: underpost config [options] <operator> [key] [value]
177
179
 
@@ -186,11 +188,11 @@ Arguments:
186
188
  Options:
187
189
  --plain Prints the configuration value in plain text.
188
190
  -h, --help display help for command
189
-
191
+
190
192
  ```
191
-
192
193
 
193
194
  ### `root` :
195
+
194
196
  ```
195
197
  Usage: underpost root [options]
196
198
 
@@ -198,11 +200,11 @@ Displays the root path of the npm installation.
198
200
 
199
201
  Options:
200
202
  -h, --help display help for command
201
-
203
+
202
204
  ```
203
-
204
205
 
205
206
  ### `cluster` :
207
+
206
208
  ```
207
209
  Usage: underpost cluster [options] [pod-name]
208
210
 
@@ -259,11 +261,11 @@ Options:
259
261
  --k3s Initializes the cluster using K3s (Lightweight
260
262
  Kubernetes).
261
263
  -h, --help display help for command
262
-
264
+
263
265
  ```
264
-
265
266
 
266
267
  ### `deploy` :
268
+
267
269
  ```
268
270
  Usage: underpost deploy [options] [deploy-list] [env]
269
271
 
@@ -305,11 +307,11 @@ Options:
305
307
  operations.
306
308
  --restore-hosts Restores default `/etc/hosts` entries.
307
309
  -h, --help display help for command
308
-
310
+
309
311
  ```
310
-
311
312
 
312
313
  ### `secret` :
314
+
313
315
  ```
314
316
  Usage: underpost secret [options] <platform>
315
317
 
@@ -327,11 +329,11 @@ Options:
327
329
  --list Lists all available secrets for the
328
330
  platform.
329
331
  -h, --help display help for command
330
-
332
+
331
333
  ```
332
-
333
334
 
334
335
  ### `dockerfile-image-build` :
336
+
335
337
  ```
336
338
  Usage: underpost dockerfile-image-build [options]
337
339
 
@@ -358,11 +360,11 @@ Options:
358
360
  cache.
359
361
  --k3s-load Loads the image into a K3s cluster.
360
362
  -h, --help display help for command
361
-
363
+
362
364
  ```
363
-
364
365
 
365
366
  ### `dockerfile-pull-base-images` :
367
+
366
368
  ```
367
369
  Usage: underpost dockerfile-pull-base-images [options]
368
370
 
@@ -376,11 +378,11 @@ Options:
376
378
  --version Sets a custom version for the base images.
377
379
  --k3s-load Loads the image into a K3s cluster.
378
380
  -h, --help display help for command
379
-
381
+
380
382
  ```
381
-
382
383
 
383
384
  ### `install` :
385
+
384
386
  ```
385
387
  Usage: underpost install [options]
386
388
 
@@ -388,11 +390,11 @@ Quickly imports Underpost npm dependencies by copying them.
388
390
 
389
391
  Options:
390
392
  -h, --help display help for command
391
-
393
+
392
394
  ```
393
-
394
395
 
395
396
  ### `db` :
397
+
396
398
  ```
397
399
  Usage: underpost db [options] <deploy-list>
398
400
 
@@ -422,11 +424,11 @@ Options:
422
424
  --ns <ns-name> Optional: Specifies the namespace context for
423
425
  database operations.
424
426
  -h, --help display help for command
425
-
427
+
426
428
  ```
427
-
428
429
 
429
430
  ### `metadata` :
431
+
430
432
  ```
431
433
  Usage: underpost metadata [options] [deploy-id] [host] [path]
432
434
 
@@ -442,12 +444,14 @@ Options:
442
444
  --export Exports to local storage.
443
445
  --crons Apply to cron data collection
444
446
  --instances Apply to instance data collection
447
+ --generate Generate cluster metadata
448
+ --itc Apply under container execution context
445
449
  -h, --help display help for command
446
-
450
+
447
451
  ```
448
-
449
452
 
450
453
  ### `script` :
454
+
451
455
  ```
452
456
  Usage: underpost script [options] <operator> <script-name> [script-value]
453
457
 
@@ -469,11 +473,11 @@ Options:
469
473
  execution.
470
474
  --pod-name <pod-name> Optional: Specifies the pod name for script execution.
471
475
  -h, --help display help for command
472
-
476
+
473
477
  ```
474
-
475
478
 
476
479
  ### `cron` :
480
+
477
481
  ```
478
482
  Usage: underpost cron [options] [deploy-list] [job-list]
479
483
 
@@ -483,19 +487,19 @@ updates.
483
487
  Arguments:
484
488
  deploy-list A comma-separated list of deployment IDs (e.g.,
485
489
  "default-a,default-b").
486
- job-list A comma-separated list of job IDs. Options: callback. Defaults
487
- to all available jobs.
490
+ job-list A comma-separated list of job IDs. Options: callback,
491
+ getRelatedDeployId. Defaults to all available jobs.
488
492
 
489
493
  Options:
490
494
  --itc Executes cron jobs within the container execution context.
491
495
  --init Initializes cron jobs for the default deployment ID.
492
496
  --git Uploads cron job configurations to GitHub.
493
497
  -h, --help display help for command
494
-
498
+
495
499
  ```
496
-
497
500
 
498
501
  ### `fs` :
502
+
499
503
  ```
500
504
  Usage: underpost fs [options] [path]
501
505
 
@@ -513,11 +517,11 @@ Options:
513
517
  --force Forces the action, overriding any warnings or conflicts.
514
518
  --storage-file-path <storage-file-path> Specifies a custom file storage path.
515
519
  -h, --help display help for command
516
-
520
+
517
521
  ```
518
-
519
522
 
520
523
  ### `test` :
524
+
521
525
  ```
522
526
  Usage: underpost test [options] [deploy-list]
523
527
 
@@ -539,11 +543,11 @@ Options:
539
543
  --kind-type <kind-type> Optional: Specifies the Kind cluster type for
540
544
  tests.
541
545
  -h, --help display help for command
542
-
546
+
543
547
  ```
544
-
545
548
 
546
549
  ### `monitor` :
550
+
547
551
  ```
548
552
  Usage: underpost monitor [options] <deploy-id> [env]
549
553
 
@@ -566,11 +570,11 @@ Options:
566
570
  --sync Synchronizes with current proxy deployments and
567
571
  traffic configurations.
568
572
  -h, --help display help for command
569
-
573
+
570
574
  ```
571
-
572
575
 
573
576
  ### `ssh` :
577
+
574
578
  ```
575
579
  Usage: underpost ssh [options]
576
580
 
@@ -580,18 +584,18 @@ Options:
580
584
  --generate Generates new ssh credential and stores it in current private
581
585
  keys file storage.
582
586
  -h, --help display help for command
583
-
587
+
584
588
  ```
585
-
586
589
 
587
590
  ### `run` :
591
+
588
592
  ```
589
593
  Usage: underpost run [options] <runner-id> [path]
590
594
 
591
595
  Runs a script from the specified path.
592
596
 
593
597
  Arguments:
594
- runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, gpu-env, tf-gpu-test, dev-cluster, ssh-cluster-info, cyberia-ide, engine-ide, template-deploy, clean, pull, release-deploy, ssh-deploy, ide, monitor, db-client, cluster, deploy, tf-vae-test, deploy-job.
598
+ 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, cyberia-ide, engine-ide, template-deploy, clean, pull, release-deploy, ssh-deploy, ide, dev-client, dev-api, monitor, db-client, promote, metrics, cluster, deploy, tf-vae-test, deploy-job.
595
599
  path The absolute or relative directory path where the script is located.
596
600
 
597
601
  Options:
@@ -606,11 +610,11 @@ Options:
606
610
  --container-name <container-name> Optional: Specifies the container name for test execution.
607
611
  --namespace <namespace> Optional: Specifies the namespace for test execution.
608
612
  -h, --help display help for command
609
-
613
+
610
614
  ```
611
-
612
615
 
613
616
  ### `lxd` :
617
+
614
618
  ```
615
619
  Usage: underpost lxd [options]
616
620
 
@@ -651,11 +655,11 @@ Options:
651
655
  --auto-expose-k8s-ports <vm-id> Automatically exposes common Kubernetes
652
656
  ports for the specified VM.
653
657
  -h, --help display help for command
654
-
658
+
655
659
  ```
656
-
657
660
 
658
661
  ### `baremetal` :
662
+
659
663
  ```
660
664
  Usage: underpost baremetal [options] [workflow-id] [hostname] [ip-address]
661
665
 
@@ -689,6 +693,5 @@ Options:
689
693
  baremetal operations.
690
694
  --ls Lists available boot resources and machines.
691
695
  -h, --help display help for command
692
-
696
+
693
697
  ```
694
-
package/conf.js CHANGED
@@ -148,7 +148,7 @@ const DefaultConf = /**/ {
148
148
  origins: [],
149
149
  minifyBuild: false,
150
150
  iconsBuild: true,
151
- liteBuild: false,
151
+ liteBuild: true,
152
152
  docsBuild: false,
153
153
  offlineBuild: false,
154
154
  ws: 'core',
@@ -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.857
20
+ image: localhost/rockylinux9-underpost:v2.8.861
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.857
103
+ image: localhost/rockylinux9-underpost:v2.8.861
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
package/package.json CHANGED
@@ -2,14 +2,14 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.8.857",
5
+ "version": "2.8.861",
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",
9
9
  "build": "node bin/deploy build-full-client",
10
10
  "test": "env-cmd -f .env.test c8 mocha",
11
11
  "pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine",
12
- "dev": "env-cmd -f .env.development node src/client.dev default",
12
+ "dev": "env-cmd -f .env.development nodemon src/server",
13
13
  "dev-img": "env-cmd -f .env.development node src/server",
14
14
  "prod-img": "env-cmd -f .env.production node src/server",
15
15
  "monitor": "pm2 start src/monitor.js --name monitor -- dd production",
@@ -11,9 +11,9 @@ const UserRouter = (options) => {
11
11
  const router = express.Router();
12
12
 
13
13
  (async () => {
14
- const models = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models;
15
- if (models.User) {
16
- try {
14
+ try {
15
+ const models = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models;
16
+ if (models.User) {
17
17
  const adminUser = await models.User.findOne({ role: 'admin' });
18
18
  if (!adminUser) {
19
19
  const defaultPassword = process.env.DEFAULT_ADMIN_PASSWORD || 'changethis';
@@ -29,10 +29,12 @@ const UserRouter = (options) => {
29
29
  });
30
30
  logger.warn('Default admin user created. Please change the default password immediately!', result._doc);
31
31
  }
32
- } catch (error) {
33
- logger.error('Error checking/creating admin user:', error);
34
32
  }
33
+ } catch (error) {
34
+ logger.error('Error checking/creating admin user');
35
+ console.log(error);
35
36
  }
37
+
36
38
  options.png = {
37
39
  buffer: {
38
40
  'invalid-token': fs.readFileSync(`./src/client/public/default/assets/mailer/api-user-invalid-token.png`),
package/src/cli/cron.js CHANGED
@@ -21,7 +21,6 @@ const logger = loggerFactory(import.meta);
21
21
  * @memberof UnderpostCron
22
22
  */
23
23
  class UnderpostCron {
24
- static NETWORK = [];
25
24
  static JOB = {
26
25
  /**
27
26
  * DNS cli API
@@ -53,7 +52,6 @@ class UnderpostCron {
53
52
  options = { itc: false, init: false, git: false },
54
53
  ) {
55
54
  if (options.init === true) {
56
- UnderpostCron.NETWORK = [];
57
55
  const jobDeployId = fs.readFileSync('./engine-private/deploy/dd.cron', 'utf8').trim();
58
56
  deployList = fs.readFileSync('./engine-private/deploy/dd.router', 'utf8').trim();
59
57
  const confCronConfig = JSON.parse(fs.readFileSync(`./engine-private/conf/${jobDeployId}/conf.cron.json`));
@@ -62,21 +60,8 @@ class UnderpostCron {
62
60
  const name = `${jobDeployId}-${job}`;
63
61
  let deployId;
64
62
  shellExec(Cmd.delete(name));
65
- switch (job) {
66
- case 'dns':
67
- deployId = jobDeployId;
68
- break;
69
-
70
- default:
71
- deployId = deployList;
72
- break;
73
- }
63
+ deployId = UnderpostCron.API.getRelatedDeployId(job);
74
64
  shellExec(Cmd.cron(deployId, job, name, confCronConfig.jobs[job].expression, options));
75
- UnderpostCron.NETWORK.push({
76
- deployId,
77
- jobId: job,
78
- expression: confCronConfig.jobs[job].expression,
79
- });
80
65
  }
81
66
  }
82
67
  if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
@@ -87,6 +72,16 @@ class UnderpostCron {
87
72
  if (UnderpostCron.JOB[jobId]) await UnderpostCron.JOB[jobId].callback(deployList, options);
88
73
  }
89
74
  },
75
+ getRelatedDeployId(jobId) {
76
+ switch (jobId) {
77
+ case 'dns':
78
+ return fs.readFileSync('./engine-private/deploy/dd.cron', 'utf8').trim();
79
+ case 'backup':
80
+ return fs.readFileSync('./engine-private/deploy/dd.router', 'utf8').trim();
81
+ default:
82
+ return fs.readFileSync('./engine-private/deploy/dd.cron', 'utf8').trim();
83
+ }
84
+ },
90
85
  };
91
86
  }
92
87