underpost 3.2.80 → 3.3.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.
- package/.github/workflows/ghpkg.ci.yml +7 -1
- package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -16
- package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
- package/.github/workflows/release.cd.yml +1 -9
- package/CHANGELOG.md +291 -1
- package/CLI-HELP.md +174 -23
- package/README.md +5 -2
- package/bin/build.js +7 -5
- package/bin/deploy.js +19 -17
- package/deploy/lib/logging.sh +96 -0
- package/deploy/pwa-microservices-template/deploy.sh +72 -0
- package/deploy/release/deploy.sh +62 -0
- package/docker-compose.yml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +5 -1
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-vultr.yaml +52 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/playwright/deployment.yaml +1 -1
- package/manifests/mongodb/kustomization.yaml +4 -1
- package/manifests/mongodb/statefulset.yaml +4 -0
- package/manifests/mongodb/storage-class.yaml +9 -2
- package/package.json +19 -19
- package/scripts/audit-selinux.sh +64 -0
- package/scripts/coverall-test.sh +24 -0
- package/scripts/gpu-diag.sh +0 -0
- package/scripts/ip-info.sh +0 -0
- package/scripts/k3s-node-setup.sh +18 -15
- package/scripts/kubeadm-node-setup.sh +12 -23
- package/scripts/link-local-underpost-cli.sh +0 -0
- package/scripts/lxd-vm-setup.sh +0 -0
- package/scripts/maas-nat-firewalld.sh +0 -0
- package/scripts/nat-iptables.sh +12 -4
- package/scripts/rhel-grpc-setup.sh +0 -0
- package/scripts/rocky-kickstart.sh +25 -9
- package/scripts/test-monitor.sh +4 -3
- package/src/cli/baremetal.js +1 -2
- package/src/cli/cloud-init.js +1 -1
- package/src/cli/cluster.js +786 -96
- package/src/cli/db.js +11 -4
- package/src/cli/deploy.js +1698 -177
- package/src/cli/docker-compose.js +19 -178
- package/src/cli/env.js +1 -1
- package/src/cli/image.js +15 -7
- package/src/cli/index.js +245 -44
- package/src/cli/ipfs.js +82 -11
- package/src/cli/lxd.js +1 -1
- package/src/cli/monitor.js +2 -2
- package/src/cli/release.js +57 -22
- package/src/cli/repository.js +12 -10
- package/src/cli/run.js +2195 -427
- package/src/cli/secrets.js +969 -0
- package/src/cli/ssh.js +206 -105
- package/src/cli/system.js +26 -13
- package/src/cli/test.js +1 -1
- package/src/cli/vultr.js +583 -0
- package/src/cli/wireguard.js +2125 -0
- package/src/client-builder/client-build.js +102 -13
- package/src/client-builder/ssr.js +27 -73
- package/src/db/mongo/MongoBootstrap.js +295 -54
- package/src/db/mongo/MongooseDB.js +51 -32
- package/src/index.js +25 -1
- package/src/projects/underpost/catalog-underpost.js +4 -1
- package/src/server/backup.js +1 -1
- package/src/server/conf.js +1216 -168
- package/src/server/cri.js +70 -0
- package/src/server/cron.js +249 -51
- package/src/server/dns.js +100 -6
- package/src/server/environment.js +98 -0
- package/src/server/forward-proxy.js +549 -0
- package/src/server/middlewares.js +56 -1
- package/src/server/process.js +0 -1
- package/src/server/selinux.js +185 -0
- package/src/server/systemd.js +205 -0
- package/src/server/underpost-compression.js +186 -0
- package/src/server/underpost-gateway.js +1083 -0
- package/src/server/underpost-ingress.js +380 -0
- package/test/cluster-instances.test.js +435 -0
- package/test/deploy-node-placement.test.js +45 -0
- package/test/instance-traffic-plan.test.js +710 -0
- package/test/selinux.test.js +71 -0
- package/test/sops-secret-store.test.js +612 -0
- package/test/underpost-gateway.test.js +510 -0
- package/test/underpost-ingress.test.js +305 -0
- package/test/wireguard-edge.test.js +1177 -0
package/CLI-HELP.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Underpost CLI
|
|
2
2
|
|
|
3
|
-
> underpost ci/cd cli v3.
|
|
3
|
+
> underpost ci/cd cli v3.3.0
|
|
4
4
|
|
|
5
5
|
**Usage:** `underpost [options] [command]`
|
|
6
6
|
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
| [`test`](#underpost-test) | Manages and runs tests, defaulting to the current Underpost default test suite. |
|
|
40
40
|
| [`monitor`](#underpost-monitor) | Manages health server monitoring for specified deployments. |
|
|
41
41
|
| [`ssh`](#underpost-ssh) | Manages SSH credentials and sessions for remote access to cluster nodes or services. |
|
|
42
|
+
| [`wireguard`](#underpost-wireguard) | Manages the WireGuard L3 hub-and-spoke transport and the HAProxy edge gateway in front of it. |
|
|
43
|
+
| [`haproxy`](#underpost-haproxy) | Manages the HAProxy edge gateway over the WireGuard transport (same subsystem as `underpost wireguard`). |
|
|
44
|
+
| [`vultr`](#underpost-vultr) | Meters the edge VPS bandwidth against its Vultr plan quota and blocks egress before overage accrues. |
|
|
42
45
|
| [`run`](#underpost-run) | Runs specified scripts using various runners. |
|
|
43
46
|
| [`docker-compose`](#underpost-docker-compose) | General-purpose Docker Compose development pipeline (mirrors the Kubernetes dev stack). |
|
|
44
47
|
| [`lxd`](#underpost-lxd) | Manages LXD virtual machines as K3s nodes (control plane or workers). |
|
|
@@ -106,6 +109,7 @@ Builds client assets, single replicas, and/or syncs environment ports.
|
|
|
106
109
|
| `--merge-zip <build-prefix>` | Merge split ZIP parts back into a single ZIP file for the given build prefix |
|
|
107
110
|
| `--lite-build` | Skip full build (default is full build) |
|
|
108
111
|
| `--icons-build` | Build icons |
|
|
112
|
+
| `--ssr` | Rebuild only SSR views defined in conf.ssr.json, leaving client assets untouched |
|
|
109
113
|
| `-h, --help` | display help for command |
|
|
110
114
|
|
|
111
115
|
---
|
|
@@ -227,7 +231,7 @@ Manages commits to a GitHub repository, supporting various commit types and opti
|
|
|
227
231
|
| `--has-changes` | Prints "1" if there are staged or unstaged git changes in the repository, empty string otherwise. |
|
|
228
232
|
| `--remote-url` | Prints the current git remote URL (origin) in plain text. |
|
|
229
233
|
| `--switch-repo <url>` | Switches the git remote (origin) to <url> and force-pulls the target branch, overwriting the current working tree (discards local commits and tracked changes). Accepts a full URL or "owner/repo". |
|
|
230
|
-
| `--target-branch <branch>` | Target branch for --switch-repo (default:
|
|
234
|
+
| `--target-branch <branch>` | Target branch for --switch-repo (default: remote default branch). |
|
|
231
235
|
| `-h, --help` | display help for command |
|
|
232
236
|
|
|
233
237
|
---
|
|
@@ -389,6 +393,10 @@ Displays the current public machine IP addresses.
|
|
|
389
393
|
| `--ban-egress-clear` | Clears all banned egress IP addresses. |
|
|
390
394
|
| `--ban-both-add` | Adds IP addresses to both banned ingress and egress lists. |
|
|
391
395
|
| `--ban-both-remove` | Removes IP addresses from both banned ingress and egress lists. |
|
|
396
|
+
| `--block-all-egress` | Blocks all outbound traffic from this host (keeps established/related connections). |
|
|
397
|
+
| `--unblock-all-egress` | Unblocks all outbound traffic and restores default ACCEPT policy. |
|
|
398
|
+
| `--block-all-ingress` | Blocks all new inbound traffic to this host (keeps established/related connections). |
|
|
399
|
+
| `--unblock-all-ingress` | Unblocks all inbound traffic and restores default ACCEPT policy. |
|
|
392
400
|
| `--mac` | Prints the MAC address of the main network interface. |
|
|
393
401
|
| `-h, --help` | display help for command |
|
|
394
402
|
|
|
@@ -411,7 +419,7 @@ Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
|
411
419
|
| Option | Description |
|
|
412
420
|
| --- | --- |
|
|
413
421
|
| `--reset` | Deletes all clusters and prunes all related data and caches. |
|
|
414
|
-
| `--reset-mongodb` | Performs a hard cleanup of only MongoDB-related resources (StatefulSet, PVCs/PVs, Secrets, ConfigMaps, caches) without restarting the whole node. |
|
|
422
|
+
| `--reset-mongodb` | Performs a hard cleanup of only MongoDB-related resources (StatefulSet, PVCs/PVs, Secrets, ConfigMaps, caches) without restarting the whole node. Combined with --mongodb it instead wipes the retained hostPath volumes as part of that deploy, so the replica set starts from empty data. |
|
|
415
423
|
| `--mariadb` | Initializes the cluster with a MariaDB statefulset. |
|
|
416
424
|
| `--mysql` | Initializes the cluster with a MySQL statefulset. |
|
|
417
425
|
| `--mongodb` | Initializes the cluster with a MongoDB statefulset. |
|
|
@@ -421,6 +429,9 @@ Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
|
421
429
|
| `--valkey` | Initializes the cluster with a Valkey service. |
|
|
422
430
|
| `--ipfs` | Initializes the cluster with an ipfs-cluster statefulset. |
|
|
423
431
|
| `--contour` | Initializes the cluster with Project Contour base HTTPProxy and Envoy. |
|
|
432
|
+
| `--gateway-api` | Initializes the cluster with the Gateway API control plane (CRDs, Envoy Gateway, GatewayClass) used by generated HTTPRoute + QUIC/HTTP3 manifests. With --dev the data plane binds the listener ports on the host network for direct browser access. |
|
|
433
|
+
| `--gateway-class <name>` | GatewayClass name to provision (default "eg"). |
|
|
434
|
+
| `--ingress-node <node-name>` | Dedicated node for underpost-ingress when both routing stacks coexist. Workload placement flags do not move it. |
|
|
424
435
|
| `--node-port` | Exposes enabled ready services (e.g. MongoDB 4.4, Valkey) to the host/public network via their NodePort Service manifest. |
|
|
425
436
|
| `--node-selector <k8s-node-name>` | Pins the just-deployed StatefulSet (MongoDB 4.4 / Valkey) to the given Kubernetes node once it is ready (via a kubernetes.io/hostname nodeSelector). |
|
|
426
437
|
| `--cert-manager` | Initializes the cluster with a Let's Encrypt production ClusterIssuer. |
|
|
@@ -468,13 +479,14 @@ Manages application deployments, defaulting to deploying development pods.
|
|
|
468
479
|
| `--remove` | Deletes specified deployments and their associated services. |
|
|
469
480
|
| `--sync` | Synchronizes deployment environment variables, ports, and replica counts. |
|
|
470
481
|
| `--info-router` | Displays the current router structure and configuration. |
|
|
471
|
-
| `--expose` | Exposes services matching the provided deployment ID list. |
|
|
472
482
|
| `--cert` | Resets TLS/SSL certificate secrets for deployments. |
|
|
473
483
|
| `--cert-hosts <hosts>` | Resets TLS/SSL certificate secrets for specified hosts. |
|
|
474
484
|
| `--self-signed` | Use a pre-created self-signed TLS secret (kubernetes.io/tls) instead of cert-manager. The secret must already exist in the namespace with the same name as the host. Enables TLS in the Contour HTTPProxy virtualhost without requiring a production ClusterIssuer. |
|
|
475
485
|
| `--node <node>` | Sets optional node for deployment operations. |
|
|
486
|
+
| `--ingress-node <node-name>` | Explicitly relocates the shared host-network ingress; ordinary --node placement never moves it. |
|
|
476
487
|
| `--ssh-key-path <path>` | Private key path for node SSH operations. Currently used when shipping a hostPath volume to a remote target node over SSH. Defaults to engine-private/deploy/id_rsa. |
|
|
477
488
|
| `--build-manifest` | Builds Kubernetes YAML manifests, including deployments, services, proxies, and secrets. |
|
|
489
|
+
| `--sync-static` | Places the SSR status pages and intercepted contexts in the gateway static utility tree, so the edge serves them instead of the application pods. Prefers the running workload and falls back to this checkout, so it can seed the tree before the deployment exists and refresh it once the deployment is Ready. |
|
|
478
490
|
| `--replicas <replicas>` | Sets a custom number of replicas for deployments. |
|
|
479
491
|
| `--image <image>` | Sets a custom image for deployments. |
|
|
480
492
|
| `--versions <deployment-versions>` | A comma-separated list of custom deployment versions. |
|
|
@@ -484,28 +496,25 @@ Manages application deployments, defaulting to deploying development pods.
|
|
|
484
496
|
| `--retry-count <count>` | Sets HTTPProxy per-route retry count (e.g., 3). |
|
|
485
497
|
| `--retry-per-try-timeout <duration>` | Sets HTTPProxy retry per-try timeout (e.g., "150ms"). |
|
|
486
498
|
| `--disable-update-deployment` | Disables updates to deployments. |
|
|
487
|
-
| `--disable-runtime-probes` |
|
|
499
|
+
| `--disable-runtime-probes` | Deprecated compatibility flag; readiness probes remain mandatory. Use --tcp-probes for legacy workloads. |
|
|
488
500
|
| `--tcp-probes` | Generates legacy TCP socket probes instead of HTTP internal-status probes (migration). |
|
|
489
501
|
| `--disable-update-proxy` | Disables updates to proxies. |
|
|
490
502
|
| `--disable-deployment-proxy` | Disables proxies of deployments. |
|
|
503
|
+
| `--gateway-api` | Routes through the Gateway API stack (Gateway + HTTPRoute) instead of the Contour HTTPProxy. Both manifest sets are always generated; this selects which one is applied. |
|
|
504
|
+
| `--gateway-class <name>` | GatewayClass name for generated Gateway manifests (default "eg"). |
|
|
505
|
+
| `--disable-http3` | Omits the QUIC/HTTP3 listener config and the Alt-Svc advertisement from Gateway API manifests. |
|
|
506
|
+
| `--quic-port <port>` | UDP port advertised for QUIC/HTTP3 in generated Gateway API manifests (default 443). |
|
|
491
507
|
| `--disable-update-volume` | Disables updates to volume mounts during deployment. |
|
|
492
|
-
| `--status` | Retrieves current network traffic data from resource deployments and the host machine network configuration. |
|
|
493
508
|
| `--kubeadm` | Enables the kubeadm context for deployment operations. |
|
|
494
509
|
| `--k3s` | Enables the k3s context for deployment operations. |
|
|
495
510
|
| `--kind` | Enables the kind context for deployment operations. |
|
|
496
511
|
| `--git-clean` | Runs git clean on volume mount paths before copying. |
|
|
497
512
|
| `--disable-update-underpost-config` | Disables updates to Underpost configuration during deployment. |
|
|
498
513
|
| `--namespace <namespace>` | Kubernetes namespace for deployment operations (defaults to "default"). |
|
|
499
|
-
| `--kind-type <kind-type>` | Specifies the Kind cluster type for deployment operations. |
|
|
500
|
-
| `--port <port>` | Sets up port forwarding from local to remote ports. |
|
|
501
|
-
| `--expose-port <port>` | Sets the local:remote port to expose when --expose is active (overrides auto-detected service port). |
|
|
502
|
-
| `--expose-local-port <port>` | Sets a different local port for --expose (e.g. 80) while keeping the remote service port. Useful for /etc/hosts local access without specifying a port in the browser. |
|
|
503
|
-
| `--local-proxy` | Forward all service TCP ports locally and start the Node.js path-routing proxy. Enables full path-based routing (e.g. /wp alongside /) without needing --expose-local-port. Requires --expose. |
|
|
504
514
|
| `--cmd <cmd>` | Custom initialization command for deployment (comma-separated commands). |
|
|
505
515
|
| `--skip-full-build` | Skip client bundle rebuild; container will pull pre-built bundle via pull-bundle instead. |
|
|
506
516
|
| `--pull-bundle` | Explicitly pull the pre-built client bundle from Cloudinary inside the container. Use together with --skip-full-build. |
|
|
507
517
|
| `--image-pull-policy <policy>` | Override container imagePullPolicy in the generated deployment manifest (Always, IfNotPresent, Never). Defaults to Never for localhost/ images and IfNotPresent otherwise. |
|
|
508
|
-
| `--tls` | Enables TLS for the local proxy started by --expose --local-proxy. The proxy will serve HTTPS on port 443 using self-signed certificates resolved from the local SSL store. Use together with --expose and --local-proxy. |
|
|
509
518
|
| `-h, --help` | display help for command |
|
|
510
519
|
|
|
511
520
|
---
|
|
@@ -514,13 +523,13 @@ Manages application deployments, defaulting to deploying development pods.
|
|
|
514
523
|
|
|
515
524
|
Manages secrets for various platforms.
|
|
516
525
|
|
|
517
|
-
**Usage:** `underpost secret [options]
|
|
526
|
+
**Usage:** `underpost secret [options] [platform]`
|
|
518
527
|
|
|
519
528
|
#### Arguments
|
|
520
529
|
|
|
521
530
|
| Argument | Description |
|
|
522
531
|
| --- | --- |
|
|
523
|
-
| `platform` | The secret management platform. Options: underpost, sanitizeSecretEnvFile, globalSecretClean. |
|
|
532
|
+
| `platform` | The secret management platform. Options: underpost, sops, sanitizeSecretEnvFile, globalSecretClean. Defaults to "sops". (default: "sops") |
|
|
524
533
|
|
|
525
534
|
#### Options
|
|
526
535
|
|
|
@@ -531,6 +540,17 @@ Manages secrets for various platforms.
|
|
|
531
540
|
| `--create-from-env` | Creates secrets from container environment variables (envFrom: secretRef). |
|
|
532
541
|
| `--global-clean` | Removes all filesystem traces of secrets (engine-private, .env, conf cache). |
|
|
533
542
|
| `--list` | Lists all available secrets for the platform. |
|
|
543
|
+
| `--encrypt <plaintext-path>` | Encrypts a plaintext Secret manifest into the Git-tracked SOPS store and shreds the source (sops platform). |
|
|
544
|
+
| `--apply` | Decrypts stored SOPS manifests and streams them into kubectl apply, without writing plaintext to disk (sops platform). |
|
|
545
|
+
| `--namespace <namespace>` | Kubernetes namespace for secret operations (defaults to "default"). |
|
|
546
|
+
| `--install-tools` | Installs the sops and age host binaries only, without running a full cluster host initialization. |
|
|
547
|
+
| `--rotate` | Re-keys every stored SOPS manifest onto --recipient. Secret values are unchanged, so no workload restart is needed. |
|
|
548
|
+
| `--recipient <age-public-key>` | Incoming Age public recipient for --rotate. |
|
|
549
|
+
| `--prune-recipients` | With --rotate, makes --recipient the only recipient, revoking every previous key (use after a key compromise). Requires --force, and revokes CI/CD keys too unless they are named in --keep-recipients. |
|
|
550
|
+
| `--keep-recipients <age-public-keys>` | Comma-separated recipients to retain while --prune-recipients revokes the rest (e.g. the CI/CD key). |
|
|
551
|
+
| `--purge <secret-name>` | Emergency removal: deletes the live Kubernetes Secret and takes its encrypted manifest out of the store. |
|
|
552
|
+
| `--force` | Confirms the irreversible variant: deletes the manifest instead of archiving it (--purge), revokes recipients (--rotate --prune-recipients), or replaces an existing manifest (--encrypt). |
|
|
553
|
+
| `--dry-run` | Reports what --apply, --rotate, or --purge would do without changing anything. |
|
|
534
554
|
| `-h, --help` | display help for command |
|
|
535
555
|
|
|
536
556
|
---
|
|
@@ -666,18 +686,19 @@ Manages cron jobs: execute jobs directly or generate and apply K8s CronJob manif
|
|
|
666
686
|
|
|
667
687
|
| Argument | Description |
|
|
668
688
|
| --- | --- |
|
|
669
|
-
| `deploy-list` | A comma-separated list of deployment IDs (e.g., "default-a,default-b"). |
|
|
670
|
-
| `job-list` | A comma-separated list of job IDs. Options: dns,backup. Defaults to all available jobs. |
|
|
689
|
+
| `deploy-list` | A comma-separated list of deployment IDs (e.g., "default-a,default-b"). In manifest modes its first entry is the manifest owner deploy-id. |
|
|
690
|
+
| `job-list` | A comma-separated list of job IDs. Options: dns,backup,vultr. Defaults to all available jobs, and restricts which jobs are generated in manifest modes. |
|
|
671
691
|
|
|
672
692
|
#### Options
|
|
673
693
|
|
|
674
694
|
| Option | Description |
|
|
675
695
|
| --- | --- |
|
|
676
696
|
| `--generate-k8s-cronjobs` | Generates Kubernetes CronJob YAML manifests from cron configuration. |
|
|
677
|
-
| `--apply` |
|
|
678
|
-
| `--setup-start
|
|
697
|
+
| `--apply` | Generates and applies K8s CronJob manifests to the cluster via kubectl (never runs jobs). |
|
|
698
|
+
| `--setup-start` | Updates deploy-list package.json start script and generates+applies its K8s CronJob manifests. |
|
|
679
699
|
| `--namespace <namespace>` | Kubernetes namespace for the CronJob resources (default: "default"). |
|
|
680
700
|
| `--image <image>` | Custom container image for the CronJob pods. |
|
|
701
|
+
| `--node-name <node-name>` | Pins the CronJob pods to this node via a kubernetes.io/hostname nodeSelector. |
|
|
681
702
|
| `--git` | Pass --git flag to cron job execution. |
|
|
682
703
|
| `--cmd <cmd>` | Optional pre-script commands to run before cron execution. |
|
|
683
704
|
| `--dev` | Use local ./ base path instead of global underpost installation. |
|
|
@@ -685,7 +706,7 @@ Manages cron jobs: execute jobs directly or generate and apply K8s CronJob manif
|
|
|
685
706
|
| `--kind` | Use kind cluster context (apply via kind-worker container). |
|
|
686
707
|
| `--kubeadm` | Use kubeadm cluster context (apply directly on host). |
|
|
687
708
|
| `--dry-run` | Preview cron jobs without executing them. |
|
|
688
|
-
| `--create-job-now` |
|
|
709
|
+
| `--create-job-now` | Creates a Job from each CronJob on the cluster now (implies manifest mode; combine with --apply to publish first). |
|
|
689
710
|
| `-h, --help` | display help for command |
|
|
690
711
|
|
|
691
712
|
---
|
|
@@ -815,6 +836,127 @@ Manages SSH credentials and sessions for remote access to cluster nodes or servi
|
|
|
815
836
|
|
|
816
837
|
---
|
|
817
838
|
|
|
839
|
+
### underpost wireguard
|
|
840
|
+
|
|
841
|
+
Manages the WireGuard L3 hub-and-spoke transport and the HAProxy edge gateway in front of it.
|
|
842
|
+
|
|
843
|
+
**Usage:** `underpost wireguard [options]`
|
|
844
|
+
|
|
845
|
+
#### Options
|
|
846
|
+
|
|
847
|
+
| Option | Description |
|
|
848
|
+
| --- | --- |
|
|
849
|
+
| `--deploy-id <deploy-id>` | Deploy IDs whose conf.server.json/conf.instances.json define the routes. Accepts one id or a comma-separated list; defaults to "dd", every deploy in dd.router, because the edge holds one pair of map files for the whole cluster. |
|
|
850
|
+
| `--interface <name>` | WireGuard interface name (default: "wg0"). |
|
|
851
|
+
| `--wireguard-install` | Installs the wireguard-tools, haproxy and iptables host packages. |
|
|
852
|
+
| `--wireguard-setup` | Generates keys, builds the interface config, and applies local network rules. |
|
|
853
|
+
| `--server` | Configures this node as the hub endpoint accepting inbound tunnel traffic. |
|
|
854
|
+
| `--client` | Configures this node as a spoke endpoint maintaining an outbound tunnel. |
|
|
855
|
+
| `--port <port>` | WireGuard UDP listening port (default: 51820). |
|
|
856
|
+
| `--cidr <cidr>` | Hub interface address with prefix when used with --server (e.g. "10.0.0.1/24"); the overlay subnet a spoke routes back through the hub when used with --client (default: "10.0.0.0/24"). |
|
|
857
|
+
| `--peer-ip <ip>` | Tunnel address of the target spoke. Required with --client and --peer-add. |
|
|
858
|
+
| `--endpoint <host:port>` | Hub host and port a spoke dials. Required with --client. |
|
|
859
|
+
| `--public-key <key>` | Hub public key with --client; spoke public key with --peer-add. |
|
|
860
|
+
| `--peer-add <peer-id>` | Registers a spoke and applies it to the running hub without a restart. |
|
|
861
|
+
| `--peer-remove <peer-id>` | Removes a spoke from the registry and from the running hub. |
|
|
862
|
+
| `--allowed-ips <cidrs>` | Comma-separated CIDRs routed to the spoke (e.g. "10.0.0.2/32,192.168.10.0/24"). |
|
|
863
|
+
| `--hosts <hosts>` | Comma-separated hostnames bound to the spoke, overriding instance resolution. |
|
|
864
|
+
| `--instances <instances>` | Comma-separated conf.instances.json ids bound to the spoke. |
|
|
865
|
+
| `--default` | Marks the spoke as the fallback for hostnames that match no other binding. |
|
|
866
|
+
| `--haproxy-setup` | Installs HAProxy, publishes the current routes, and enables the daemon. |
|
|
867
|
+
| `--haproxy-sync` | Recompiles the SNI/Host maps from deploy config and hot-reloads HAProxy. |
|
|
868
|
+
| `--status` | Prints the whole edge context without changing anything: role, interface, tunnel address, public key, daemon states, peers with their bindings and link health, and the resolved routing. |
|
|
869
|
+
| `--build-conf` | Writes only engine-private/deploy/conf.wireguard.json and touches no host state. Combine with --wireguard-setup / --peer-add / --peer-remove to author the topology off-box; alone it normalizes and validates the existing registry. |
|
|
870
|
+
| `--forward-proxy-server` | Ensures the hub HTTP/CONNECT forward proxy runs as the underpost-forward-proxy systemd service, bound to the tunnel address only (default port 1080), and returns. Authenticates every request with FORWARD_PROXY_API_KEY, so spokes can reach the internet through the VPS public address. Idempotent: re-running converges on the one service and restarts it only when the unit actually changed. |
|
|
871
|
+
| `--forward-proxy-server-host <host>` | Address the forward proxy binds, overriding the hub tunnel address from the registry. |
|
|
872
|
+
| `--forward-proxy-server-port <port>` | Port the forward proxy binds (default: 1080). |
|
|
873
|
+
| `--ssh-forward-port <port>` | Publishes the default spoke SSH port on this public TCP port of the hub, so CI with no fixed address can reach the cluster node (e.g. 2222). "0" closes it. Stored in the registry. |
|
|
874
|
+
| `--wireguard-start` | Enables and starts wg-quick@<interface> and the QUIC forward. |
|
|
875
|
+
| `--wireguard-stop` | Tears down the interface and removes its transient packet rules. |
|
|
876
|
+
| `--wireguard-reset` | Removes generated configs and packet rules, keeping the key pair and registry. |
|
|
877
|
+
| `--wireguard-reinstall` | Full purge, package reinstall and re-key; every spoke must re-register. |
|
|
878
|
+
| `--dry-run` | Prints the files and commands the run would apply, without touching the host. |
|
|
879
|
+
| `-h, --help` | display help for command |
|
|
880
|
+
|
|
881
|
+
---
|
|
882
|
+
|
|
883
|
+
### underpost haproxy
|
|
884
|
+
|
|
885
|
+
Manages the HAProxy edge gateway over the WireGuard transport (same subsystem as `underpost wireguard`).
|
|
886
|
+
|
|
887
|
+
**Usage:** `underpost haproxy [options]`
|
|
888
|
+
|
|
889
|
+
#### Options
|
|
890
|
+
|
|
891
|
+
| Option | Description |
|
|
892
|
+
| --- | --- |
|
|
893
|
+
| `--deploy-id <deploy-id>` | Deploy IDs whose conf.server.json/conf.instances.json define the routes. Accepts one id or a comma-separated list; defaults to "dd", every deploy in dd.router, because the edge holds one pair of map files for the whole cluster. |
|
|
894
|
+
| `--interface <name>` | WireGuard interface name (default: "wg0"). |
|
|
895
|
+
| `--wireguard-install` | Installs the wireguard-tools, haproxy and iptables host packages. |
|
|
896
|
+
| `--wireguard-setup` | Generates keys, builds the interface config, and applies local network rules. |
|
|
897
|
+
| `--server` | Configures this node as the hub endpoint accepting inbound tunnel traffic. |
|
|
898
|
+
| `--client` | Configures this node as a spoke endpoint maintaining an outbound tunnel. |
|
|
899
|
+
| `--port <port>` | WireGuard UDP listening port (default: 51820). |
|
|
900
|
+
| `--cidr <cidr>` | Hub interface address with prefix when used with --server (e.g. "10.0.0.1/24"); the overlay subnet a spoke routes back through the hub when used with --client (default: "10.0.0.0/24"). |
|
|
901
|
+
| `--peer-ip <ip>` | Tunnel address of the target spoke. Required with --client and --peer-add. |
|
|
902
|
+
| `--endpoint <host:port>` | Hub host and port a spoke dials. Required with --client. |
|
|
903
|
+
| `--public-key <key>` | Hub public key with --client; spoke public key with --peer-add. |
|
|
904
|
+
| `--peer-add <peer-id>` | Registers a spoke and applies it to the running hub without a restart. |
|
|
905
|
+
| `--peer-remove <peer-id>` | Removes a spoke from the registry and from the running hub. |
|
|
906
|
+
| `--allowed-ips <cidrs>` | Comma-separated CIDRs routed to the spoke (e.g. "10.0.0.2/32,192.168.10.0/24"). |
|
|
907
|
+
| `--hosts <hosts>` | Comma-separated hostnames bound to the spoke, overriding instance resolution. |
|
|
908
|
+
| `--instances <instances>` | Comma-separated conf.instances.json ids bound to the spoke. |
|
|
909
|
+
| `--default` | Marks the spoke as the fallback for hostnames that match no other binding. |
|
|
910
|
+
| `--haproxy-setup` | Installs HAProxy, publishes the current routes, and enables the daemon. |
|
|
911
|
+
| `--haproxy-sync` | Recompiles the SNI/Host maps from deploy config and hot-reloads HAProxy. |
|
|
912
|
+
| `--status` | Prints the whole edge context without changing anything: role, interface, tunnel address, public key, daemon states, peers with their bindings and link health, and the resolved routing. |
|
|
913
|
+
| `--build-conf` | Writes only engine-private/deploy/conf.wireguard.json and touches no host state. Combine with --wireguard-setup / --peer-add / --peer-remove to author the topology off-box; alone it normalizes and validates the existing registry. |
|
|
914
|
+
| `--forward-proxy-server` | Ensures the hub HTTP/CONNECT forward proxy runs as the underpost-forward-proxy systemd service, bound to the tunnel address only (default port 1080), and returns. Authenticates every request with FORWARD_PROXY_API_KEY, so spokes can reach the internet through the VPS public address. Idempotent: re-running converges on the one service and restarts it only when the unit actually changed. |
|
|
915
|
+
| `--forward-proxy-server-host <host>` | Address the forward proxy binds, overriding the hub tunnel address from the registry. |
|
|
916
|
+
| `--forward-proxy-server-port <port>` | Port the forward proxy binds (default: 1080). |
|
|
917
|
+
| `--ssh-forward-port <port>` | Publishes the default spoke SSH port on this public TCP port of the hub, so CI with no fixed address can reach the cluster node (e.g. 2222). "0" closes it. Stored in the registry. |
|
|
918
|
+
| `--wireguard-start` | Enables and starts wg-quick@<interface> and the QUIC forward. |
|
|
919
|
+
| `--wireguard-stop` | Tears down the interface and removes its transient packet rules. |
|
|
920
|
+
| `--wireguard-reset` | Removes generated configs and packet rules, keeping the key pair and registry. |
|
|
921
|
+
| `--wireguard-reinstall` | Full purge, package reinstall and re-key; every spoke must re-register. |
|
|
922
|
+
| `--dry-run` | Prints the files and commands the run would apply, without touching the host. |
|
|
923
|
+
| `-h, --help` | display help for command |
|
|
924
|
+
|
|
925
|
+
---
|
|
926
|
+
|
|
927
|
+
### underpost vultr
|
|
928
|
+
|
|
929
|
+
Meters the edge VPS bandwidth against its Vultr plan quota and blocks egress before overage accrues.
|
|
930
|
+
|
|
931
|
+
**Usage:** `underpost vultr [options] [deploy-list]`
|
|
932
|
+
|
|
933
|
+
#### Arguments
|
|
934
|
+
|
|
935
|
+
| Argument | Description |
|
|
936
|
+
| --- | --- |
|
|
937
|
+
| `deploy-list` | A comma-separated list of deployment IDs, logged for attribution. |
|
|
938
|
+
|
|
939
|
+
#### Options
|
|
940
|
+
|
|
941
|
+
| Option | Description |
|
|
942
|
+
| --- | --- |
|
|
943
|
+
| `--instance-id <instance-id>` | Vultr instance id to meter (default: VULTR_INSTANCE_ID). |
|
|
944
|
+
| `--api-key <api-key>` | Vultr API key (default: VULTR_API_KEY). Prefer the environment over this flag. |
|
|
945
|
+
| `--threshold <ratio>` | Fraction of the plan quota that triggers the egress block; "0.80" and "80" are both accepted (default: 0.80). |
|
|
946
|
+
| `--metric <metric>` | "total" (incoming + outgoing, default) or "outgoing" for egress alone. |
|
|
947
|
+
| `--month <yyyy-mm>` | Billing month to sum (default: the current UTC month). |
|
|
948
|
+
| `--all-dates` | Sum every daily bucket the API returns instead of scoping to one month. |
|
|
949
|
+
| `--host <ip>` | Edge VPS to block (default: VULTR_VPS_IP, then DEFAULT_SSH_HOST). |
|
|
950
|
+
| `--user <user>` | SSH user on the edge VPS (default: VULTR_SSH_USER, then DEFAULT_SSH_USER, then "root"). |
|
|
951
|
+
| `--key-path <path>` | SSH private key (default: VULTR_SSH_KEY_PATH, then DEFAULT_SSH_KEY_PATH). |
|
|
952
|
+
| `--port <port>` | SSH port on the edge VPS (default: VULTR_SSH_PORT, then DEFAULT_SSH_PORT, then 22). |
|
|
953
|
+
| `--force` | Re-apply the egress block even if it was already applied for this cycle. |
|
|
954
|
+
| `--auto-unblock` | Restore egress automatically once consumption falls back under the threshold. |
|
|
955
|
+
| `--dry-run` | Reports the consumption and the action it would take, without touching the edge VPS. |
|
|
956
|
+
| `-h, --help` | display help for command |
|
|
957
|
+
|
|
958
|
+
---
|
|
959
|
+
|
|
818
960
|
### underpost run
|
|
819
961
|
|
|
820
962
|
Runs specified scripts using various runners.
|
|
@@ -825,7 +967,7 @@ Runs specified scripts using various runners.
|
|
|
825
967
|
|
|
826
968
|
| Argument | Description |
|
|
827
969
|
| --- | --- |
|
|
828
|
-
| `runner-id` | The runner ID to run. Options: dev-cluster,
|
|
970
|
+
| `runner-id` | The runner ID to run. Options: status,expose,dev-cluster,metadata,ipfs-expose,svc-ls,svc-rm,node-move,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,tz,get-traffic,restore-mongo,ingress-refresh,instance-promote,instance,deploy-key,instance-build-manifest,ls-deployments,host-update,install-crio,dd-container,ip-info,db-client,git-conf,promote,metrics,cluster,gateway-status,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,sops-setup,sops-status,secret,underpost-config,gpu-env,tf-gpu-test,deploy-job,push-bundle,pull-bundle,kubeadm-wireguard,build-cluster-deployment-manifests,monitor-ui,shared-dir,shared-dir-add-user. |
|
|
829
971
|
| `path` | The input value, identifier, or path for the operation. |
|
|
830
972
|
|
|
831
973
|
#### Options
|
|
@@ -839,8 +981,12 @@ Runs specified scripts using various runners.
|
|
|
839
981
|
| `--replicas <replicas>` | Sets a custom number of replicas for deployment. |
|
|
840
982
|
| `--pod-name <pod-name>` | Optional: Specifies the pod name for execution. |
|
|
841
983
|
| `--node-name <node-name>` | Optional: Specifies the node name for execution. |
|
|
984
|
+
| `--ingress-node <node-name>` | Dedicated node for the host-network underpost-ingress listener. Workload --node-name never relocates it. |
|
|
842
985
|
| `--ssh-key-path <path>` | Optional: Private key path for node SSH operations, forwarded to volume shipping over SSH. Defaults to engine-private/deploy/id_rsa. |
|
|
843
986
|
| `--port <port>` | Optional: Specifies the port for execution. |
|
|
987
|
+
| `--expose-container-ports <ports>` | Comma-separated Service/container ports; multiple matched resources consume values by resource index. |
|
|
988
|
+
| `--expose-host-ports <ports>` | Comma-separated host ports paired with container ports by resource/port index. |
|
|
989
|
+
| `--local-proxy` | Starts the development path proxy after the expose runner creates its port-forwards. |
|
|
844
990
|
| `--etc-hosts` | Enables etc-hosts context for the runner execution. |
|
|
845
991
|
| `--volume-host-path <volume-host-path>` | Optional: Specifies the volume host path for test execution. |
|
|
846
992
|
| `--volume-mount-path <volume-mount-path>` | Optional: Specifies the volume mount path for test execution. |
|
|
@@ -867,16 +1013,16 @@ Runs specified scripts using various runners.
|
|
|
867
1013
|
| `--limits-memory <limits-memory>` | Sets memory limit for the runner execution. |
|
|
868
1014
|
| `--limits-cpu <limits-cpu>` | Sets CPU limit for the runner execution. |
|
|
869
1015
|
| `--resource-template-id <resource-template-id >` | Specifies a resource template ID for the runner execution. |
|
|
870
|
-
| `--expose` | Enables
|
|
1016
|
+
| `--expose` | Enables exposure-only behavior in compatible runners; the expose runner itself does not require this flag. |
|
|
871
1017
|
| `--conf-server-path <conf-server-path>` | Sets a custom configuration server path. |
|
|
872
1018
|
| `--underpost-root <underpost-root>` | Sets a custom Underpost root path. |
|
|
873
1019
|
| `--cmd-cron-jobs <cmd-cron-jobs>` | Pre-script commands to run before cron job execution. |
|
|
874
|
-
| `--deploy-id-cron-jobs <deploy-id-cron-jobs>` |
|
|
1020
|
+
| `--deploy-id-cron-jobs <deploy-id-cron-jobs>` | Cron deploy-id to set up during sync; defaults to dd.cron, "none" skips cron setup entirely. |
|
|
875
1021
|
| `--timezone <timezone>` | Sets the timezone for the runner execution. |
|
|
876
1022
|
| `--kubeadm` | Sets the kubeadm cluster context for the runner execution. |
|
|
877
1023
|
| `--k3s` | Sets the k3s cluster context for the runner execution. |
|
|
878
1024
|
| `--kind` | Sets the kind cluster context for the runner execution. |
|
|
879
|
-
| `--traffic <traffic>` | Blue/green traffic colour to bake into generated manifests (default: blue). |
|
|
1025
|
+
| `--traffic <traffic>` | Blue/green traffic colour to bake into generated manifests (default: blue). `stop` accepts a comma list, e.g. blue,green. |
|
|
880
1026
|
| `--git-clean` | Runs git clean on volume mount paths before copying. |
|
|
881
1027
|
| `--deploy-id <deploy-id>` | Sets deploy id context for the runner execution. |
|
|
882
1028
|
| `--user <user>` | Sets user context for the runner execution. |
|
|
@@ -887,6 +1033,11 @@ Runs specified scripts using various runners.
|
|
|
887
1033
|
| `--timeout-idle <duration>` | Sets HTTPProxy per-route idle timeout (e.g., "10s", "infinity"). |
|
|
888
1034
|
| `--retry-count <count>` | Sets HTTPProxy per-route retry count (e.g., 3). |
|
|
889
1035
|
| `--retry-per-try-timeout <duration>` | Sets HTTPProxy retry per-try timeout (e.g., "150ms"). |
|
|
1036
|
+
| `--gateway-api` | Routes through the Gateway API stack (Gateway + HTTPRoute) instead of the Contour HTTPProxy. Both manifest sets are always generated; this selects which one is applied. |
|
|
1037
|
+
| `--disable-gateway-api` | Falls back to the Contour HTTPProxy stack in runners where the Gateway API is the default (cluster). |
|
|
1038
|
+
| `--gateway-class <name>` | GatewayClass name for generated Gateway manifests (default "eg"). |
|
|
1039
|
+
| `--disable-http3` | Omits the QUIC/HTTP3 listener config and the Alt-Svc advertisement from Gateway API manifests. |
|
|
1040
|
+
| `--quic-port <port>` | UDP port advertised for QUIC/HTTP3 in generated Gateway API manifests (default 443). |
|
|
890
1041
|
| `--disable-private-conf-update` | Disables updates to private configuration during execution. |
|
|
891
1042
|
| `--logs` | Streams logs during the runner execution. |
|
|
892
1043
|
| `--monitor-status <status>` | Sets the status to monitor for pod/resource (default: "Running"). |
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<div align="center">
|
|
18
18
|
|
|
19
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://www.jsdelivr.com/package/npm/underpost) [](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://www.jsdelivr.com/package/npm/underpost) [](https://socket.dev/npm/package/underpost/overview/3.3.0) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
20
20
|
|
|
21
21
|
</div>
|
|
22
22
|
|
|
@@ -88,7 +88,7 @@ npm run dev
|
|
|
88
88
|
<!-- cli-index-start -->
|
|
89
89
|
## Underpost CLI
|
|
90
90
|
|
|
91
|
-
> underpost ci/cd cli v3.
|
|
91
|
+
> underpost ci/cd cli v3.3.0
|
|
92
92
|
|
|
93
93
|
**Usage:** `underpost [options] [command]`
|
|
94
94
|
|
|
@@ -127,6 +127,9 @@ npm run dev
|
|
|
127
127
|
| [`test`](CLI-HELP.md#underpost-test) | Manages and runs tests, defaulting to the current Underpost default test suite. |
|
|
128
128
|
| [`monitor`](CLI-HELP.md#underpost-monitor) | Manages health server monitoring for specified deployments. |
|
|
129
129
|
| [`ssh`](CLI-HELP.md#underpost-ssh) | Manages SSH credentials and sessions for remote access to cluster nodes or services. |
|
|
130
|
+
| [`wireguard`](CLI-HELP.md#underpost-wireguard) | Manages the WireGuard L3 hub-and-spoke transport and the HAProxy edge gateway in front of it. |
|
|
131
|
+
| [`haproxy`](CLI-HELP.md#underpost-haproxy) | Manages the HAProxy edge gateway over the WireGuard transport (same subsystem as `underpost wireguard`). |
|
|
132
|
+
| [`vultr`](CLI-HELP.md#underpost-vultr) | Meters the edge VPS bandwidth against its Vultr plan quota and blocks egress before overage accrues. |
|
|
130
133
|
| [`run`](CLI-HELP.md#underpost-run) | Runs specified scripts using various runners. |
|
|
131
134
|
| [`docker-compose`](CLI-HELP.md#underpost-docker-compose) | General-purpose Docker Compose development pipeline (mirrors the Kubernetes dev stack). |
|
|
132
135
|
| [`lxd`](CLI-HELP.md#underpost-lxd) | Manages LXD virtual machines as K3s nodes (control plane or workers). |
|
package/bin/build.js
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
} from '../src/server/conf.js';
|
|
16
16
|
import { loadDeployCatalog } from '../src/server/catalog.js';
|
|
17
17
|
import Underpost from '../src/index.js';
|
|
18
|
-
import { DOCKER_SCRIPTS } from '../src/api/cyberia-server-defaults/cyberia-server-defaults.js';
|
|
19
18
|
|
|
20
19
|
const baseConfPath = './engine-private/conf/dd-cron/.env.production';
|
|
21
20
|
if (fs.existsSync(baseConfPath)) dotenv.config({ path: baseConfPath, override: true });
|
|
@@ -114,6 +113,9 @@ const buildDeployTemplate = async (confName) => {
|
|
|
114
113
|
|
|
115
114
|
switch (confName) {
|
|
116
115
|
case 'dd-cyberia': {
|
|
116
|
+
const { CyberiaDependencies, DOCKER_SCRIPTS } = await import(
|
|
117
|
+
`../src/api/cyberia-server-defaults/cyberia-server-defaults.js`
|
|
118
|
+
);
|
|
117
119
|
fs.copyFileSync(`./bin/cyberia.js`, `${basePath}/bin/cyberia.js`);
|
|
118
120
|
fs.copyFileSync(
|
|
119
121
|
`./.github/workflows/publish.cyberia.ci.yml`,
|
|
@@ -124,7 +126,6 @@ const buildDeployTemplate = async (confName) => {
|
|
|
124
126
|
packageJson.bin.cyberia = 'bin/index.js';
|
|
125
127
|
packageJson.keywords = catalog.keywords;
|
|
126
128
|
packageJson.description = catalog.description;
|
|
127
|
-
const { CyberiaDependencies } = await import(`../src/api/cyberia-server-defaults/cyberia-server-defaults.js`);
|
|
128
129
|
packageJson.dependencies = {
|
|
129
130
|
underpost: '^' + Underpost.version.replace('v', ''),
|
|
130
131
|
'adm-zip': '^0.6.0',
|
|
@@ -155,9 +156,10 @@ const buildDeployTemplate = async (confName) => {
|
|
|
155
156
|
JSON.stringify(packageJson, null, 4).replaceAll('pwa-microservices-template', repoName),
|
|
156
157
|
'utf8',
|
|
157
158
|
);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
if (fs.existsSync(`./deploy/${confName}`))
|
|
160
|
+
fs.copySync(`./deploy/${confName}`, `${basePath}/deploy/${confName}`, {
|
|
161
|
+
overwrite: true,
|
|
162
|
+
});
|
|
161
163
|
|
|
162
164
|
fs.copyFileSync(`./.github/workflows/${repoName}.ci.yml`, `${basePath}/.github/workflows/${repoName}.ci.yml`);
|
|
163
165
|
if (fs.existsSync(`./.github/workflows/docker-image.${repoName}.ci.yml`))
|
package/bin/deploy.js
CHANGED
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
addWsConf,
|
|
15
15
|
buildWsSrc,
|
|
16
16
|
cloneSrcComponents,
|
|
17
|
-
writeEnv,
|
|
18
17
|
buildCliDoc,
|
|
19
18
|
loadConf,
|
|
20
19
|
} from '../src/server/conf.js';
|
|
20
|
+
import { writeEnv } from '../src/server/environment.js';
|
|
21
21
|
import colors from 'colors';
|
|
22
22
|
import { program } from '../src/cli/index.js';
|
|
23
23
|
import { timer, getCapVariableName } from '../src/client/components/core/CommonJs.js';
|
|
@@ -223,21 +223,23 @@ try {
|
|
|
223
223
|
.readFileSync(`./engine-private/deploy/dd.router`, 'utf8')
|
|
224
224
|
.split(`,`)
|
|
225
225
|
.concat(['dd-cron'])) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
);
|
|
226
|
+
// The same set `deploy --build-manifest` mirrors. Anything missing here
|
|
227
|
+
// is a manifest the project repo silently stops carrying while the
|
|
228
|
+
// private build dir still has it.
|
|
229
|
+
for (const file of [
|
|
230
|
+
'deployment.yaml',
|
|
231
|
+
'proxy.yaml',
|
|
232
|
+
'gateway.yaml',
|
|
233
|
+
'httproute.yaml',
|
|
234
|
+
'pv-pvc.yaml',
|
|
235
|
+
'traffic-service.yaml',
|
|
236
|
+
'grpc-service.yaml',
|
|
237
|
+
]) {
|
|
238
|
+
const source = `./engine-private/conf/${deployId}/build/development/${file}`;
|
|
239
|
+
const target = `./manifests/deployment/${deployId}-development/${file}`;
|
|
240
|
+
if (fs.existsSync(source)) fs.copySync(source, target);
|
|
241
|
+
else fs.removeSync(target);
|
|
242
|
+
}
|
|
241
243
|
shellExec(`node bin new --dev --default-conf --deploy-id ${deployId}`);
|
|
242
244
|
}
|
|
243
245
|
break;
|
|
@@ -763,7 +765,7 @@ nvidia/gpu-operator \
|
|
|
763
765
|
|
|
764
766
|
case 'pw-conf': {
|
|
765
767
|
const scriptPath = process.argv[3];
|
|
766
|
-
shellExec(`kubectl delete configmap playwright-script`);
|
|
768
|
+
shellExec(`kubectl delete configmap playwright-script --ignore-not-found`);
|
|
767
769
|
shellExec(`kubectl create configmap playwright-script \
|
|
768
770
|
--from-file=script.js=${scriptPath} \
|
|
769
771
|
--dry-run=client -o yaml | kubectl apply -f -
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Shared logging helpers for deploy/<deploy-id>/*.sh. Sourced, never executed directly.
|
|
2
|
+
#
|
|
3
|
+
# Deploy script contract:
|
|
4
|
+
# - one run_quiet call per remote command, with its own label
|
|
5
|
+
# - the body lives in main(), invoked on the last line: the first remote command
|
|
6
|
+
# pulls this repository, rewriting the running script while bash reads it
|
|
7
|
+
#
|
|
8
|
+
# run_quiet hides normal output, prints only `patterns` matches plus the next
|
|
9
|
+
# `lines_after` lines, and returns the command's exit status so `set -e` stops
|
|
10
|
+
# the deployment. On failure it keeps two temp files and prints their paths in
|
|
11
|
+
# red instead of their contents: the command's own stderr (native error message
|
|
12
|
+
# and stack trace) and the full unfiltered log up to the error.
|
|
13
|
+
|
|
14
|
+
RUN_QUIET_RED=$'\033[0;31m'
|
|
15
|
+
RUN_QUIET_RESET=$'\033[0m'
|
|
16
|
+
|
|
17
|
+
RUN_QUIET_NODE_NAME=$(hostname 2>/dev/null | tr '[:upper:]' '[:lower:]')
|
|
18
|
+
RUN_QUIET_NODE_TAG=${RUN_QUIET_NODE_NAME:+ [$RUN_QUIET_NODE_NAME]}
|
|
19
|
+
|
|
20
|
+
run_quiet() {
|
|
21
|
+
local label="$1"
|
|
22
|
+
local patterns="$2"
|
|
23
|
+
local lines_after="$3"
|
|
24
|
+
shift 3
|
|
25
|
+
|
|
26
|
+
local debug_log
|
|
27
|
+
local error_log
|
|
28
|
+
local fifo_dir
|
|
29
|
+
local filter_pid
|
|
30
|
+
local stderr_pid
|
|
31
|
+
local status=0
|
|
32
|
+
|
|
33
|
+
echo "$(date -Is) $RUN_QUIET_NODE_TAG ▶ $label"
|
|
34
|
+
|
|
35
|
+
debug_log=$(mktemp --suffix=.debug.log)
|
|
36
|
+
error_log=$(mktemp --suffix=.error.log)
|
|
37
|
+
fifo_dir=$(mktemp -d)
|
|
38
|
+
mkfifo "$fifo_dir/merged" "$fifo_dir/stderr"
|
|
39
|
+
|
|
40
|
+
# The filter reads the live stream rather than the finished log: a deployment
|
|
41
|
+
# monitor prints its matches for minutes before exiting, so a pass over the
|
|
42
|
+
# completed file would show nothing until then. fflush defeats awk's block
|
|
43
|
+
# buffering, which otherwise withholds matches whenever stdout is a pipe.
|
|
44
|
+
# awk writes the debug log itself rather than piping through tee, so the
|
|
45
|
+
# reader stays a single process that a kill can always release.
|
|
46
|
+
awk \
|
|
47
|
+
-v pattern="$patterns" \
|
|
48
|
+
-v lines_after="$lines_after" \
|
|
49
|
+
-v debug_log="$debug_log" '
|
|
50
|
+
{
|
|
51
|
+
print > debug_log
|
|
52
|
+
}
|
|
53
|
+
$0 ~ pattern {
|
|
54
|
+
remaining = lines_after + 1
|
|
55
|
+
}
|
|
56
|
+
remaining > 0 {
|
|
57
|
+
print
|
|
58
|
+
fflush()
|
|
59
|
+
remaining--
|
|
60
|
+
}
|
|
61
|
+
' <"$fifo_dir/merged" &
|
|
62
|
+
filter_pid=$!
|
|
63
|
+
|
|
64
|
+
# stderr is duplicated: on its own for the native error and stack trace, and
|
|
65
|
+
# into the merged stream so both the debug log and the filter see it in
|
|
66
|
+
# chronological order with stdout.
|
|
67
|
+
tee -a "$error_log" <"$fifo_dir/stderr" >"$fifo_dir/merged" &
|
|
68
|
+
stderr_pid=$!
|
|
69
|
+
|
|
70
|
+
"$@" >"$fifo_dir/merged" 2>"$fifo_dir/stderr" || status=$?
|
|
71
|
+
|
|
72
|
+
# Drain both readers before the paths are printed, or the trace can still be
|
|
73
|
+
# in flight. Bounded: a command that leaks a child holding a stream open must
|
|
74
|
+
# not hang the deployment, and by then everything read has been written.
|
|
75
|
+
run_quiet_drain "$stderr_pid"
|
|
76
|
+
run_quiet_drain "$filter_pid"
|
|
77
|
+
rm -rf "$fifo_dir"
|
|
78
|
+
|
|
79
|
+
if [ "$status" -ne 0 ]; then
|
|
80
|
+
printf '%s✖ %s failed (exit %s)\n error trace: %s\n debug log: %s%s\n' \
|
|
81
|
+
"$RUN_QUIET_RED" "$label" "$status" "$error_log" "$debug_log" "$RUN_QUIET_RESET" >&2
|
|
82
|
+
return "$status"
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
rm -f "$debug_log" "$error_log"
|
|
86
|
+
|
|
87
|
+
return "$status"
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
run_quiet_drain() {
|
|
91
|
+
local pid="$1"
|
|
92
|
+
|
|
93
|
+
timeout 10 tail --pid="$pid" -f /dev/null 2>/dev/null || true
|
|
94
|
+
kill "$pid" 2>/dev/null || true
|
|
95
|
+
wait "$pid" 2>/dev/null || true
|
|
96
|
+
}
|