underpost 3.2.10 → 3.2.11

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 (54) hide show
  1. package/.vscode/extensions.json +9 -9
  2. package/.vscode/settings.json +12 -1
  3. package/CHANGELOG.md +74 -1
  4. package/CLI-HELP.md +80 -26
  5. package/README.md +3 -3
  6. package/bin/build.js +9 -6
  7. package/bin/build.template.js +187 -0
  8. package/bin/deploy.js +29 -18
  9. package/conf.js +1 -4
  10. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
  11. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
  12. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  13. package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
  14. package/manifests/lxd/lxd-admin-profile.yaml +12 -3
  15. package/manifests/mongodb-4.4/headless-service.yaml +10 -0
  16. package/manifests/mongodb-4.4/kustomization.yaml +3 -1
  17. package/manifests/mongodb-4.4/mongodb-nodeport.yaml +17 -0
  18. package/manifests/mongodb-4.4/pv-pvc.yaml +10 -14
  19. package/manifests/mongodb-4.4/statefulset.yaml +79 -0
  20. package/manifests/mongodb-4.4/storage-class.yaml +9 -0
  21. package/manifests/valkey/statefulset.yaml +1 -1
  22. package/manifests/valkey/valkey-nodeport.yaml +17 -0
  23. package/package.json +3 -3
  24. package/scripts/ipxe-setup.sh +52 -49
  25. package/scripts/k3s-node-setup.sh +84 -68
  26. package/scripts/lxd-vm-setup.sh +193 -8
  27. package/scripts/maas-nat-firewalld.sh +145 -0
  28. package/src/cli/baremetal.js +115 -93
  29. package/src/cli/cluster.js +548 -221
  30. package/src/cli/deploy.js +131 -166
  31. package/src/cli/fs.js +11 -3
  32. package/src/cli/index.js +75 -17
  33. package/src/cli/lxd.js +1034 -240
  34. package/src/cli/monitor.js +9 -3
  35. package/src/cli/release.js +72 -36
  36. package/src/cli/repository.js +10 -16
  37. package/src/cli/run.js +70 -53
  38. package/src/cli/secrets.js +11 -2
  39. package/src/client/components/core/Auth.js +4 -3
  40. package/src/client/components/core/ClientEvents.js +76 -0
  41. package/src/client/components/core/EventBus.js +4 -0
  42. package/src/client/components/core/Modal.js +82 -41
  43. package/src/db/DataBaseProvider.js +9 -9
  44. package/src/db/mariadb/MariaDB.js +2 -1
  45. package/src/db/mongo/MongoBootstrap.js +592 -522
  46. package/src/db/mongo/MongooseDB.js +19 -15
  47. package/src/index.js +1 -1
  48. package/src/server/conf.js +62 -15
  49. package/src/server/proxy.js +9 -2
  50. package/src/server/start.js +7 -3
  51. package/src/server/valkey.js +2 -0
  52. package/bin/file.js +0 -220
  53. package/bin/vs.js +0 -74
  54. package/bin/zed.js +0 -84
@@ -1,10 +1,10 @@
1
1
  {
2
- "recommendations": [
3
- "anseki.vscode-color",
4
- "bashmish.es6-string-css",
5
- "eamodio.gitlens",
6
- "esbenp.prettier-vscode",
7
- "github.copilot-chat",
8
- "tobermory.es6-string-html"
9
- ]
10
- }
2
+ "recommendations": [
3
+ "anseki.vscode-color",
4
+ "bashmish.es6-string-css",
5
+ "eamodio.gitlens",
6
+ "esbenp.prettier-vscode",
7
+ "shakram02.bash-beautify",
8
+ "tobermory.es6-string-html"
9
+ ]
10
+ }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "editor.formatOnSave": true,
3
+ "files.autoSave": "onFocusChange",
3
4
  "[javascript]": {
4
5
  "editor.defaultFormatter": "esbenp.prettier-vscode"
5
6
  },
@@ -11,5 +12,15 @@
11
12
  },
12
13
  "[typescriptreact]": {
13
14
  "editor.defaultFormatter": "esbenp.prettier-vscode"
15
+ },
16
+ "[shellscript]": {
17
+ "editor.defaultFormatter": "shakram02.bash-beautify",
18
+ "editor.formatOnSave": true
19
+ },
20
+ "[json]": {
21
+ "editor.quickSuggestions": {
22
+ "strings": true
23
+ },
24
+ "editor.suggest.insertMode": "replace"
14
25
  }
15
- }
26
+ }
package/CHANGELOG.md CHANGED
@@ -1,6 +1,79 @@
1
1
  # Changelog
2
2
 
3
- ## 2026-05-26
3
+ ## 2026-05-31
4
+
5
+ ### deploy
6
+
7
+ - Fix deployment error handling: ensure global secret cleanup only occurs if container status is not 'error' ([83ef9d8cf](https://github.com/underpostnet/engine/commit/83ef9d8cf893c8fe8c07d445b324dd864d9ad842))
8
+ - Add Underpost integration for container status error handling in database and Valkey services ([3bbcdcf49](https://github.com/underpostnet/engine/commit/3bbcdcf49ac6445c6ea5b37d84a5ebc69102a34e))
9
+
10
+ ### bin-build
11
+
12
+ - Prevent OnError workflow break on empty commit ([494fc93ab](https://github.com/underpostnet/engine/commit/494fc93ab9980d972e66096af5371f5a11173fb4))
13
+
14
+ ### cli-run
15
+
16
+ - Add k3s-template-env case logic: clean up existing dd-default config and update .env.example ([90a910630](https://github.com/underpostnet/engine/commit/90a910630072fbe3143d87a9aa5a3e479a3ba6e8))
17
+ - Add 'remove' option for resource teardown and improve MongoDB handling ([11c09deb6](https://github.com/underpostnet/engine/commit/11c09deb605138e344cbd30dad3ba446ec950345))
18
+ - Enhance clean method: execute shared-dir script in development mode ([317806d8f](https://github.com/underpostnet/engine/commit/317806d8f9681cb768bd7a1cad87f0c86781fd23))
19
+ - Rename setup-shared-dir method to shared-dir and remove reload-shared-dir method for clarity and simplification ([7985353cb](https://github.com/underpostnet/engine/commit/7985353cb46e5e01e0657c9abb419ddcc6691697))
20
+ - Add exit process on error instead of returning null ([567008c3d](https://github.com/underpostnet/engine/commit/567008c3df4d53ebdab442b44726b323801ec5d3))
21
+
22
+ ### client-core
23
+
24
+ - Add modal event handling: introduce ModalEventType, ModalListenerChannels, and createModalEvents for improved modal interactions ([d31bf3b01](https://github.com/underpostnet/engine/commit/d31bf3b0171d94f3c0d2496b19bb7001192dc1ac))
25
+ - Fix focus handling in Auth and Modal components: prevent focus on search box when skipFocus is true ([95a42637c](https://github.com/underpostnet/engine/commit/95a42637c6bf7d3f3dd4643663f487321097c218))
26
+
27
+ ### bin-deploy
28
+
29
+ - Add vm-cluster-env case logic ([d55b6120d](https://github.com/underpostnet/engine/commit/d55b6120d18485865a22745083743091177806b6))
30
+
31
+ ### release
32
+
33
+ - Refactor release build process: replace file.js with build.template.js, update package.json script, and enhance repository methods for GitHub directory fetching ([05c0e1d85](https://github.com/underpostnet/engine/commit/05c0e1d85bb777b4bc071d4312ed8e6ae6dece51))
34
+
35
+ ### baremetal
36
+
37
+ - Refactor NFS configuration: update NFSv3 ports and streamline NFS root mount options ([217c736ea](https://github.com/underpostnet/engine/commit/217c736eac25cf68d11b4f9991fc79f0e28a2639))
38
+ - Enhance iPXE build process: track embedded script changes to ensure rebuilds when necessary ([4d9d572bf](https://github.com/underpostnet/engine/commit/4d9d572bfcfff40d0977249e96b34a474cfe582c))
39
+ - Refactor NFS configuration and enhance GRUB module installation for baremetal provisioning ([c94dd434b](https://github.com/underpostnet/engine/commit/c94dd434bbe8792d7694744b7eb57a88256a3415))
40
+
41
+ ### lxd
42
+
43
+ - Enhance LXD management: add support for MAAS project handling and improve command execution consistency ([0910817c5](https://github.com/underpostnet/engine/commit/0910817c55a4971860d7b363455efd1d1c13d830))
44
+ - Refactor: reorganize LXD Management documentation for clarity and safety ([5cc554cfe](https://github.com/underpostnet/engine/commit/5cc554cfe308f28ee94c7ee3cb141ec6dd156368))
45
+
46
+ ### cluster
47
+
48
+ - Refactor deployment and monitoring to centralize /etc/hosts management ([a10ad7da6](https://github.com/underpostnet/engine/commit/a10ad7da651085a45c0301489ccb19c92abd2ee7))
49
+ - Add MongoDB manifests including headless service, stateful set, and storage class ([8fd1d8172](https://github.com/underpostnet/engine/commit/8fd1d817250cbebbe2812be9f382d0fc526800ee))
50
+
51
+ ### repository
52
+
53
+ - Enhance git command execution in file storage and repository modules for improved error handling and logging ([bb008852d](https://github.com/underpostnet/engine/commit/bb008852d9b6b3c9604815a2b0e1d43aba57cc16))
54
+
55
+ ### engine
56
+
57
+ - Update VSCode configuration: add bash-beautify extension and enhance settings for shellscript and json ([e0e3c5249](https://github.com/underpostnet/engine/commit/e0e3c524923dfcc1c73da2063a4fe7a90ed805d7))
58
+
59
+ ### db
60
+
61
+ - Refactor MongoDB data directory cleanup logic in Kind nodes to use docker exec for reliability ([87d66f223](https://github.com/underpostnet/engine/commit/87d66f223093695b92f51ce42186e09c06109a45))
62
+ - Refactor MongoDB cleanup logic to avoid stale bind mounts and ensure proper directory structure ([c07098e8c](https://github.com/underpostnet/engine/commit/c07098e8ce9762e3116d8705c1b7206d7ec0df6c))
63
+
64
+ ### cli-secrets
65
+
66
+ - Add secret management command to deployment workflows ([796fddb46](https://github.com/underpostnet/engine/commit/796fddb46c3c43399de4264ed940f453fd2056e3))
67
+
68
+ ### cli-deploy
69
+
70
+ - Fix ready monitor method to wait container runtime complete setup ([c89231a06](https://github.com/underpostnet/engine/commit/c89231a06aa5e1ce6decd6550ea5a7f9cf90dd45))
71
+
72
+ ### github-actions
73
+
74
+ - Prevent dependabot gitleaks run ([16c2a0c1d](https://github.com/underpostnet/engine/commit/16c2a0c1d60ec8d5389288464af60b4a0fcea72d))
75
+
76
+ ## New release v:3.2.10 (2026-05-26)
4
77
 
5
78
  ### cli-run
6
79
 
package/CLI-HELP.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v3.2.10
1
+ ## underpost ci/cd cli v3.2.11
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -32,7 +32,7 @@ Commands:
32
32
  monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
33
33
  ssh [options] Manages SSH credentials and sessions for remote access to cluster nodes or services.
34
34
  run [options] <runner-id> [path] Runs specified scripts using various runners.
35
- lxd [options] Manages LXD virtual machines as K3s nodes (control plane or workers).
35
+ lxd [options] [vm-id] Manages LXD virtual machines as K3s nodes (control plane or workers).
36
36
  baremetal [options] [workflow-id] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
37
37
  release [options] [version] Release orchestrator for building new versions and deploying releases of the Underpost CLI.
38
38
  help [command] display help for command
@@ -422,7 +422,8 @@ Options:
422
422
  statefulset.
423
423
  --mongodb Initializes the cluster with a MongoDB
424
424
  statefulset.
425
- --mongo-db-host <host> Set custom mongo db host
425
+ --service-host <host> Set custom host/IP for exposed MongoDB
426
+ and Valkey clients.
426
427
  --postgresql Initializes the cluster with a PostgreSQL
427
428
  statefulset.
428
429
  --mongodb4 Initializes the cluster with a MongoDB
@@ -433,6 +434,14 @@ Options:
433
434
  ipfs-cluster statefulset.
434
435
  --contour Initializes the cluster with Project
435
436
  Contour base HTTPProxy and Envoy.
437
+ --node-port Exposes enabled ready services (e.g.
438
+ MongoDB 4.4, Valkey) to the host/public
439
+ network via their NodePort Service
440
+ manifest.
441
+ --node-selector <k8s-node-name> Pins the just-deployed StatefulSet
442
+ (MongoDB 4.4 / Valkey) to the given
443
+ Kubernetes node once it is ready (via a
444
+ kubernetes.io/hostname nodeSelector).
436
445
  --cert-manager Initializes the cluster with a Let's
437
446
  Encrypt production ClusterIssuer.
438
447
  --dedicated-gpu Initializes the cluster with dedicated
@@ -475,6 +484,10 @@ Options:
475
484
  hostnames or IP addresses.
476
485
  --remove-volume-host-paths Removes specified volume host paths after
477
486
  execution.
487
+ --reset-mode <mode> Reset mode for --reset --k3s: "drain"
488
+ (stop services, keep K3s installed) or
489
+ "full" (uninstall + cleanup). Default:
490
+ "full".
478
491
  --namespace <namespace> Kubernetes namespace for cluster
479
492
  operations (defaults to "default").
480
493
  --replicas <replicas> Sets a custom number of replicas for
@@ -546,9 +559,6 @@ Options:
546
559
  operations.
547
560
  --git-clean Runs git clean on volume mount paths
548
561
  before copying.
549
- --etc-hosts Enables the etc-hosts context for
550
- deployment operations.
551
- --restore-hosts Restores default `/etc/hosts` entries.
552
562
  --disable-update-underpost-config Disables updates to Underpost
553
563
  configuration during deployment.
554
564
  --namespace <namespace> Kubernetes namespace for deployment
@@ -912,7 +922,7 @@ Options:
912
922
  Runs specified scripts using various runners.
913
923
 
914
924
  Arguments:
915
- runner-id The runner ID to run. Options: dev-cluster,ipfs-expose,metadata,svc-ls,svc-rm,ssh-deploy-info,dev-hosts-expose,dev-hosts-restore,cluster-build,template-deploy,template-deploy-local,docker-image,clean,pull,release-deploy,ssh-deploy,ide,crypto-policy,sync,stop,ssh-deploy-stop,ssh-deploy-db-rollback,ssh-deploy-db,ssh-deploy-db-status,tz,get-proxy,instance-promote,instance,instance-build-manifest,ls-deployments,host-update,install-crio,dd-container,ip-info,db-client,git-conf,promote,metrics,cluster,deploy,disk-clean,disk-devices,disk-usage,dev,service,etc-hosts,sh,log,ps,pid-info,background,ports,deploy-test,tf-vae-test,spark-template,pull-rocky-image,rmi,kill,generate-pass,secret,underpost-config,gpu-env,tf-gpu-test,deploy-job,push-bundle,pull-bundle,setup-shared-dir,reload-shared-dir.
925
+ runner-id The runner ID to run. Options: dev-cluster,ipfs-expose,metadata,svc-ls,svc-rm,ssh-deploy-info,dev-hosts-expose,dev-hosts-restore,cluster-build,template-deploy,template-deploy-local,docker-image,clean,pull,release-deploy,ssh-deploy,ide,crypto-policy,sync,stop,ssh-deploy-stop,ssh-deploy-db-rollback,ssh-deploy-db,ssh-deploy-db-status,tz,get-proxy,instance-promote,instance,instance-build-manifest,ls-deployments,host-update,install-crio,dd-container,ip-info,db-client,git-conf,promote,metrics,cluster,deploy,disk-clean,disk-devices,disk-usage,dev,service,etc-hosts,sh,log,ps,pid-info,background,ports,deploy-test,tf-vae-test,spark-template,pull-rocky-image,rmi,kill,generate-pass,secret,underpost-config,gpu-env,tf-gpu-test,deploy-job,push-bundle,pull-bundle,monitor-ui,shared-dir.
916
926
  path The input value, identifier, or path for the operation.
917
927
 
918
928
  Options:
@@ -982,6 +992,7 @@ Options:
982
992
  --copy Copies the runner output to the clipboard (supported by: generate-pass, template-deploy-local).
983
993
  --skip-full-build Skip client bundle rebuild; triggers pull-bundle in container startup (supported by: sync, template-deploy).
984
994
  --pull-bundle Explicitly download the pre-built client bundle from Cloudinary inside the container (supported by: sync, template-deploy). Use together with --skip-full-build.
995
+ --remove Remove/teardown resources
985
996
  -h, --help display help for command
986
997
 
987
998
  ```
@@ -989,16 +1000,36 @@ Options:
989
1000
 
990
1001
  ### `lxd` :
991
1002
  ```
992
- Usage: underpost lxd [options]
1003
+ Usage: underpost lxd [options] [vm-id]
993
1004
 
994
1005
  Manages LXD virtual machines as K3s nodes (control plane or workers).
995
1006
 
1007
+ Arguments:
1008
+ vm-id VM identifier shared by current-VM flags like
1009
+ --vm-create, --vm-delete, --vm-init,
1010
+ --vm-info, and --vm-test.
1011
+
996
1012
  Options:
997
1013
  --init Initializes LXD on the current machine via
998
1014
  preseed.
999
- --reset SAFE complete reset: cleans all VMs (proxy
1000
- devices first), profiles, networks, then
1001
- removes LXD snap.
1015
+ --reset Host-safe reset: removes proxy devices,
1016
+ stops/deletes VMs, drops admin-profile and
1017
+ lxdbr0. Does NOT touch the LXD snap or
1018
+ storage pools.
1019
+ --purge DESTRUCTIVE: gracefully shuts down the LXD
1020
+ daemon (60s timeout), then removes the LXD
1021
+ snap. Combine with --reset to wipe per-VM
1022
+ state first. Safe replacement for the prior
1023
+ aggressive teardown.
1024
+ --shutdown Pre-host-reboot procedure: gracefully stops
1025
+ every VM and the LXD daemon. Run BEFORE any
1026
+ reboot/poweroff to keep the host bootable.
1027
+ --restore Symmetric to --shutdown: starts the LXD
1028
+ daemon, waits for it to be responsive, then
1029
+ starts every VM. VMs created via
1030
+ admin-profile have boot.autostart=false, so
1031
+ this is the explicit "bring the lab back up"
1032
+ command.
1002
1033
  --install Installs the LXD snap.
1003
1034
  --dev Use local paths instead of the global npm
1004
1035
  installation.
@@ -1010,31 +1041,54 @@ Options:
1010
1041
  plane node.
1011
1042
  --worker Initialize the target VM as a K3s worker
1012
1043
  node.
1013
- --create-vm <vm-name> Copy the LXC launch command for a new K3s VM
1014
- to the clipboard.
1015
- --delete-vm <vm-name> SAFELY stop and delete VM (removes proxy
1016
- devices first, then stops, then deletes).
1017
- Safe to re-run.
1018
- --init-vm <vm-name> Run k3s-node-setup.sh on the specified VM
1019
- (use with --control or --worker).
1020
- --info-vm <vm-name> Display full configuration and status for the
1021
- specified VM.
1022
- --test <vm-name> Run connectivity and health checks on the
1023
- specified VM.
1024
- --root-size <gb-size> Root disk size in GiB for --create-vm
1044
+ --vm-create Copy the LXC launch command for the command
1045
+ argument [vm-id] to the clipboard.
1046
+ --vm-delete SAFELY stop and delete the command argument
1047
+ [vm-id] (removes proxy devices first, then
1048
+ stops, then deletes). Safe to re-run.
1049
+ --vm-init Bring the command argument [vm-id] up as a
1050
+ K3s node end-to-end: OS base setup, mirror
1051
+ /home/dd/engine into the VM, then K3s role
1052
+ install via the local engine (use with
1053
+ --control or --worker).
1054
+ --vm-info Display full configuration and status for the
1055
+ command argument [vm-id].
1056
+ --vm-test Run connectivity and health checks on the
1057
+ command argument [vm-id].
1058
+ --vm-sync-engine Re-copy the host engine source into the
1059
+ command argument [vm-id], overriding whatever
1060
+ is currently there (equivalent to the
1061
+ engine-bootstrap step of --vm-init in
1062
+ isolation).
1063
+ --root-size <gb-size> Root disk size in GiB for --vm-create
1025
1064
  (default: 32).
1026
1065
  --join-node <nodes> Join a K3s worker to a control plane.
1027
1066
  Standalone format: "workerName,controlName".
1028
- When used with --init-vm --worker, provide
1067
+ When used with --vm-init --worker, provide
1029
1068
  just the control node name for auto-join.
1030
1069
  --expose <vm-name:ports> Proxy host ports to a VM (e.g.,
1031
1070
  "k3s-control:80,443").
1071
+ --node-port <port> Customizes the VM-side (connect) port for
1072
+ --expose, so the host listens on the given
1073
+ port but proxies to this NodePort inside the
1074
+ VM (e.g. expose host 27017 -> VM NodePort
1075
+ 32017).
1032
1076
  --delete-expose <vm-name:ports> Remove proxied ports from a VM (e.g.,
1033
1077
  "k3s-control:80,443").
1034
- --bootstrap-engine <vm-name> Replicate /home/dd/engine source into the VM
1035
- after init completes.
1078
+ --copy For two-phase flows that surface a command
1079
+ for the user to execute (e.g.
1080
+ --create-admin-profile phase 1), copy the
1081
+ command to the clipboard instead of printing
1082
+ it to the terminal.
1036
1083
  --namespace <namespace> Kubernetes namespace context (defaults to
1037
1084
  "default").
1085
+ --maas-project <project> LXD project managed by MAAS (e.g.
1086
+ "k3s-cluster"). When set, all lxc commands
1087
+ target this project so MAAS enumerates the
1088
+ VMs in its machines UI.
1089
+ --move-to-project Stop the [vm-id] VM in the default project,
1090
+ move it to --maas-project, then start it so
1091
+ MAAS picks it up. Requires --maas-project.
1038
1092
  -h, --help display help for command
1039
1093
 
1040
1094
  ```
package/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  <div align="center">
18
18
 
19
- [![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.ci.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) [![](https://data.jsdelivr.com/v1/package/npm/underpost/badge)](https://www.jsdelivr.com/package/npm/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/3.2.10)](https://socket.dev/npm/package/underpost/overview/3.2.10) [![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)
19
+ [![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.ci.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) [![](https://data.jsdelivr.com/v1/package/npm/underpost/badge)](https://www.jsdelivr.com/package/npm/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/3.2.11)](https://socket.dev/npm/package/underpost/overview/3.2.11) [![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)
20
20
 
21
21
  </div>
22
22
 
@@ -90,7 +90,7 @@ npm run dev
90
90
  <a target="_top" href="https://www.nexodev.org/docs?cid=src">See Docs.</a>
91
91
 
92
92
  <!-- cli-index-start -->
93
- ## underpost ci/cd cli v3.2.10
93
+ ## underpost ci/cd cli v3.2.11
94
94
 
95
95
  ### Usage: `underpost [options] [command]`
96
96
  ```
@@ -124,7 +124,7 @@ Commands:
124
124
  monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
125
125
  ssh [options] Manages SSH credentials and sessions for remote access to cluster nodes or services.
126
126
  run [options] <runner-id> [path] Runs specified scripts using various runners.
127
- lxd [options] Manages LXD virtual machines as K3s nodes (control plane or workers).
127
+ lxd [options] [vm-id] Manages LXD virtual machines as K3s nodes (control plane or workers).
128
128
  baremetal [options] [workflow-id] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
129
129
  release [options] [version] Release orchestrator for building new versions and deploying releases of the Underpost CLI.
130
130
  help [command] display help for command
package/bin/build.js CHANGED
@@ -64,11 +64,12 @@ if (process.argv.includes('conf')) {
64
64
  }
65
65
  shellExec(
66
66
  `cd ../${privateRepoName}` +
67
- ` && git add .` +
68
- ` && underpost cmt . ci engine-core-conf 'Update ${_confName} conf'` +
69
- ` && underpost push . ${privateGitUri}`,
67
+ ` && git add .` +
68
+ ` && underpost cmt . ci engine-core-conf 'Update ${_confName} conf'` +
69
+ ` && underpost push . ${privateGitUri}`,
70
70
  {
71
71
  silent: true,
72
+ silentOnError: true,
72
73
  },
73
74
  );
74
75
  }
@@ -163,11 +164,13 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
163
164
  `./.github/workflows/publish.cyberia.ci.yml`,
164
165
  `${basePath}/.github/workflows/publish.cyberia.ci.yml`,
165
166
  );
166
- delete packageJson.bin.underpost;
167
+ if (packageJson.bin) delete packageJson.bin.underpost;
168
+ if (!packageJson.bin) packageJson.bin = {};
167
169
  packageJson.bin.cyberia = 'bin/index.js';
168
170
  packageJson.keywords = [
169
171
  'cyberia',
170
172
  'cyberia-cli',
173
+ 'engine-cyberia',
171
174
  'sidecar',
172
175
  'data-layer',
173
176
  'engine-cyberia',
@@ -181,7 +184,7 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
181
184
  'blockchain',
182
185
  'web3',
183
186
  'underpost-platform',
184
- 'mmo-extension',
187
+ 'mmorpg',
185
188
  ];
186
189
  packageJson.description =
187
190
  'Cyberia CLI — toolchain for the Cyberia MMO data layer, content pipeline, persistence, gRPC services, and ERC-1155 lifecycle on Hyperledger Besu.';
@@ -213,7 +216,7 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
213
216
  '/src/runtime/cyberia-client',
214
217
  '/.github/workflows/hardhat.ci.yml',
215
218
  '/src/client/public/cyberia-docs',
216
- '/src/api/cyberia-server-defaults'
219
+ '/src/api/cyberia-server-defaults',
217
220
  ])
218
221
  fs.copySync(`.${path}`, `${basePath}${path}`);
219
222
 
@@ -0,0 +1,187 @@
1
+ import fs from 'fs-extra';
2
+
3
+ import { loggerFactory } from '../src/server/logger.js';
4
+ import { getDirname, newInstance, uniqueArray } from '../src/client/components/core/CommonJs.js';
5
+ import { shellExec } from '../src/server/process.js';
6
+ import walk from 'ignore-walk';
7
+ import { validateTemplatePath } from '../src/server/conf.js';
8
+ import dotenv from 'dotenv';
9
+
10
+ const logger = loggerFactory(import.meta);
11
+
12
+ if (fs.existsSync('./engine-private/conf/dd-cron/.env.production'))
13
+ dotenv.config({
14
+ path: `./engine-private/conf/dd-cron/.env.production`,
15
+ override: true,
16
+ });
17
+ else dotenv.config();
18
+
19
+ // Engine-only paths stripped from the template after the source sync.
20
+ const TEMPLATE_DELETE_PATHS = [
21
+ './.github',
22
+ './manifests/deployment/dd-lampp-development',
23
+ './manifests/deployment/dd-cyberia-development',
24
+ './manifests/deployment/dd-core-development',
25
+ './manifests/deployment/dd-template-development',
26
+ './src/server/object-layer.js',
27
+ './src/server/atlas-sprite-sheet-generator.js',
28
+ './src/server/shape-generator.js',
29
+ './src/server/semantic-layer-generator.js',
30
+ './src/server/semantic-layer-generator-floor.js',
31
+ './src/server/semantic-layer-generator-skin.js',
32
+ './src/server/semantic-layer-generator-resource.js',
33
+ './src/server/besu-genesis-generator.js',
34
+ './src/grpc/cyberia',
35
+ './src/runtime/cyberia-server',
36
+ './src/runtime/cyberia-client',
37
+ './test/shape-generator.test.js',
38
+ './src/client/public/cyberia-docs',
39
+ 'bin/cyberia.js',
40
+ './hardhat',
41
+ ];
42
+
43
+ // Workflow + service files re-added to the template after the engine-only strip above.
44
+ const TEMPLATE_RESTORE_PATHS = [
45
+ `./.github/workflows/pwa-microservices-template-page.cd.yml`,
46
+ `./.github/workflows/pwa-microservices-template-test.ci.yml`,
47
+ `./.github/workflows/npmpkg.ci.yml`,
48
+ `./.github/workflows/ghpkg.ci.yml`,
49
+ `./.github/workflows/gitlab.ci.yml`,
50
+ `./.github/workflows/publish.ci.yml`,
51
+ `./.github/workflows/release.cd.yml`,
52
+ `./src/client/services/user/guest.service.js`,
53
+ './src/api/user/guest.service.js',
54
+ './src/ws/IoInterface.js',
55
+ './src/ws/IoServer.js',
56
+ ];
57
+
58
+ const TEMPLATE_KEYWORDS = [
59
+ 'underpost',
60
+ 'underpost-platform',
61
+ 'cli',
62
+ 'toolchain',
63
+ 'ci-cd',
64
+ 'devops',
65
+ 'kubernetes',
66
+ 'k3s',
67
+ 'kubeadm',
68
+ 'lxd',
69
+ 'bare-metal',
70
+ 'container-orchestration',
71
+ 'image-management',
72
+ 'pwa',
73
+ 'workbox',
74
+ 'microservices',
75
+ ];
76
+
77
+ const TEMPLATE_DESCRIPTION =
78
+ 'Underpost Platform — end-to-end CI/CD and application-delivery toolchain CLI. Covers bare metal, Kubernetes, K3s, kubeadm, LXD, container/image orchestration, secrets, databases, cron jobs, monitoring, SSH, runners, PWA + Workbox delivery, and release orchestration. Extensible via downstream CLIs.';
79
+
80
+ /**
81
+ * Builds the pwa-microservices-template from scratch out of the current engine source tree.
82
+ *
83
+ * Clones (or resets) the template repo next to the engine, syncs every engine-tracked file the
84
+ * template is allowed to carry (validateTemplatePath), strips engine-only modules, restores the
85
+ * template's own CI workflows + guest services, and rewrites package.json / package-lock.json /
86
+ * README so the template is a standalone, installable project.
87
+ *
88
+ * Usage: node bin/build.template [srcPath=./] [toPath=../pwa-microservices-template]
89
+ */
90
+ const srcPath = (process.argv[2] ?? './').replaceAll(`'`, '');
91
+ const toPath = (process.argv[3] ?? '../pwa-microservices-template').replaceAll(`'`, '');
92
+ const githubUsername = process.env.GITHUB_USERNAME;
93
+
94
+ logger.info('Build template', { srcPath, toPath });
95
+
96
+ try {
97
+ const sourceFiles = (
98
+ await new Promise((resolve) =>
99
+ walk(
100
+ {
101
+ path: srcPath,
102
+ ignoreFiles: [`.gitignore`],
103
+ includeEmpty: false,
104
+ follow: false,
105
+ },
106
+ (...args) => resolve(args[1]),
107
+ ),
108
+ )
109
+ ).filter((p) => !p.startsWith('.git'));
110
+
111
+ // Clone the template from 0 if missing; otherwise reset it to a clean pristine checkout.
112
+ if (!fs.existsSync(toPath)) {
113
+ shellExec(`cd .. && node engine/bin clone ${githubUsername}/pwa-microservices-template`);
114
+ } else {
115
+ shellExec(`cd ${toPath} && git reset && git checkout . && git clean -f -d`);
116
+ shellExec(`node bin pull ${toPath} ${githubUsername}/pwa-microservices-template`);
117
+ shellExec(`sudo rm -rf ${toPath}/engine-private`);
118
+ shellExec(`sudo rm -rf ${toPath}/logs`);
119
+ }
120
+ shellExec(`cd ${toPath} && git config core.filemode false`);
121
+
122
+ for (const copyPath of sourceFiles) {
123
+ if (copyPath === 'NaN') continue;
124
+ const absolutePath = `${srcPath}/${copyPath}`;
125
+ if (!validateTemplatePath(absolutePath)) continue;
126
+
127
+ const folder = getDirname(`${toPath}/${copyPath}`);
128
+ if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });
129
+
130
+ logger.info('build', `${toPath}/${copyPath}`);
131
+ fs.copyFileSync(absolutePath, `${toPath}/${copyPath}`);
132
+ }
133
+
134
+ fs.copySync(`./.vscode`, `${toPath}/.vscode`);
135
+ fs.copySync(`./src/client/public/default`, `${toPath}/src/client/public/default`);
136
+
137
+ // Preserve the template's own README + package.json identity before merging engine metadata.
138
+ for (const checkoutPath of ['README.md', 'package.json']) shellExec(`cd ${toPath} && git checkout ${checkoutPath}`);
139
+
140
+ for (const deletePath of TEMPLATE_DELETE_PATHS) {
141
+ const target = `${toPath}/${deletePath}`;
142
+ if (fs.existsSync(target)) fs.removeSync(target);
143
+ }
144
+
145
+ fs.mkdirSync(`${toPath}/.github/workflows`, { recursive: true });
146
+ for (const restorePath of TEMPLATE_RESTORE_PATHS) fs.copyFileSync(restorePath, `${toPath}/${restorePath}`);
147
+
148
+ // ── package.json: take engine deps/scripts/version, keep template identity. ──
149
+ const originPackageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
150
+ const templatePackageJson = JSON.parse(fs.readFileSync(`${toPath}/package.json`, 'utf8'));
151
+ const templateName = templatePackageJson.name;
152
+
153
+ templatePackageJson.dependencies = originPackageJson.dependencies;
154
+ templatePackageJson.devDependencies = originPackageJson.devDependencies;
155
+ templatePackageJson.version = originPackageJson.version;
156
+ templatePackageJson.scripts = originPackageJson.scripts;
157
+ templatePackageJson.overrides = originPackageJson.overrides;
158
+ templatePackageJson.name = templateName;
159
+ templatePackageJson.description = TEMPLATE_DESCRIPTION;
160
+ templatePackageJson.keywords = uniqueArray(TEMPLATE_KEYWORDS.concat(templatePackageJson.keywords || []));
161
+ delete templatePackageJson.scripts['update:template'];
162
+ fs.writeFileSync(`${toPath}/package.json`, JSON.stringify(templatePackageJson, null, 4), 'utf8');
163
+
164
+ // ── package-lock.json: mirror engine packages, keep template name/version on the root entry. ──
165
+ const originPackageLockJson = JSON.parse(fs.readFileSync('./package-lock.json', 'utf8'));
166
+ const templatePackageLockJson = JSON.parse(fs.readFileSync(`${toPath}/package-lock.json`, 'utf8'));
167
+ const originBasePackageLock = newInstance(templatePackageLockJson.packages['']);
168
+ templatePackageLockJson.name = templateName;
169
+ templatePackageLockJson.version = originPackageLockJson.version;
170
+ templatePackageLockJson.packages = originPackageLockJson.packages;
171
+ templatePackageLockJson.packages[''].name = templateName;
172
+ templatePackageLockJson.packages[''].version = originPackageLockJson.version;
173
+ templatePackageLockJson.packages[''].hasInstallScript = originBasePackageLock.hasInstallScript;
174
+ templatePackageLockJson.packages[''].license = originBasePackageLock.license;
175
+ fs.writeFileSync(`${toPath}/package-lock.json`, JSON.stringify(templatePackageLockJson, null, 4), 'utf8');
176
+
177
+ fs.writeFileSync(
178
+ `${toPath}/README.md`,
179
+ fs
180
+ .readFileSync('./README.md', 'utf8')
181
+ .replace('<!-- template-title -->', '#### Base template for pwa/api-rest projects.'),
182
+ 'utf8',
183
+ );
184
+ } catch (error) {
185
+ logger.error(error, error.stack);
186
+ process.exit(1);
187
+ }