underpost 2.89.21 → 2.89.35

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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  <!-- badges -->
20
20
 
21
- [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.89.21)](https://socket.dev/npm/package/underpost/overview/2.89.21) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
21
+ [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.89.35)](https://socket.dev/npm/package/underpost/overview/2.89.35) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
22
22
 
23
23
  <!-- end-badges -->
24
24
 
@@ -66,7 +66,7 @@ Run dev client server
66
66
  npm run dev
67
67
  ```
68
68
  <!-- -->
69
- ## underpost ci/cd cli v2.89.21
69
+ ## underpost ci/cd cli v2.89.35
70
70
 
71
71
  ### Usage: `underpost [options] [command]`
72
72
  ```
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.89.21
1
+ ## underpost ci/cd cli v2.89.35
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -641,7 +641,7 @@ Options:
641
641
  Runs a script from the specified path.
642
642
 
643
643
  Arguments:
644
- runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, underpost-config, gpu-env, tf-gpu-test, dev-cluster, metadata, svc-ls, svc-rm, ssh-cluster-info, dev-hosts-expose, dev-hosts-restore, cluster-build, template-deploy, template-deploy-image, clean, pull, release-deploy, ssh-deploy, ide, sync, tz, cron, ls-deployments, ls-images, host-update, dd-container, monitor, db-client, git-conf, promote, metrics, cluster, deploy, dev, service, sh, log, release-cmt, sync-replica, tf-vae-test, deploy-job.
644
+ runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, underpost-config, gpu-env, tf-gpu-test, dev-cluster, metadata, svc-ls, svc-rm, ssh-cluster-info, dev-hosts-expose, dev-hosts-restore, cluster-build, template-deploy, template-deploy-image, clean, pull, release-deploy, ssh-deploy, ide, sync, tz, cron, ls-deployments, ls-images, host-update, dd-container, ip-info, monitor, db-client, git-conf, promote, metrics, cluster, deploy, dev, service, sh, log, release-cmt, sync-replica, tf-vae-test, deploy-job.
645
645
  path The absolute or relative directory path where the script is located.
646
646
 
647
647
  Options:
@@ -675,6 +675,7 @@ Options:
675
675
  --reset Resets the runner state before execution.
676
676
  --terminal Enables terminal mode for interactive script execution.
677
677
  --dev-proxy-port-offset <port-offset> Sets a custom port offset for development proxy.
678
+ --host-network Enables host network mode for the runner execution.
678
679
  --conf-server-path <conf-server-path> Sets a custom configuration server path.
679
680
  --underpost-root <underpost-root> Sets a custom Underpost root path.
680
681
  -h, --help display help for command
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: localhost/rockylinux9-underpost:v2.89.21
20
+ image: localhost/rockylinux9-underpost:v2.89.35
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "124Ki"
@@ -100,7 +100,7 @@ spec:
100
100
  spec:
101
101
  containers:
102
102
  - name: dd-default-development-green
103
- image: localhost/rockylinux9-underpost:v2.89.21
103
+ image: localhost/rockylinux9-underpost:v2.89.35
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-test-development-blue
20
- image: localhost/rockylinux9-underpost:v2.89.21
20
+ image: localhost/rockylinux9-underpost:v2.89.35
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "96294Ki"
@@ -108,7 +108,7 @@ spec:
108
108
  spec:
109
109
  containers:
110
110
  - name: dd-test-development-green
111
- image: localhost/rockylinux9-underpost:v2.89.21
111
+ image: localhost/rockylinux9-underpost:v2.89.35
112
112
  # resources:
113
113
  # requests:
114
114
  # memory: "96294Ki"
@@ -12,14 +12,14 @@ spec:
12
12
  hostPath:
13
13
  path: /home/dd
14
14
  type: DirectoryOrCreate
15
- nodeAffinity:
16
- required:
17
- nodeSelectorTerms:
18
- - matchExpressions:
19
- - key: kubernetes.io/hostname
20
- operator: In
21
- values:
22
- - localhost
15
+ # nodeAffinity:
16
+ # required:
17
+ # nodeSelectorTerms:
18
+ # - matchExpressions:
19
+ # - key: kubernetes.io/hostname
20
+ # operator: In
21
+ # values:
22
+ # - localhost
23
23
  ---
24
24
  apiVersion: v1
25
25
  kind: PersistentVolumeClaim
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.89.21",
5
+ "version": "2.89.35",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bash
2
+ # gen-fqdns.sh - generate a readable plain table with FQDNs for all services and pods in the cluster
3
+
4
+ set -euo pipefail
5
+
6
+ CLUSTER_DOMAIN="${CLUSTER_DOMAIN:-cluster.local}"
7
+
8
+ # Services: <service>.<namespace>.svc.<cluster-domain>
9
+ kubectl get svc --all-namespaces -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name --no-headers \
10
+ | awk -v cd="$CLUSTER_DOMAIN" '{printf "%-20s %-34s %-6s %s.%s.svc.%s\n", $1, $2, "svc", $2, $1, cd}'
11
+
12
+ # Pods: <pod>.<namespace>.pod.<cluster-domain>
13
+ kubectl get pods --all-namespaces -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name --no-headers \
14
+ | awk -v cd="$CLUSTER_DOMAIN" '{printf "%-20s %-34s %-6s %s.%s.pod.%s\n", $1, $2, "pod", $2, $1, cd}'
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env bash
2
+ # ip-info.sh
3
+ # Retrieve information about an IP address or hostname
4
+ # Usage: ip-info.sh <IP-or-hostname>
5
+
6
+ set -euo pipefail
7
+ IFS=$'
8
+ '
9
+
10
+ if [[ ${#} -lt 1 ]]; then
11
+ echo "Usage: $0 <IP-or-hostname>"
12
+ exit 1
13
+ fi
14
+ TARGET="$1"
15
+
16
+ # Detect package manager
17
+ PKG_MANAGER=""
18
+ if command -v dnf >/dev/null 2>&1; then
19
+ PKG_MANAGER=dnf
20
+ elif command -v yum >/dev/null 2>&1; then
21
+ PKG_MANAGER=yum
22
+ fi
23
+
24
+ # Commands we need (bind-utils provides dig)
25
+ REQUIRED_CMDS=(curl jq whois dig traceroute)
26
+ PKGS=(curl jq whois bind-utils traceroute)
27
+
28
+ missing=()
29
+ for i in "${!REQUIRED_CMDS[@]}"; do
30
+ cmd=${REQUIRED_CMDS[$i]}
31
+ if ! command -v "$cmd" >/dev/null 2>&1; then
32
+ missing+=("${PKGS[$i]}")
33
+ fi
34
+ done
35
+
36
+ if [[ ${#missing[@]} -gt 0 ]]; then
37
+ if [[ -z "$PKG_MANAGER" ]]; then
38
+ echo "Missing packages: ${missing[*]}
39
+ No supported package manager found. Install: ${missing[*]} and re-run."
40
+ exit 1
41
+ fi
42
+ if [[ $EUID -ne 0 && -z "$(command -v sudo)" ]]; then
43
+ echo "Missing packages: ${missing[*]}
44
+ Run as root or install sudo."
45
+ exit 1
46
+ fi
47
+ echo "Installing missing: ${missing[*]}"
48
+ sudo $PKG_MANAGER install -y ${missing[*]} >/dev/null
49
+ fi
50
+
51
+ # Resolve to IP(s)
52
+ resolve_ips(){
53
+ if getent ahosts "$TARGET" >/dev/null 2>&1; then
54
+ getent ahosts "$TARGET" | awk '{print $1}' | sort -u
55
+ else
56
+ dig +short "$TARGET" | awk '/^[0-9]/ {print $1}' | sort -u
57
+ fi
58
+ }
59
+
60
+ mapfile -t IPS < <(resolve_ips)
61
+ if [[ ${#IPS[@]} -eq 0 ]]; then
62
+ IPS=("$TARGET")
63
+ fi
64
+
65
+ format(){
66
+ if command -v jq >/dev/null 2>&1; then
67
+ jq '.' 2>/dev/null || cat
68
+ else
69
+ cat
70
+ fi
71
+ }
72
+
73
+ for IP in "${IPS[@]}"; do
74
+ printf "
75
+ ===== %s (resolved: %s) =====
76
+
77
+ " "$TARGET" "$IP"
78
+
79
+ echo "-- REVERSE DNS --"
80
+ dig -x "$IP" +short || true
81
+
82
+ echo "
83
+ -- WHOIS --"
84
+ whois "$IP" | sed -n '1,80p' || true
85
+
86
+ echo "
87
+ -- IPINFO (ipinfo.io) --"
88
+ curl -sS "https://ipinfo.io/$IP/json" | format || true
89
+
90
+ echo "
91
+ -- IP-API (ip-api.com) --"
92
+ curl -sS "http://ip-api.com/json/$IP?fields=status,message,country,regionName,city,zip,lat,lon,timezone,isp,org,as,query" | format || true
93
+
94
+ echo "
95
+ -- IPWHOIS (ipwhois.app) --"
96
+ curl -sS "https://ipwhois.app/json/$IP" | format || true
97
+
98
+ echo "
99
+ -- GEOPLUGIN --"
100
+ curl -sS "http://www.geoplugin.net/json.gp?ip=$IP" | format || true
101
+
102
+ echo "
103
+ -- TRACEROUTE --"
104
+ traceroute -m 20 "$IP" || true
105
+
106
+ if [[ "$TARGET" =~ [A-Za-z] ]]; then
107
+ echo "
108
+ -- DNS RECORDS for $TARGET --"
109
+ dig +short A "$TARGET" || true
110
+ dig +short AAAA "$TARGET" || true
111
+ dig +short MX "$TARGET" || true
112
+ dig +short TXT "$TARGET" || true
113
+ fi
114
+
115
+ echo "
116
+ ===== done: $IP =====
117
+ "
118
+ done
package/src/cli/deploy.js CHANGED
@@ -437,6 +437,15 @@ kubectl wait --for=jsonpath='{.status.phase}'=Running pod/busybox1
437
437
  kubectl wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/busybox1
438
438
  kubectl wait --for=delete pod/busybox1 --timeout=60s
439
439
 
440
+ fqdn: <service>.<namespace>.<kind(svc/pod)>.<cluster-domain(cluster.local)>
441
+ node bin run cluster-build
442
+ node bin run template-deploy
443
+ node bin run ssh-deploy (sync-)engine-core
444
+ node bin run cluster --dev 'express,dd-test+dd-core'
445
+ node bin run dd-container --dev
446
+ node bin dockerfile-pull-base-images --dev --path 'image-path' --kind-load
447
+ node bin/deploy update-default-conf <deploy-id>
448
+
440
449
  kubectl run --rm -it test-dns --image=busybox:latest --restart=Never -- /bin/sh -c "
441
450
  nslookup kubernetes.default.svc.cluster.local;
442
451
  nslookup mongodb-service.default.svc.cluster.local;
@@ -536,11 +545,8 @@ EOF`);
536
545
 
537
546
  if (!options.disableUpdateVolume) {
538
547
  for (const volume of confVolume) {
539
- if (options.remove) {
540
- shellExec(`kubectl delete pvc ${volume.claimName}`);
541
- shellExec(`kubectl delete pv ${volume.claimName.replace('pvc-', 'pv-')}`);
542
- continue;
543
- }
548
+ shellExec(`kubectl delete pvc ${volume.claimName}`);
549
+ shellExec(`kubectl delete pv ${volume.claimName.replace('pvc-', 'pv-')}`);
544
550
  shellExec(`kubectl apply -f - <<EOF
545
551
  ${UnderpostDeploy.API.persistentVolumeFactory({
546
552
  hostPath: volume.volumeMountPath,
package/src/cli/index.js CHANGED
@@ -411,6 +411,7 @@ program
411
411
  .option('--reset', 'Resets the runner state before execution.')
412
412
  .option('--terminal', 'Enables terminal mode for interactive script execution.')
413
413
  .option('--dev-proxy-port-offset <port-offset>', 'Sets a custom port offset for development proxy.')
414
+ .option('--host-network', 'Enables host network mode for the runner execution.')
414
415
  .option('--conf-server-path <conf-server-path>', 'Sets a custom configuration server path.')
415
416
  .option('--underpost-root <underpost-root>', 'Sets a custom Underpost root path.')
416
417
  .description('Runs a script from the specified path.')
package/src/cli/run.js CHANGED
@@ -67,6 +67,7 @@ class UnderpostRun {
67
67
  * @property {string} kind - The kind of resource to create.
68
68
  * @property {boolean} terminal - Whether to open a terminal.
69
69
  * @property {number} devProxyPortOffset - The port offset for the development proxy.
70
+ * @property {boolean} hostNetwork - Whether to use host networking.
70
71
  * @property {string} confServerPath - The configuration server path.
71
72
  * @property {string} underpostRoot - The root path of the Underpost installation.
72
73
  * @memberof UnderpostRun
@@ -98,6 +99,7 @@ class UnderpostRun {
98
99
  kind: '',
99
100
  terminal: false,
100
101
  devProxyPortOffset: 0,
102
+ hostNetwork: false,
101
103
  confServerPath: '',
102
104
  underpostRoot: '',
103
105
  };
@@ -599,26 +601,34 @@ class UnderpostRun {
599
601
  'dd-container': async (path = '', options = UnderpostRun.DEFAULT_OPTION) => {
600
602
  const baseCommand = options.dev ? 'node bin' : 'underpost';
601
603
  const baseClusterCommand = options.dev ? ' --dev' : '';
602
- const currentImage = UnderpostDeploy.API.getCurrentLoadedImages(
603
- options.nodeName ? options.nodeName : 'kind-worker',
604
- false,
605
- ).find((o) => o.IMAGE.match('underpost'));
606
- const podName = `underpost-dev-container`;
604
+ const currentImage = options.imageName
605
+ ? options.imageName
606
+ : UnderpostDeploy.API.getCurrentLoadedImages(options.nodeName ? options.nodeName : 'kind-worker', false).find(
607
+ (o) => o.IMAGE.match('underpost'),
608
+ );
609
+ const podName = options.podName || `underpost-dev-container`;
610
+ const volumeHostPath = options.claimName || '/home/dd';
611
+ const claimName = options.claimName || `pvc-dd`;
612
+
607
613
  if (!options.nodeName) {
608
- shellExec(`docker exec -i kind-worker bash -c "rm -rf /home/dd"`);
609
- shellExec(`docker exec -i kind-worker bash -c "mkdir -p /home/dd"`);
610
- shellExec(`docker cp /home/dd/engine kind-worker:/home/dd/engine`);
611
- shellExec(`docker exec -i kind-worker bash -c "chown -R 1000:1000 /home/dd || true; chmod -R 755 /home/dd"`);
614
+ shellExec(`docker exec -i kind-worker bash -c "rm -rf ${volumeHostPath}"`);
615
+ shellExec(`docker exec -i kind-worker bash -c "mkdir -p ${volumeHostPath}"`);
616
+ shellExec(`docker cp ${volumeHostPath}/engine kind-worker:${volumeHostPath}/engine`);
617
+ shellExec(
618
+ `docker exec -i kind-worker bash -c "chown -R 1000:1000 ${volumeHostPath} || true; chmod -R 755 ${volumeHostPath}"`,
619
+ );
612
620
  } else {
613
621
  shellExec(`kubectl apply -f ${options.underpostRoot}/manifests/pv-pvc-dd.yaml`);
614
622
  }
623
+
615
624
  if (!currentImage)
616
625
  shellExec(
617
626
  `${baseCommand} dockerfile-pull-base-images${baseClusterCommand} ${options.dev ? '--kind-load' : '--kubeadm-load'}`,
618
627
  );
619
628
  // shellExec(`kubectl delete pod ${podName} --ignore-not-found`);
620
- await UnderpostRun.RUNNERS['deploy-job']('', {
621
- dev: options.dev,
629
+
630
+ const payload = {
631
+ ...options,
622
632
  podName,
623
633
  imageName: currentImage
624
634
  ? currentImage.image
@@ -627,15 +637,30 @@ class UnderpostRun {
627
637
  ? `${currentImage.IMAGE}:${currentImage.TAG}`
628
638
  : `localhost/rockylinux9-underpost:${Underpost.version}`
629
639
  : `localhost/rockylinux9-underpost:${Underpost.version}`,
630
- volumeMountPath: '/home/dd',
631
- ...(options.dev ? { volumeHostPath: '/home/dd' } : { claimName: 'pvc-dd' }),
640
+ volumeMountPath: volumeHostPath,
641
+ ...(options.dev ? { volumeHostPath } : { claimName }),
632
642
  on: {
633
643
  init: async () => {
634
644
  // openTerminal(`kubectl logs -f ${podName}`);
635
645
  },
636
646
  },
637
647
  args: [daemonProcess(path ? path : `cd /home/dd/engine && npm install && npm run test`)],
638
- });
648
+ };
649
+
650
+ await UnderpostRun.RUNNERS['deploy-job'](path, payload);
651
+ },
652
+
653
+ /**
654
+ * @method ip-info
655
+ * @description Executes the `ip-info.sh` script to display IP-related information for the specified path.
656
+ * @param {string} path - The input value, identifier, or path for the operation (used as an argument to the script).
657
+ * @param {Object} options - The default underpost runner options for customizing workflow
658
+ * @memberof UnderpostRun
659
+ */
660
+ 'ip-info': (path, options = UnderpostRun.DEFAULT_OPTION) => {
661
+ const { underpostRoot } = options;
662
+ shellExec(`chmod +x ${underpostRoot}/scripts/ip-info.sh`);
663
+ shellExec(`${underpostRoot}/scripts/ip-info.sh ${path}`);
639
664
  },
640
665
 
641
666
  /**
@@ -1193,6 +1218,7 @@ class UnderpostRun {
1193
1218
  const restartPolicy = options.restartPolicy || 'Never';
1194
1219
  const kind = options.kind || 'Pod';
1195
1220
  const imagePullPolicy = options.imagePullPolicy || 'IfNotPresent';
1221
+ const hostNetwork = options.hostNetwork ? options.hostNetwork : '';
1196
1222
  const apiVersion = options.apiVersion || 'v1';
1197
1223
  if (options.volumeType === 'dev') options.volumeType = 'FileOrCreate';
1198
1224
  const volumeType =
@@ -1213,6 +1239,7 @@ metadata:
1213
1239
  spec:
1214
1240
  restartPolicy: ${restartPolicy}
1215
1241
  ${runtimeClassName ? ` runtimeClassName: ${runtimeClassName}` : ''}
1242
+ ${hostNetwork ? ` hostNetwork: ${hostNetwork}` : ''}
1216
1243
  containers:
1217
1244
  - name: ${containerName}
1218
1245
  image: ${imageName}
package/src/index.js CHANGED
@@ -35,7 +35,7 @@ class Underpost {
35
35
  * @type {String}
36
36
  * @memberof Underpost
37
37
  */
38
- static version = 'v2.89.21';
38
+ static version = 'v2.89.35';
39
39
  /**
40
40
  * Repository cli API
41
41
  * @static
@@ -132,6 +132,7 @@ class UnderpostStartUp {
132
132
  const buildBasePath = `/home/dd`;
133
133
  const repoName = `engine-${deployId.split('-')[1]}`;
134
134
  shellExec(`cd ${buildBasePath} && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}`);
135
+ shellExec(`mkdir -p ${buildBasePath}/engine`);
135
136
  shellExec(`cd ${buildBasePath} && sudo cp -a ./${repoName}/* ./engine`);
136
137
  shellExec(`cd ${buildBasePath} && sudo rm -rf ./${repoName}`);
137
138
  shellExec(`cd ${buildBasePath}/engine && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}-private`);