underpost 2.8.812 → 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.812
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`,
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,46 +76,22 @@ const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath,
78
76
  ];
79
77
  // # - ${JSON.stringify([...timeZoneSteps, ...chronySetUp(chronyConfPath)])}
80
78
  const installSteps = [
81
- `apt update`,
82
- `apt install -y cloud-init systemd-sysv openssh-server sudo locales udev util-linux systemd-sysv iproute2 netplan.io ca-certificates curl wget chrony ntpdate keyboard-configuration`,
83
- `ln -sf /lib/systemd/systemd /sbin/init`,
84
-
85
- `echo 'deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
79
+ `cat <<EOF | tee /etc/apt/sources.list
80
+ deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
86
81
  deb http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted universe multiverse
87
82
  deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe multiverse
88
-
89
- # Uncomment the following lines if you also need source packages (for building from source)
90
- # deb-src http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
91
- # deb-src http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted universe multiverse
92
- # deb-src http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe multiverse
93
- ' > /etc/apt/sources.list`,
94
- `apt update`,
95
- `apt -y full-upgrade`,
96
- // `apt install -y cloud-init=25.1.2-0ubuntu0~24.04.1`,
97
-
98
- `systemctl enable ssh`,
83
+ EOF`,
99
84
 
100
85
  `apt update -qq`,
86
+ `apt -y full-upgrade`,
101
87
  `apt install -y xinput x11-xkb-utils usbutils`,
88
+ // `apt install -y cloud-init=25.1.2-0ubuntu0~24.04.1`,
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`,
90
+ `ln -sf /lib/systemd/systemd /sbin/init`,
102
91
 
103
- // `date -s "${shellExec(`date '+%Y-%m-%d %H:%M:%S'`, { stdout: true }).trim()}"`,
104
- // `date`,
105
-
106
- ...timeZoneSteps,
107
- ...chronySetUp(chronyConfPath),
108
- ...keyboardSteps,
109
-
110
- // Create root user
111
- `useradd -m -s /bin/bash -G sudo root`,
112
- `echo 'root:root' | chpasswd`,
113
- `mkdir -p /home/root/.ssh`,
114
- `echo '${fs.readFileSync(
115
- `/home/dd/engine/engine-private/deploy/id_rsa.pub`,
116
- 'utf8',
117
- )}' > /home/root/.ssh/authorized_keys`,
118
- `chown -R root /home/root/.ssh`,
119
- `chmod 700 /home/root/.ssh`,
120
- `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`,
121
95
  ];
122
96
 
123
97
  let steps = [
@@ -191,12 +165,12 @@ network:
191
165
  version: 2
192
166
  ethernets:
193
167
  ${process.env.RPI4_INTERFACE_NAME}:
194
- dhcp4: false
168
+ dhcp4: true
195
169
  addresses:
196
170
  - ${ipaddr}/24
197
- routes:
198
- - to: default
199
- via: ${gatewayip}
171
+ # routes:
172
+ # - to: default
173
+ # via: ${gatewayip}
200
174
 
201
175
  # chpasswd:
202
176
  # expire: false
@@ -214,7 +188,6 @@ bootcmd:
214
188
  - echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
215
189
  - echo "Init bootcmd"
216
190
  - echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
217
- - ntpdate -u ${IP_ADDRESS} || ntpdate -u ${process.env.MAAS_NTP_SERVER}
218
191
  runcmd:
219
192
  - echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
220
193
  - echo "Init runcmd"
@@ -264,6 +237,41 @@ echo 'nameserver 8.8.8.8' > /run/systemd/resolve/stub-resolv.conf
264
237
  ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf`,
265
238
  'utf8',
266
239
  );
240
+
241
+ runSteps([
242
+ // `date -s "${shellExec(`date '+%Y-%m-%d %H:%M:%S'`, { stdout: true }).trim()}"`,
243
+ // `date`,
244
+ ...timeZoneSteps,
245
+ ...chronySetUp(chronyConfPath),
246
+ ...keyboardSteps,
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);
267
275
  }
268
276
  };
269
277
 
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.8.812
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.812'
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.812
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.812
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": "underpost",
5
- "version": "2.8.812",
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.812';
35
+ static version = 'v2.8.814';
36
36
  /**
37
37
  * Repository cli API
38
38
  * @static