underpost 2.90.4 → 2.92.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.
@@ -30,11 +30,11 @@ jobs:
30
30
  script: |
31
31
  set -e
32
32
  echo "Starting remote release deploy"
33
- underpost run pull
34
- underpost run secret
35
- npm install -g underpost
36
33
  cd /home/dd/engine
37
- underpost run secret
38
- node bin run --dev git-conf
39
- node bin run --dev template-deploy-image
40
- node bin run --dev ssh-deploy sync-engine-test
34
+ sudo -n -- /bin/bash -lc "node bin run pull"
35
+ sudo -n -- /bin/bash -lc "underpost run secret"
36
+ sudo -n -- /bin/bash -lc "npm install -g underpost"
37
+ sudo -n -- /bin/bash -lc "underpost run secret"
38
+ sudo -n -- /bin/bash -lc "node bin run --dev git-conf"
39
+ sudo -n -- /bin/bash -lc "node bin run --dev template-deploy-image"
40
+ sudo -n -- /bin/bash -lc "node bin run --dev ssh-deploy sync-engine-test"
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.90.4)](https://socket.dev/npm/package/underpost/overview/2.90.4) [![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.92.0)](https://socket.dev/npm/package/underpost/overview/2.92.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.90.4
69
+ ## underpost ci/cd cli v2.92.0
70
70
 
71
71
  ### Usage: `underpost [options] [command]`
72
72
  ```
@@ -85,21 +85,21 @@ Commands:
85
85
  static [options] Manages static build of page, bundles, and documentation with comprehensive customization options.
86
86
  config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
87
87
  root Displays the root path of the npm installation.
88
- ip [options] Displays the current public machine IP addresses.
88
+ ip [options] [ips] Displays the current public machine IP addresses.
89
89
  cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
90
90
  deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
91
91
  secret [options] <platform> Manages secrets for various platforms.
92
92
  dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
93
93
  dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
94
94
  install Quickly imports Underpost npm dependencies by copying them.
95
- db [options] <deploy-list> Manages database operations, including import, export, and collection management.
95
+ db [options] <deploy-list> Manages database operations with support for MariaDB and MongoDB, including import/export, multi-pod targeting, and Git integration.
96
96
  metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
97
97
  script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
98
98
  cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
99
99
  fs [options] [path] Manages file storage, defaulting to file upload operations.
100
100
  test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
101
101
  monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
102
- ssh [options] Import and start ssh server and client based on current default deployment ID.
102
+ ssh [options]
103
103
  run [options] <runner-id> [path] Runs a script from the specified path.
104
104
  lxd [options] Manages LXD containers and virtual machines.
105
105
  baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
package/bin/deploy.js CHANGED
@@ -663,133 +663,6 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
663
663
  break;
664
664
  }
665
665
 
666
- case 'ssh': {
667
- // only import + start
668
- // node bin/deploy ssh root@<host> <password> import
669
-
670
- // generate + import + start
671
- // node bin/deploy ssh root@<host> <password>
672
-
673
- const host = process.argv[3] ?? `root@${await Dns.getPublicIp()}`;
674
- const domain = host.split('@')[1];
675
- const user = 'root'; // host.split('@')[0];
676
- const password = process.argv[4] ?? '';
677
- const port = 22;
678
-
679
- const setUpSSH = () => {
680
- // Required port forwarding mapping
681
- // ssh TCP 2222 22 <local-server-ip>
682
- // ssh UDP 2222 22 <local-server-ip>
683
-
684
- // Remote connect via public key
685
- // ssh -i <key-path> <user>@<host>:2222
686
-
687
- shellExec(`cat ./engine-private/deploy/id_rsa.pub > ~/.ssh/authorized_keys`);
688
-
689
- // local trust on first use validator
690
- // check ~/.ssh/known_hosts
691
-
692
- // shellExec(`sudo sed -i -e "s@#PasswordAuthentication yes@PasswordAuthentication no@g" /etc/ssh/sshd_config`);
693
- // shellExec(`sudo sed -i -e "s@#UsePAM no@UsePAM yes@g" /etc/ssh/sshd_config`);
694
-
695
- // Include /etc/ssh/sshd_config.d/*.conf
696
- // sudo tee /etc/ssh/sshd_config.d/99-custom.conf
697
- shellExec(`sudo tee /etc/ssh/sshd_config <<EOF
698
- PasswordAuthentication no
699
- ChallengeResponseAuthentication yes
700
- UsePAM yes
701
- PubkeyAuthentication Yes
702
- RSAAuthentication Yes
703
- PermitRootLogin Yes
704
- X11Forwarding yes
705
- X11DisplayOffset 10
706
- LoginGraceTime 120
707
- StrictModes yes
708
- SyslogFacility AUTH
709
- LogLevel INFO
710
- #HostKey /etc/ssh/ssh_host_ecdsa_key
711
- HostKey /etc/ssh/ssh_host_ed25519_key
712
- #HostKey /etc/ssh/ssh_host_rsa_key
713
- AuthorizedKeysFile ~/.ssh/authorized_keys
714
- Subsystem sftp /usr/libexec/openssh/sftp-server
715
- ListenAddress 0.0.0.0
716
- ListenAddress ::
717
- ListenAddress ${domain}
718
- ListenAddress ${domain}:22
719
- EOF`);
720
-
721
- shellExec(`sudo chmod 700 ~/.ssh/`);
722
- shellExec(`sudo chmod 600 ~/.ssh/authorized_keys`);
723
- shellExec(`sudo chmod 644 ~/.ssh/known_hosts`);
724
- shellExec(`sudo chmod 600 ~/.ssh/id_rsa`);
725
- shellExec(`sudo chmod 600 /etc/ssh/ssh_host_ed25519_key`);
726
- shellExec(`chown -R ${user}:${user} ~/.ssh`);
727
-
728
- shellExec(`ufw allow ${port}/tcp`);
729
- shellExec(`ufw allow ${port}/udp`);
730
- shellExec(`ufw allow ssh`);
731
- shellExec(`ufw allow from 192.168.0.0/16 to any port 22`);
732
-
733
- // active ssh-agent
734
- shellExec('eval `ssh-agent -s`' + ` && ssh-add ~/.ssh/id_rsa` + ` && ssh-add -l`);
735
- // remove all
736
- // shellExec(`ssh-add -D`);
737
- // remove single
738
- // shellExec(`ssh-add -d ~/.ssh/id_rsa`);
739
-
740
- // shellExec(`echo "@${host.split(`@`)[1]} * $(cat ~/.ssh/id_rsa.pub)" > ~/.ssh/known_hosts`);
741
- shellExec('eval `ssh-agent -s`' + `&& ssh-keyscan -H -t ed25519 ${host.split(`@`)[1]} > ~/.ssh/known_hosts`);
742
- // shellExec(`sudo echo "" > ~/.ssh/known_hosts`);
743
-
744
- // ssh-copy-id -i ~/.ssh/id_rsa.pub -p <port_number> <username>@<host>
745
- // shellExec(`ssh-copy-id -i ~/.ssh/id_rsa.pub -p ${port} ${host}`);
746
- // debug:
747
- // shellExec(`ssh -vvv ${host}`);
748
-
749
- shellExec(`sudo cp ./engine-private/deploy/id_rsa ~/.ssh/id_rsa`);
750
- shellExec(`sudo cp ./engine-private/deploy/id_rsa.pub ~/.ssh/id_rsa.pub`);
751
-
752
- shellExec(`sudo echo "" > /etc/ssh/ssh_host_ecdsa_key`);
753
- shellExec(`sudo cp ./engine-private/deploy/id_rsa /etc/ssh/ssh_host_ed25519_key`);
754
- shellExec(`sudo echo "" > /etc/ssh/ssh_host_rsa_key`);
755
-
756
- shellExec(`sudo echo "" > /etc/ssh/ssh_host_ecdsa_key.pub`);
757
- shellExec(`sudo cp ./engine-private/deploy/id_rsa.pub /etc/ssh/ssh_host_ed25519_key.pub`);
758
- shellExec(`sudo echo "" > /etc/ssh/ssh_host_rsa_key.pub`);
759
-
760
- shellExec(`sudo systemctl enable sshd`);
761
- shellExec(`sudo systemctl restart sshd`);
762
-
763
- const status = shellExec(`sudo systemctl status sshd`, { silent: true, stdout: true });
764
- console.log(
765
- status.match('running') ? status.replaceAll(`running`, `running`.green) : `ssh service not running`.red,
766
- );
767
- };
768
-
769
- if (process.argv.includes('import')) {
770
- setUpSSH();
771
- break;
772
- }
773
-
774
- shellExec(`sudo rm -rf ./id_rsa`);
775
- shellExec(`sudo rm -rf ./id_rsa.pub`);
776
-
777
- if (process.argv.includes('legacy'))
778
- shellExec(`ssh-keygen -t rsa -b 4096 -f id_rsa -N "${password}" -q -C "${host}"`);
779
- else shellExec(`ssh-keygen -t ed25519 -f id_rsa -N "${password}" -q -C "${host}"`);
780
-
781
- shellExec(`sudo cp ./id_rsa ~/.ssh/id_rsa`);
782
- shellExec(`sudo cp ./id_rsa.pub ~/.ssh/id_rsa.pub`);
783
-
784
- shellExec(`sudo cp ./id_rsa ./engine-private/deploy/id_rsa`);
785
- shellExec(`sudo cp ./id_rsa.pub ./engine-private/deploy/id_rsa.pub`);
786
-
787
- shellExec(`sudo rm -rf ./id_rsa`);
788
- shellExec(`sudo rm -rf ./id_rsa.pub`);
789
- setUpSSH();
790
- break;
791
- }
792
-
793
666
  case 'maas-db': {
794
667
  // DROP, ALTER, CREATE, WITH ENCRYPTED
795
668
  // sudo -u <user> -h <host> psql <db-name>
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.90.4
1
+ ## underpost ci/cd cli v2.92.0
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -17,21 +17,21 @@ Commands:
17
17
  static [options] Manages static build of page, bundles, and documentation with comprehensive customization options.
18
18
  config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
19
19
  root Displays the root path of the npm installation.
20
- ip [options] Displays the current public machine IP addresses.
20
+ ip [options] [ips] Displays the current public machine IP addresses.
21
21
  cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
22
22
  deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
23
23
  secret [options] <platform> Manages secrets for various platforms.
24
24
  dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
25
25
  dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
26
26
  install Quickly imports Underpost npm dependencies by copying them.
27
- db [options] <deploy-list> Manages database operations, including import, export, and collection management.
27
+ db [options] <deploy-list> Manages database operations with support for MariaDB and MongoDB, including import/export, multi-pod targeting, and Git integration.
28
28
  metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
29
29
  script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
30
30
  cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
31
31
  fs [options] [path] Manages file storage, defaulting to file upload operations.
32
32
  test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
33
33
  monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
34
- ssh [options] Import and start ssh server and client based on current default deployment ID.
34
+ ssh [options]
35
35
  run [options] <runner-id> [path] Runs a script from the specified path.
36
36
  lxd [options] Manages LXD containers and virtual machines.
37
37
  baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
@@ -56,6 +56,15 @@ Options:
56
56
  --sub-conf <sub-conf> Create sub conf env files
57
57
  --cluster Create deploy ID cluster files and sync to current
58
58
  cluster
59
+ --build-repos Create deploy ID repositories
60
+ --build Build the deployment to pwa-microservices-template
61
+ (requires --deploy-id)
62
+ --clean-template Clean the build directory
63
+ (pwa-microservices-template)
64
+ --sync-conf Sync configuration to private repositories (requires
65
+ --deploy-id)
66
+ --purge Remove deploy ID conf and all related repositories
67
+ (requires --deploy-id)
59
68
  --dev Sets the development cli context
60
69
  -h, --help display help for command
61
70
 
@@ -282,13 +291,28 @@ Options:
282
291
 
283
292
  ### `ip` :
284
293
  ```
285
- Usage: underpost ip [options]
294
+ Usage: underpost ip [options] [ips]
286
295
 
287
296
  Displays the current public machine IP addresses.
288
297
 
298
+ Arguments:
299
+ ips Optional args comma-separated list of IP to process.
300
+
289
301
  Options:
290
- --copy Copies the IP addresses to the clipboard.
291
- -h, --help display help for command
302
+ --copy Copies the IP addresses to the clipboard.
303
+ --ban-ingress-add Adds IP addresses to banned ingress list.
304
+ --ban-ingress-remove Removes IP addresses from banned ingress list.
305
+ --ban-ingress-list Lists all banned ingress IP addresses.
306
+ --ban-ingress-clear Clears all banned ingress IP addresses.
307
+ --ban-egress-add Adds IP addresses to banned egress list.
308
+ --ban-egress-remove Removes IP addresses from banned egress list.
309
+ --ban-egress-list Lists all banned egress IP addresses.
310
+ --ban-egress-clear Clears all banned egress IP addresses.
311
+ --ban-both-add Adds IP addresses to both banned ingress and egress
312
+ lists.
313
+ --ban-both-remove Removes IP addresses from both banned ingress and
314
+ egress lists.
315
+ -h, --help display help for command
292
316
 
293
317
  ```
294
318
 
@@ -428,6 +452,10 @@ Options:
428
452
  configuration during deployment.
429
453
  --namespace <namespace> Kubernetes namespace for deployment
430
454
  operations (defaults to "default").
455
+ --kind-type <kind-type> Specifies the Kind cluster type for
456
+ deployment operations.
457
+ --port <port> Sets up port forwarding from local to
458
+ remote ports.
431
459
  -h, --help display help for command
432
460
 
433
461
  ```
@@ -522,8 +550,8 @@ Options:
522
550
  ```
523
551
  Usage: underpost db [options] <deploy-list>
524
552
 
525
- Manages database operations, including import, export, and collection
526
- management.
553
+ Manages database operations with support for MariaDB and MongoDB, including
554
+ import/export, multi-pod targeting, and Git integration.
527
555
 
528
556
  Arguments:
529
557
  deploy-list A comma-separated list of deployment IDs (e.g.,
@@ -534,19 +562,35 @@ Options:
534
562
  repositories.
535
563
  --export Exports container backups to specified
536
564
  repositories.
537
- --pod-name <pod-name> Optional: Specifies the pod context for database
538
- operations.
539
- --collections <collections> A comma-separated list of database collections
540
- to operate on.
565
+ --pod-name <pod-name> Comma-separated list of pod names or patterns
566
+ (supports wildcards like "mariadb-*").
567
+ --node-name <node-name> Comma-separated list of node names to filter
568
+ pods by their node placement.
569
+ --label-selector <selector> Kubernetes label selector for filtering pods
570
+ (e.g., "app=mariadb").
571
+ --all-pods Target all matching pods instead of just the
572
+ first one.
573
+ --primary-pod Automatically detect and use MongoDB primary pod
574
+ (MongoDB only).
575
+ --stats Display database statistics (collection/table
576
+ names with document/row counts).
577
+ --collections <collections> Comma-separated list of database collections to
578
+ operate on.
541
579
  --out-path <out-path> Specifies a custom output path for backups.
542
- --drop Drops the specified databases or collections.
543
- --preserveUUID Preserves UUIDs during database operations.
544
- --git Uploads database backups to GitHub.
545
- --hosts <hosts> A comma-separated list of database hosts.
546
- --paths <paths> A comma-separated list of paths for database
547
- files.
548
- --ns <ns-name> Optional: Specifies the namespace context for
549
- database operations.
580
+ --drop Drops the specified databases or collections
581
+ before importing.
582
+ --preserveUUID Preserves UUIDs during database import
583
+ operations.
584
+ --git Enables Git integration for backup version
585
+ control (clone, pull, commit, push to GitHub).
586
+ --hosts <hosts> Comma-separated list of database hosts to filter
587
+ operations.
588
+ --paths <paths> Comma-separated list of paths to filter database
589
+ operations.
590
+ --ns <ns-name> Kubernetes namespace context for database
591
+ operations (defaults to "default").
592
+ --dry-run Simulates operations without executing them
593
+ (useful for testing).
550
594
  -h, --help display help for command
551
595
 
552
596
  ```
@@ -702,12 +746,35 @@ Options:
702
746
  ```
703
747
  Usage: underpost ssh [options]
704
748
 
705
- Import and start ssh server and client based on current default deployment ID.
706
-
707
749
  Options:
708
- --generate Generates new ssh credential and stores it in current private
709
- keys file storage.
710
- -h, --help display help for command
750
+ --deploy-id <deploy-id> Sets deploy id context for ssh operations.
751
+ --generate Generates new ssh credential and stores it in
752
+ current private keys file storage.
753
+ --user <user> Sets custom ssh user
754
+ --password <password> Sets custom ssh password
755
+ --host <host> Sets custom ssh host
756
+ --port <port> Sets custom ssh port
757
+ --filter <filter> Filters ssh user credentials from current private
758
+ keys file storage.
759
+ --groups <groups> Sets comma-separated ssh user groups for the ssh
760
+ user credential.
761
+ --user-add Adds a new ssh user credential to current private
762
+ keys file storage.
763
+ --user-remove Removes an existing ssh user credential from current
764
+ private keys file storage.
765
+ --user-ls Lists all ssh user credentials from current private
766
+ keys file storage.
767
+ --start Starts an SSH session with the specified
768
+ credentials.
769
+ --reset Resets ssh configuration and deletes all stored
770
+ credentials.
771
+ --keys-list Lists all ssh keys from current private keys file
772
+ storage.
773
+ --hosts-list Lists all ssh hosts from current private keys file
774
+ storage.
775
+ --disable-password Disables password authentication for the SSH
776
+ session.
777
+ -h, --help display help for command
711
778
 
712
779
  ```
713
780
 
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: localhost/rockylinux9-underpost:v2.90.4
20
+ image: localhost/rockylinux9-underpost:v2.92.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.90.4
103
+ image: localhost/rockylinux9-underpost:v2.92.0
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
@@ -18,7 +18,7 @@ spec:
18
18
  spec:
19
19
  containers:
20
20
  - name: dd-test-development-blue
21
- image: localhost/rockylinux9-underpost:v2.90.4
21
+ image: localhost/rockylinux9-underpost:v2.92.0
22
22
 
23
23
  command:
24
24
  - /bin/sh
@@ -103,7 +103,7 @@ spec:
103
103
  spec:
104
104
  containers:
105
105
  - name: dd-test-development-green
106
- image: localhost/rockylinux9-underpost:v2.90.4
106
+ image: localhost/rockylinux9-underpost:v2.92.0
107
107
 
108
108
  command:
109
109
  - /bin/sh
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.90.4",
5
+ "version": "2.92.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",
@@ -34,6 +34,7 @@ PACKAGES=(
34
34
  which
35
35
  net-tools
36
36
  bind-utils
37
+ tcpdump
37
38
  )
38
39
 
39
40
  # Defaults