@underpostnet/underpost 2.8.813 → 2.8.814

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
@@ -68,7 +68,7 @@ Run dev client server
68
68
  npm run dev
69
69
  ```
70
70
  <!-- -->
71
- ## underpost ci/cd cli v2.8.813
71
+ ## underpost ci/cd cli v2.8.814
72
72
 
73
73
  ### Usage: `underpost [options] [command]`
74
74
  ```
package/bin/deploy.js CHANGED
@@ -59,15 +59,13 @@ const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath,
59
59
  const [consumer_key, consumer_token, secret] = MAAS_API_TOKEN.split(`\n`)[0].split(':');
60
60
  const chronyConfPath = `/etc/chrony/chrony.conf`;
61
61
  const timezone = 'America/New_York';
62
- const timeZoneSteps = [
63
- `apt-get update`,
64
62
 
63
+ const timeZoneSteps = [
65
64
  `export DEBIAN_FRONTEND=noninteractive`,
66
65
 
67
66
  `ln -fs /usr/share/zoneinfo/${timezone} /etc/localtime`,
68
67
 
69
- `DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata ntpdate`,
70
- `dpkg-reconfigure --frontend noninteractive tzdata`,
68
+ `sudo dpkg-reconfigure --frontend noninteractive tzdata`,
71
69
  ];
72
70
  const keyboardSteps = [
73
71
  `sudo locale-gen en_US.UTF-8`,
@@ -78,7 +76,7 @@ const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath,
78
76
  ];
79
77
  // # - ${JSON.stringify([...timeZoneSteps, ...chronySetUp(chronyConfPath)])}
80
78
  const installSteps = [
81
- `cat <<EOF | sudo tee /etc/apt/sources.list
79
+ `cat <<EOF | tee /etc/apt/sources.list
82
80
  deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
83
81
  deb http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted universe multiverse
84
82
  deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe multiverse
@@ -88,21 +86,12 @@ EOF`,
88
86
  `apt -y full-upgrade`,
89
87
  `apt install -y xinput x11-xkb-utils usbutils`,
90
88
  // `apt install -y cloud-init=25.1.2-0ubuntu0~24.04.1`,
91
- `apt install -y cloud-init systemd-sysv openssh-server sudo locales udev util-linux systemd-sysv iproute2 netplan.io ca-certificates curl wget chrony keyboard-configuration`,
89
+ `apt install -y cloud-init systemd-sysv openssh-server sudo locales udev util-linux systemd-sysv iproute2 netplan.io ca-certificates curl wget chrony`,
92
90
  `ln -sf /lib/systemd/systemd /sbin/init`,
93
91
 
94
- // Create root user
95
- `systemctl enable ssh`,
96
- `useradd -m -s /bin/bash -G sudo root`,
97
- `echo 'root:root' | chpasswd`,
98
- `mkdir -p /home/root/.ssh`,
99
- `echo '${fs.readFileSync(
100
- `/home/dd/engine/engine-private/deploy/id_rsa.pub`,
101
- 'utf8',
102
- )}' > /home/root/.ssh/authorized_keys`,
103
- `chown -R root /home/root/.ssh`,
104
- `chmod 700 /home/root/.ssh`,
105
- `chmod 600 /home/root/.ssh/authorized_keys`,
92
+ `apt-get update`,
93
+ `DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils`,
94
+ `DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata kmod keyboard-configuration console-setup`,
106
95
  ];
107
96
 
108
97
  let steps = [
@@ -199,7 +188,6 @@ bootcmd:
199
188
  - echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
200
189
  - echo "Init bootcmd"
201
190
  - echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
202
- - ntpdate -u ${IP_ADDRESS} || ntpdate -u ${process.env.MAAS_NTP_SERVER}
203
191
  runcmd:
204
192
  - echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
205
193
  - echo "Init runcmd"
@@ -250,8 +238,6 @@ ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf`,
250
238
  'utf8',
251
239
  );
252
240
 
253
- await timer(5000);
254
-
255
241
  runSteps([
256
242
  // `date -s "${shellExec(`date '+%Y-%m-%d %H:%M:%S'`, { stdout: true }).trim()}"`,
257
243
  // `date`,
@@ -259,6 +245,33 @@ ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf`,
259
245
  ...chronySetUp(chronyConfPath),
260
246
  ...keyboardSteps,
261
247
  ]);
248
+
249
+ runSteps([
250
+ `useradd -m -s /bin/bash -G sudo root`,
251
+ `echo 'root:root' | chpasswd`,
252
+ `mkdir -p /home/root/.ssh`,
253
+ `echo '${fs.readFileSync(
254
+ `/home/dd/engine/engine-private/deploy/id_rsa.pub`,
255
+ 'utf8',
256
+ )}' > /home/root/.ssh/authorized_keys`,
257
+ `chown -R root /home/root/.ssh`,
258
+ `chmod 700 /home/root/.ssh`,
259
+ `chmod 600 /home/root/.ssh/authorized_keys`,
260
+ ]);
261
+ }
262
+
263
+ logger.info('Check virtual root user config');
264
+ {
265
+ const cmd = `sudo chroot ${nfsHostPath} /usr/bin/qemu-aarch64-static /bin/bash <<'EOF_OUTER'
266
+ echo -e "\n=== Current date/time ==="
267
+ date '+%Y-%m-%d %H:%M:%S'
268
+ echo -e "\n=== Keyboard layout ==="
269
+ cat /etc/default/keyboard
270
+ echo -e "\n=== Registered users ==="
271
+ cut -d: -f1 /etc/passwd
272
+ EOF_OUTER`;
273
+
274
+ shellExec(cmd);
262
275
  }
263
276
  };
264
277
 
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.8.813
1
+ ## underpost ci/cd cli v2.8.814
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -58,7 +58,7 @@ services:
58
58
  cpus: '0.25'
59
59
  memory: 20M
60
60
  labels: # labels in Compose file instead of Dockerfile
61
- engine.version: '2.8.813'
61
+ engine.version: '2.8.814'
62
62
  networks:
63
63
  - load-balancer
64
64
 
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-template-development-blue
20
- image: localhost/rockylinux9-underpost:v2.8.813
20
+ image: localhost/rockylinux9-underpost:v2.8.814
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-template-development-green
103
- image: localhost/rockylinux9-underpost:v2.8.813
103
+ image: localhost/rockylinux9-underpost:v2.8.814
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "@underpostnet/underpost",
5
- "version": "2.8.813",
5
+ "version": "2.8.814",
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",
@@ -508,20 +508,24 @@ net.ipv4.ip_forward = 1' | sudo tee ${iptableConfPath}`);
508
508
  logger.info('Phase 1/6: Cleaning up Kubernetes resources (PVCs, PVs) while API server is accessible...');
509
509
 
510
510
  // Get all Persistent Volumes and identify their host paths for data deletion.
511
- const pvListJson = shellExec(`kubectl get pv -o json || echo '{"items":[]}'`, { stdout: true, silent: true });
512
- const pvList = JSON.parse(pvListJson);
513
-
514
- if (pvList.items && pvList.items.length > 0) {
515
- for (const pv of pvList.items) {
516
- // Check if the PV uses hostPath and delete its contents
517
- if (pv.spec.hostPath && pv.spec.hostPath.path) {
518
- const hostPath = pv.spec.hostPath.path;
519
- logger.info(`Removing data from host path for PV '${pv.metadata.name}': ${hostPath}`);
520
- shellExec(`sudo rm -rf ${hostPath}/* || true`);
511
+ try {
512
+ const pvListJson = shellExec(`kubectl get pv -o json || echo '{"items":[]}'`, { stdout: true, silent: true });
513
+ const pvList = JSON.parse(pvListJson);
514
+
515
+ if (pvList.items && pvList.items.length > 0) {
516
+ for (const pv of pvList.items) {
517
+ // Check if the PV uses hostPath and delete its contents
518
+ if (pv.spec.hostPath && pv.spec.hostPath.path) {
519
+ const hostPath = pv.spec.hostPath.path;
520
+ logger.info(`Removing data from host path for PV '${pv.metadata.name}': ${hostPath}`);
521
+ shellExec(`sudo rm -rf ${hostPath}/* || true`);
522
+ }
521
523
  }
524
+ } else {
525
+ logger.info('No Persistent Volumes found with hostPath to clean up.');
522
526
  }
523
- } else {
524
- logger.info('No Persistent Volumes found with hostPath to clean up.');
527
+ } catch (error) {
528
+ logger.error('Failed to clean up Persistent Volumes:', error);
525
529
  }
526
530
 
527
531
  // Phase 2: Stop Kubelet/K3s agent and remove CNI configuration
package/src/index.js CHANGED
@@ -32,7 +32,7 @@ class Underpost {
32
32
  * @type {String}
33
33
  * @memberof Underpost
34
34
  */
35
- static version = 'v2.8.813';
35
+ static version = 'v2.8.814';
36
36
  /**
37
37
  * Repository cli API
38
38
  * @static