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.
Files changed (84) hide show
  1. package/.github/workflows/ghpkg.ci.yml +7 -1
  2. package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -16
  3. package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
  4. package/.github/workflows/release.cd.yml +1 -9
  5. package/CHANGELOG.md +291 -1
  6. package/CLI-HELP.md +174 -23
  7. package/README.md +5 -2
  8. package/bin/build.js +7 -5
  9. package/bin/deploy.js +19 -17
  10. package/deploy/lib/logging.sh +96 -0
  11. package/deploy/pwa-microservices-template/deploy.sh +72 -0
  12. package/deploy/release/deploy.sh +62 -0
  13. package/docker-compose.yml +1 -1
  14. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +5 -1
  15. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
  16. package/manifests/cronjobs/dd-cron/dd-cron-vultr.yaml +52 -0
  17. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  18. package/manifests/deployment/playwright/deployment.yaml +1 -1
  19. package/manifests/mongodb/kustomization.yaml +4 -1
  20. package/manifests/mongodb/statefulset.yaml +4 -0
  21. package/manifests/mongodb/storage-class.yaml +9 -2
  22. package/package.json +19 -19
  23. package/scripts/audit-selinux.sh +64 -0
  24. package/scripts/coverall-test.sh +24 -0
  25. package/scripts/gpu-diag.sh +0 -0
  26. package/scripts/ip-info.sh +0 -0
  27. package/scripts/k3s-node-setup.sh +18 -15
  28. package/scripts/kubeadm-node-setup.sh +12 -23
  29. package/scripts/link-local-underpost-cli.sh +0 -0
  30. package/scripts/lxd-vm-setup.sh +0 -0
  31. package/scripts/maas-nat-firewalld.sh +0 -0
  32. package/scripts/nat-iptables.sh +12 -4
  33. package/scripts/rhel-grpc-setup.sh +0 -0
  34. package/scripts/rocky-kickstart.sh +25 -9
  35. package/scripts/test-monitor.sh +4 -3
  36. package/src/cli/baremetal.js +1 -2
  37. package/src/cli/cloud-init.js +1 -1
  38. package/src/cli/cluster.js +786 -96
  39. package/src/cli/db.js +11 -4
  40. package/src/cli/deploy.js +1698 -177
  41. package/src/cli/docker-compose.js +19 -178
  42. package/src/cli/env.js +1 -1
  43. package/src/cli/image.js +15 -7
  44. package/src/cli/index.js +245 -44
  45. package/src/cli/ipfs.js +82 -11
  46. package/src/cli/lxd.js +1 -1
  47. package/src/cli/monitor.js +2 -2
  48. package/src/cli/release.js +57 -22
  49. package/src/cli/repository.js +12 -10
  50. package/src/cli/run.js +2195 -427
  51. package/src/cli/secrets.js +969 -0
  52. package/src/cli/ssh.js +206 -105
  53. package/src/cli/system.js +26 -13
  54. package/src/cli/test.js +1 -1
  55. package/src/cli/vultr.js +583 -0
  56. package/src/cli/wireguard.js +2125 -0
  57. package/src/client-builder/client-build.js +102 -13
  58. package/src/client-builder/ssr.js +27 -73
  59. package/src/db/mongo/MongoBootstrap.js +295 -54
  60. package/src/db/mongo/MongooseDB.js +51 -32
  61. package/src/index.js +25 -1
  62. package/src/projects/underpost/catalog-underpost.js +4 -1
  63. package/src/server/backup.js +1 -1
  64. package/src/server/conf.js +1216 -168
  65. package/src/server/cri.js +70 -0
  66. package/src/server/cron.js +249 -51
  67. package/src/server/dns.js +100 -6
  68. package/src/server/environment.js +98 -0
  69. package/src/server/forward-proxy.js +549 -0
  70. package/src/server/middlewares.js +56 -1
  71. package/src/server/process.js +0 -1
  72. package/src/server/selinux.js +185 -0
  73. package/src/server/systemd.js +205 -0
  74. package/src/server/underpost-compression.js +186 -0
  75. package/src/server/underpost-gateway.js +1083 -0
  76. package/src/server/underpost-ingress.js +380 -0
  77. package/test/cluster-instances.test.js +435 -0
  78. package/test/deploy-node-placement.test.js +45 -0
  79. package/test/instance-traffic-plan.test.js +710 -0
  80. package/test/selinux.test.js +71 -0
  81. package/test/sops-secret-store.test.js +612 -0
  82. package/test/underpost-gateway.test.js +510 -0
  83. package/test/underpost-ingress.test.js +305 -0
  84. package/test/wireguard-edge.test.js +1177 -0
@@ -168,7 +168,7 @@ PermitEmptyPasswords no
168
168
  PasswordAuthentication ${SSHD_PASSWORD_AUTH}
169
169
  ChallengeResponseAuthentication ${SSHD_KBD_INTERACTIVE}
170
170
  KbdInteractiveAuthentication ${SSHD_KBD_INTERACTIVE}
171
- UsePAM no
171
+ UsePAM yes
172
172
  X11Forwarding no
173
173
  PrintMotd no
174
174
  TCPKeepAlive yes
@@ -585,7 +585,7 @@ fi
585
585
  post_status "installing" "\"detail\":\"installing packages\",\"disk\":\"\$REAL_DISK\""
586
586
 
587
587
  ilog "Installing base packages with dnf --installroot ..."
588
- PKGS="@core kernel grub2-tools openssh-server NetworkManager chrony dracut-config-generic rocky-release"
588
+ PKGS="@core kernel grub2-tools openssh-server NetworkManager chrony dracut-config-generic rocky-release policycoreutils policycoreutils-python-utils selinux-policy-targeted audit sudo"
589
589
  if [ "\$FW" = "uefi" ]; then
590
590
  PKGS="\$PKGS grub2-efi-x64 shim-x64 efibootmgr"
591
591
  else
@@ -622,15 +622,10 @@ ilog "Configuring installed system (hostname, network, ssh, users) ..."
622
622
  echo "\${TARGET_HOSTNAME:-rocky9}" > "\$TARGET_MNT/etc/hostname"
623
623
 
624
624
  chroot "\$TARGET_MNT" /bin/bash -s << CHROOTEOF >> "\$KS_LOG" 2>&1
625
- set +e
625
+ set -e
626
626
  systemctl enable sshd NetworkManager chronyd 2>/dev/null
627
627
 
628
- # SELinux -> permissive in the DEPLOYED OS. Critical: with SELinux enforcing on
629
- # first boot, files written from this installer chroot (authorized_keys, home
630
- # dirs) carry the wrong security context, so sshd drops sessions ("Connection
631
- # reset by peer") and PAM can block console logins. Permissive ignores contexts
632
- # (no relabel reboot needed) and matches what kubeadm/cluster.js expect.
633
- sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config 2>/dev/null || true
628
+ sed -i 's/^SELINUX=.*/SELINUX=enforcing/' /etc/selinux/config
634
629
 
635
630
  # Ensure sshd host keys exist so sshd actually starts on first boot.
636
631
  ssh-keygen -A 2>/dev/null || true
@@ -708,11 +703,19 @@ fi
708
703
  # Key-only SSH on the installed system.
709
704
  mkdir -p /etc/ssh/sshd_config.d
710
705
  cat > /etc/ssh/sshd_config.d/00-underpost.conf <<SSHDEOF
706
+ Port ${SSH_PORT}
711
707
  PermitRootLogin prohibit-password
712
708
  PubkeyAuthentication yes
713
709
  PasswordAuthentication no
710
+ KbdInteractiveAuthentication no
711
+ UsePAM yes
714
712
  SSHDEOF
715
713
 
714
+ if [ "${SSH_PORT}" != "22" ]; then
715
+ semanage port -a -t ssh_port_t -p tcp "${SSH_PORT}" 2>/dev/null || \
716
+ semanage port -m -t ssh_port_t -p tcp "${SSH_PORT}"
717
+ fi
718
+
716
719
  # Create the admin login accounts. create_user <name> writes the authorized key,
717
720
  # wheel membership and passwordless sudo. Passwords are applied after the chroot.
718
721
  create_user() {
@@ -738,11 +741,24 @@ chmod 600 /root/.ssh/authorized_keys
738
741
  create_user "\${ADMIN_USER}"
739
742
  create_user "\${DEPLOY_USER}"
740
743
 
744
+ restorecon -RF /etc/ssh /etc/sudoers.d /root/.ssh /home 2>/dev/null
745
+ touch /.autorelabel
746
+
741
747
  # Build initramfs for the installed kernel.
742
748
  KVER=\\\$(ls /lib/modules | head -1)
743
749
  [ -n "\\\$KVER" ] && dracut -f /boot/initramfs-\\\$KVER.img "\\\$KVER"
744
750
  CHROOTEOF
745
751
 
752
+ CHROOT_RC=\$?
753
+ if [ "\$CHROOT_RC" -ne 0 ]; then
754
+ ilog "FATAL: installed-system configuration failed (rc=\$CHROOT_RC)"
755
+ post_status "failed" "\"detail\":\"installed-system configuration rc=\$CHROOT_RC\""
756
+ for d in dev proc sys run; do umount -l "\$TARGET_MNT/\$d" 2>/dev/null; done
757
+ umount -R "\$TARGET_MNT" 2>/dev/null || true
758
+ rm -f "\$INSTALL_LOCK"
759
+ exit 1
760
+ fi
761
+
746
762
  # Set console passwords AFTER the chroot heredoc, from decoded installer vars.
747
763
  # Primary path: pipe 'user:password' into 'chroot chpasswd' (keeps password
748
764
  # characters out of any heredoc). Fallback: hash with openssl and apply via
@@ -24,7 +24,7 @@ MODE=runtime # runtime | instance
24
24
  ENV=development # development | production
25
25
  DEPLOY_ID=dd-test # deploy id (instance mode: parent of conf.instances.json)
26
26
  INSTANCE_IDS= # instance mode: csv of ids (default: all in conf.instances.json)
27
- IMAGE=underpost/wp:v3.2.80 # runtime mode image (instance mode reads image from conf)
27
+ IMAGE=underpost/wp:v3.3.0 # runtime mode image (instance mode reads image from conf)
28
28
  VERSIONS=green # csv of blue/green versions
29
29
  REPLICAS=1 # replicas per deployment
30
30
  NAMESPACE=default # k8s namespace
@@ -202,7 +202,8 @@ run_runtime_mode() {
202
202
  setup_tls_secrets $(hosts_from "$SERVER_CONF")
203
203
  expose_flags="--tls"
204
204
  fi
205
- [ "$DO_EXPOSE" = true ] && node bin deploy --expose --local-proxy "$DEPLOY_ID" "$ENV" $expose_flags
205
+ [ "$DO_EXPOSE" = true ] && node bin run expose "${DEPLOY_ID}-${ENV}-traffic-service" --namespace "$NAMESPACE" \
206
+ --local-proxy $DEV_FLAG $CLUSTER_FLAG $expose_flags
206
207
  }
207
208
 
208
209
  # ─────────────────────────── instance mode ───────────────────────────
@@ -234,7 +235,7 @@ run_instance_mode() {
234
235
  # Plain HTTP: port-forward each instance service port directly.
235
236
  for id in "${ids[@]}"; do
236
237
  [ -n "$id" ] || continue
237
- node bin deploy --expose "${DEPLOY_ID}-${id}" "$ENV" --namespace "$NAMESPACE" || true
238
+ node bin run expose "${DEPLOY_ID}-${id}-${ENV}-traffic-service" --namespace "$NAMESPACE" $CLUSTER_FLAG || true
238
239
  done
239
240
  fi
240
241
  }
@@ -5,9 +5,8 @@
5
5
  */
6
6
 
7
7
  import { fileURLToPath } from 'url';
8
- import { getNpmRootPath, getUnderpostRootPath } from '../server/conf.js';
8
+ import { getNpmRootPath } from '../server/environment.js';
9
9
  import { pbcopy, shellExec } from '../server/process.js';
10
- import dotenv from 'dotenv';
11
10
  import { loggerFactory, loggerMiddleware } from '../server/logger.js';
12
11
  import fs from 'fs-extra';
13
12
  import path from 'path';
@@ -8,7 +8,7 @@
8
8
  import { shellExec } from '../server/process.js';
9
9
  import fs from 'fs-extra';
10
10
  import { loggerFactory } from '../server/logger.js';
11
- import { getNpmRootPath } from '../server/conf.js';
11
+ import { getNpmRootPath } from '../server/environment.js';
12
12
  import Underpost from '../index.js';
13
13
 
14
14
  const logger = loggerFactory(import.meta);