underpost 3.2.10 → 3.2.12

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 +92 -1
  4. package/CLI-HELP.md +80 -26
  5. package/README.md +6 -10
  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 +72 -55
  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 +67 -19
  49. package/src/server/proxy.js +9 -2
  50. package/src/server/start.js +8 -4
  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
package/src/cli/index.js CHANGED
@@ -242,16 +242,27 @@ program
242
242
  .command('cluster')
243
243
  .argument('[pod-name]', 'Optional: Filters information by a specific pod name.')
244
244
  .option('--reset', `Deletes all clusters and prunes all related data and caches.`)
245
- .option('--reset-mongodb', `Performs a hard cleanup of only MongoDB-related resources (StatefulSet, PVCs/PVs, Secrets, ConfigMaps, caches) without restarting the whole node.`)
245
+ .option(
246
+ '--reset-mongodb',
247
+ `Performs a hard cleanup of only MongoDB-related resources (StatefulSet, PVCs/PVs, Secrets, ConfigMaps, caches) without restarting the whole node.`,
248
+ )
246
249
  .option('--mariadb', 'Initializes the cluster with a MariaDB statefulset.')
247
250
  .option('--mysql', 'Initializes the cluster with a MySQL statefulset.')
248
251
  .option('--mongodb', 'Initializes the cluster with a MongoDB statefulset.')
249
- .option('--mongo-db-host <host>', 'Set custom mongo db host')
252
+ .option('--service-host <host>', 'Set custom host/IP for exposed MongoDB and Valkey clients.')
250
253
  .option('--postgresql', 'Initializes the cluster with a PostgreSQL statefulset.')
251
254
  .option('--mongodb4', 'Initializes the cluster with a MongoDB 4.4 service.')
252
255
  .option('--valkey', 'Initializes the cluster with a Valkey service.')
253
256
  .option('--ipfs', 'Initializes the cluster with an ipfs-cluster statefulset.')
254
257
  .option('--contour', 'Initializes the cluster with Project Contour base HTTPProxy and Envoy.')
258
+ .option(
259
+ '--node-port',
260
+ 'Exposes enabled ready services (e.g. MongoDB 4.4, Valkey) to the host/public network via their NodePort Service manifest.',
261
+ )
262
+ .option(
263
+ '--node-selector <k8s-node-name>',
264
+ 'Pins the just-deployed StatefulSet (MongoDB 4.4 / Valkey) to the given Kubernetes node once it is ready (via a kubernetes.io/hostname nodeSelector).',
265
+ )
255
266
  .option('--cert-manager', "Initializes the cluster with a Let's Encrypt production ClusterIssuer.")
256
267
  .option('--dedicated-gpu', 'Initializes the cluster with dedicated GPU base resources and environment settings.')
257
268
  .option(
@@ -282,6 +293,10 @@ program
282
293
  .option('--k3s', 'Initializes the cluster using K3s (Lightweight Kubernetes).')
283
294
  .option('--hosts <hosts>', 'A comma-separated list of cluster hostnames or IP addresses.')
284
295
  .option('--remove-volume-host-paths', 'Removes specified volume host paths after execution.')
296
+ .option(
297
+ '--reset-mode <mode>',
298
+ 'Reset mode for --reset --k3s: "drain" (stop services, keep K3s installed) or "full" (uninstall + cleanup). Default: "full".',
299
+ )
285
300
  .option('--namespace <namespace>', 'Kubernetes namespace for cluster operations (defaults to "default").')
286
301
  .option('--replicas <replicas>', 'Sets a custom number of replicas for statefulset deployments.')
287
302
  .action(Underpost.cluster.init)
@@ -328,8 +343,6 @@ program
328
343
  .option('--k3s', 'Enables the k3s context for deployment operations.')
329
344
  .option('--kind', 'Enables the kind context for deployment operations.')
330
345
  .option('--git-clean', 'Runs git clean on volume mount paths before copying.')
331
- .option('--etc-hosts', 'Enables the etc-hosts context for deployment operations.')
332
- .option('--restore-hosts', 'Restores default `/etc/hosts` entries.')
333
346
  .option('--disable-update-underpost-config', 'Disables updates to Underpost configuration during deployment.')
334
347
  .option('--namespace <namespace>', 'Kubernetes namespace for deployment operations (defaults to "default").')
335
348
  .option('--kind-type <kind-type>', 'Specifies the Kind cluster type for deployment operations.')
@@ -675,8 +688,8 @@ program
675
688
  .option(
676
689
  '--host-aliases <host-aliases>',
677
690
  'Adds entries to the Pod /etc/hosts via hostAliases. ' +
678
- 'Format: semicolon-separated entries of "ip=hostname1,hostname2" ' +
679
- '(e.g., "127.0.0.1=foo.local,bar.local;10.1.2.3=foo.remote,bar.remote").',
691
+ 'Format: semicolon-separated entries of "ip=hostname1,hostname2" ' +
692
+ '(e.g., "127.0.0.1=foo.local,bar.local;10.1.2.3=foo.remote,bar.remote").',
680
693
  )
681
694
  .option('--copy', 'Copies the runner output to the clipboard (supported by: generate-pass, template-deploy-local).')
682
695
  .option(
@@ -687,13 +700,33 @@ program
687
700
  '--pull-bundle',
688
701
  'Explicitly download the pre-built client bundle from Cloudinary inside the container (supported by: sync, template-deploy). Use together with --skip-full-build.',
689
702
  )
703
+ .option('--remove', 'Remove/teardown resources')
690
704
  .description('Runs specified scripts using various runners.')
691
705
  .action(Underpost.run.callback);
692
706
 
693
707
  program
694
708
  .command('lxd')
709
+ .argument(
710
+ '[vm-id]',
711
+ 'VM identifier shared by current-VM flags like --vm-create, --vm-delete, --vm-init, --vm-info, and --vm-test.',
712
+ )
695
713
  .option('--init', 'Initializes LXD on the current machine via preseed.')
696
- .option('--reset', 'SAFE complete reset: cleans all VMs (proxy devices first), profiles, networks, then removes LXD snap.')
714
+ .option(
715
+ '--reset',
716
+ 'Host-safe reset: removes proxy devices, stops/deletes VMs, drops admin-profile and lxdbr0. Does NOT touch the LXD snap or storage pools.',
717
+ )
718
+ .option(
719
+ '--purge',
720
+ 'DESTRUCTIVE: gracefully shuts down the LXD daemon (60s timeout), then removes the LXD snap. Combine with --reset to wipe per-VM state first. Safe replacement for the prior aggressive teardown.',
721
+ )
722
+ .option(
723
+ '--shutdown',
724
+ 'Pre-host-reboot procedure: gracefully stops every VM and the LXD daemon. Run BEFORE any reboot/poweroff to keep the host bootable.',
725
+ )
726
+ .option(
727
+ '--restore',
728
+ 'Symmetric to --shutdown: starts the LXD daemon, waits for it to be responsive, then starts every VM. VMs created via admin-profile have boot.autostart=false, so this is the explicit "bring the lab back up" command.',
729
+ )
697
730
  .option('--install', 'Installs the LXD snap.')
698
731
  .option('--dev', 'Use local paths instead of the global npm installation.')
699
732
  .option('--create-virtual-network', 'Creates the lxdbr0 bridge network.')
@@ -701,23 +734,48 @@ program
701
734
  .option('--create-admin-profile', 'Creates the admin-profile for VM management.')
702
735
  .option('--control', 'Initialize the target VM as a K3s control plane node.')
703
736
  .option('--worker', 'Initialize the target VM as a K3s worker node.')
704
- .option('--create-vm <vm-name>', 'Copy the LXC launch command for a new K3s VM to the clipboard.')
705
- .option('--delete-vm <vm-name>', 'SAFELY stop and delete VM (removes proxy devices first, then stops, then deletes). Safe to re-run.')
706
- .option('--init-vm <vm-name>', 'Run k3s-node-setup.sh on the specified VM (use with --control or --worker).')
707
- .option('--info-vm <vm-name>', 'Display full configuration and status for the specified VM.')
708
- .option('--test <vm-name>', 'Run connectivity and health checks on the specified VM.')
709
- .option('--root-size <gb-size>', 'Root disk size in GiB for --create-vm (default: 32).')
737
+ .option('--vm-create', 'Copy the LXC launch command for the command argument [vm-id] to the clipboard.')
738
+ .option(
739
+ '--vm-delete',
740
+ 'SAFELY stop and delete the command argument [vm-id] (removes proxy devices first, then stops, then deletes). Safe to re-run.',
741
+ )
742
+ .option(
743
+ '--vm-init',
744
+ 'Bring the command argument [vm-id] up as a K3s node end-to-end: OS base setup, mirror /home/dd/engine into the VM, then K3s role install via the local engine (use with --control or --worker).',
745
+ )
746
+ .option('--vm-info', 'Display full configuration and status for the command argument [vm-id].')
747
+ .option('--vm-test', 'Run connectivity and health checks on the command argument [vm-id].')
748
+ .option(
749
+ '--vm-sync-engine',
750
+ 'Re-copy the host engine source into the command argument [vm-id], overriding whatever is currently there (equivalent to the engine-bootstrap step of --vm-init in isolation).',
751
+ )
752
+ .option('--root-size <gb-size>', 'Root disk size in GiB for --vm-create (default: 32).')
710
753
  .option(
711
754
  '--join-node <nodes>',
712
755
  'Join a K3s worker to a control plane. Standalone format: "workerName,controlName". ' +
713
- 'When used with --init-vm --worker, provide just the control node name for auto-join.',
756
+ 'When used with --vm-init --worker, provide just the control node name for auto-join.',
714
757
  )
715
758
  .option('--expose <vm-name:ports>', 'Proxy host ports to a VM (e.g., "k3s-control:80,443").')
759
+ .option(
760
+ '--node-port <port>',
761
+ 'Customizes the VM-side (connect) port for --expose, so the host listens on the given port but proxies to this NodePort inside the VM (e.g. expose host 27017 -> VM NodePort 32017).',
762
+ )
716
763
  .option('--delete-expose <vm-name:ports>', 'Remove proxied ports from a VM (e.g., "k3s-control:80,443").')
717
- .option('--bootstrap-engine <vm-name>', 'Replicate /home/dd/engine source into the VM after init completes.')
764
+ .option(
765
+ '--copy',
766
+ 'For two-phase flows that surface a command for the user to execute (e.g. --create-admin-profile phase 1), copy the command to the clipboard instead of printing it to the terminal.',
767
+ )
718
768
  .option('--namespace <namespace>', 'Kubernetes namespace context (defaults to "default").')
769
+ .option(
770
+ '--maas-project <project>',
771
+ 'LXD project managed by MAAS (e.g. "k3s-cluster"). When set, all lxc commands target this project so MAAS enumerates the VMs in its machines UI.',
772
+ )
773
+ .option(
774
+ '--move-to-project',
775
+ 'Stop the [vm-id] VM in the default project, move it to --maas-project, then start it so MAAS picks it up. Requires --maas-project.',
776
+ )
719
777
  .description('Manages LXD virtual machines as K3s nodes (control plane or workers).')
720
- .action(Underpost.lxd.callback);
778
+ .action((vmId, options) => Underpost.lxd.callback(vmId, options));
721
779
 
722
780
  program
723
781
  .command('baremetal [workflow-id]')
@@ -817,7 +875,7 @@ program
817
875
  .option(
818
876
  '--ci-push <deploy-id>',
819
877
  'Local equivalent of engine-*.ci.yml: builds dd-{deploy-id} and pushes to the engine-{deploy-id} repository. ' +
820
- 'Accepts the suffix (e.g., "cyberia"), "dd-cyberia", or "engine-cyberia".',
878
+ 'Accepts the suffix (e.g., "cyberia"), "dd-cyberia", or "engine-cyberia".',
821
879
  )
822
880
  .option(
823
881
  '--message <message>',