@underpostnet/underpost 2.8.811 → 2.8.813
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 +1 -1
- package/bin/deploy.js +65 -51
- package/cli.md +1 -1
- package/docker-compose.yml +1 -1
- package/manifests/deployment/dd-template-development/deployment.yaml +2 -2
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/runtime/lampp/Dockerfile +1 -37
package/README.md
CHANGED
package/bin/deploy.js
CHANGED
|
@@ -51,12 +51,12 @@ logger.info('argv', process.argv);
|
|
|
51
51
|
|
|
52
52
|
const [exe, dir, operator] = process.argv;
|
|
53
53
|
|
|
54
|
-
const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath, ipaddr, update }) => {
|
|
54
|
+
const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath, ipaddr, update, gatewayip }) => {
|
|
55
55
|
// <consumer_key>:<consumer_token>:<secret>
|
|
56
56
|
const MAAS_API_TOKEN = shellExec(`maas apikey --username ${process.env.MAAS_ADMIN_USERNAME}`, {
|
|
57
57
|
stdout: true,
|
|
58
58
|
}).trim();
|
|
59
|
-
const [consumer_key, consumer_token, secret] = MAAS_API_TOKEN.split(`\n`)[
|
|
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
62
|
const timeZoneSteps = [
|
|
@@ -66,7 +66,7 @@ const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath,
|
|
|
66
66
|
|
|
67
67
|
`ln -fs /usr/share/zoneinfo/${timezone} /etc/localtime`,
|
|
68
68
|
|
|
69
|
-
`DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata`,
|
|
69
|
+
`DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata ntpdate`,
|
|
70
70
|
`dpkg-reconfigure --frontend noninteractive tzdata`,
|
|
71
71
|
];
|
|
72
72
|
const keyboardSteps = [
|
|
@@ -76,38 +76,23 @@ const updateVirtualRoot = async ({ IP_ADDRESS, architecture, host, nfsHostPath,
|
|
|
76
76
|
`sudo dpkg-reconfigure --frontend noninteractive keyboard-configuration`,
|
|
77
77
|
`sudo systemctl restart keyboard-setup.service`,
|
|
78
78
|
];
|
|
79
|
+
// # - ${JSON.stringify([...timeZoneSteps, ...chronySetUp(chronyConfPath)])}
|
|
79
80
|
const installSteps = [
|
|
80
|
-
`apt
|
|
81
|
-
|
|
82
|
-
`ln -sf /lib/systemd/systemd /sbin/init`,
|
|
83
|
-
|
|
84
|
-
`echo 'deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
|
|
81
|
+
`cat <<EOF | sudo tee /etc/apt/sources.list
|
|
82
|
+
deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
|
|
85
83
|
deb http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted universe multiverse
|
|
86
84
|
deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe multiverse
|
|
87
|
-
|
|
88
|
-
# Uncomment the following lines if you also need source packages (for building from source)
|
|
89
|
-
# deb-src http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
|
|
90
|
-
# deb-src http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted universe multiverse
|
|
91
|
-
# deb-src http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe multiverse
|
|
92
|
-
' > /etc/apt/sources.list`,
|
|
93
|
-
`apt update`,
|
|
94
|
-
`apt -y full-upgrade`,
|
|
95
|
-
// `apt install -y cloud-init=25.1.2-0ubuntu0~24.04.1`,
|
|
96
|
-
|
|
97
|
-
`systemctl enable ssh`,
|
|
85
|
+
EOF`,
|
|
98
86
|
|
|
99
87
|
`apt update -qq`,
|
|
88
|
+
`apt -y full-upgrade`,
|
|
100
89
|
`apt install -y xinput x11-xkb-utils usbutils`,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// `date -s "${shellExec(`date '+%Y-%m-%d %H:%M:%S'`, { stdout: true }).trim()}"`,
|
|
105
|
-
// `date`,
|
|
106
|
-
|
|
107
|
-
...timeZoneSteps,
|
|
108
|
-
...chronySetUp(chronyConfPath),
|
|
90
|
+
// `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`,
|
|
92
|
+
`ln -sf /lib/systemd/systemd /sbin/init`,
|
|
109
93
|
|
|
110
94
|
// Create root user
|
|
95
|
+
`systemctl enable ssh`,
|
|
111
96
|
`useradd -m -s /bin/bash -G sudo root`,
|
|
112
97
|
`echo 'root:root' | chpasswd`,
|
|
113
98
|
`mkdir -p /home/root/.ssh`,
|
|
@@ -118,7 +103,9 @@ deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe
|
|
|
118
103
|
`chown -R root /home/root/.ssh`,
|
|
119
104
|
`chmod 700 /home/root/.ssh`,
|
|
120
105
|
`chmod 600 /home/root/.ssh/authorized_keys`,
|
|
106
|
+
];
|
|
121
107
|
|
|
108
|
+
let steps = [
|
|
122
109
|
// Configure cloud-init for MAAS
|
|
123
110
|
`cat <<EOF_MAAS_CFG > /etc/cloud/cloud.cfg.d/90_maas.cfg
|
|
124
111
|
#cloud-config
|
|
@@ -192,6 +179,9 @@ network:
|
|
|
192
179
|
dhcp4: true
|
|
193
180
|
addresses:
|
|
194
181
|
- ${ipaddr}/24
|
|
182
|
+
# routes:
|
|
183
|
+
# - to: default
|
|
184
|
+
# via: ${gatewayip}
|
|
195
185
|
|
|
196
186
|
# chpasswd:
|
|
197
187
|
# expire: false
|
|
@@ -209,40 +199,49 @@ bootcmd:
|
|
|
209
199
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
210
200
|
- echo "Init bootcmd"
|
|
211
201
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
212
|
-
|
|
202
|
+
- ntpdate -u ${IP_ADDRESS} || ntpdate -u ${process.env.MAAS_NTP_SERVER}
|
|
213
203
|
runcmd:
|
|
214
204
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
215
205
|
- echo "Init runcmd"
|
|
216
206
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
217
207
|
EOF_MAAS_CFG`,
|
|
218
|
-
...keyboardSteps,
|
|
219
208
|
];
|
|
220
209
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
210
|
+
const runSteps = (steps = []) => {
|
|
211
|
+
const script = steps
|
|
212
|
+
.map(
|
|
213
|
+
(s, i) => `echo "step ${i + 1}/${steps.length}: ${s.split('\n')[0]}"
|
|
214
|
+
${s}`,
|
|
215
|
+
)
|
|
216
|
+
.join('\n');
|
|
224
217
|
|
|
225
|
-
|
|
226
|
-
${
|
|
227
|
-
|
|
228
|
-
(s, i) => `echo "step ${i + 1}/${steps.length}: ${s.split('\n')[0]}"
|
|
229
|
-
${s}
|
|
230
|
-
`,
|
|
231
|
-
)
|
|
232
|
-
.join(``)}
|
|
233
|
-
EOF`);
|
|
218
|
+
const cmd = `sudo chroot ${nfsHostPath} /usr/bin/qemu-aarch64-static /bin/bash <<'EOF_OUTER'
|
|
219
|
+
${script}
|
|
220
|
+
EOF_OUTER`;
|
|
234
221
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
apt update
|
|
238
|
-
EOF`);
|
|
222
|
+
shellExec(cmd);
|
|
223
|
+
};
|
|
239
224
|
|
|
240
225
|
if (update) {
|
|
226
|
+
// --reboot
|
|
241
227
|
shellExec(`sudo chroot ${nfsHostPath} /usr/bin/qemu-aarch64-static /bin/bash <<'EOF'
|
|
242
|
-
sudo cloud-init clean --logs --
|
|
228
|
+
sudo cloud-init clean --logs --seed --configs all --machine-id
|
|
229
|
+
sudo rm -rf /var/lib/cloud/*
|
|
243
230
|
EOF`);
|
|
244
|
-
fs.writeFileSync(`${nfsHostPath}/var/log/cloud-init.log`, '', 'utf8');
|
|
245
231
|
|
|
232
|
+
if (fs.existsSync(`${nfsHostPath}/var/log/`)) {
|
|
233
|
+
fs.writeFileSync(`${nfsHostPath}/var/log/cloud-init.log`, '', 'utf8');
|
|
234
|
+
fs.writeFileSync(`${nfsHostPath}/var/log/cloud-init-output.log`, '', 'utf8');
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
runSteps(steps);
|
|
238
|
+
} else {
|
|
239
|
+
runSteps(installSteps.concat(steps));
|
|
240
|
+
|
|
241
|
+
shellExec(`sudo chroot ${nfsHostPath} /usr/bin/qemu-aarch64-static /bin/bash <<'EOF'
|
|
242
|
+
echo "nameserver ${process.env.MAAS_DNS}" | tee /etc/resolv.conf > /dev/null
|
|
243
|
+
apt update
|
|
244
|
+
EOF`);
|
|
246
245
|
fs.writeFileSync(
|
|
247
246
|
`${nfsHostPath}/dns.sh`,
|
|
248
247
|
`rm /etc/resolv.conf
|
|
@@ -250,6 +249,16 @@ echo 'nameserver 8.8.8.8' > /run/systemd/resolve/stub-resolv.conf
|
|
|
250
249
|
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf`,
|
|
251
250
|
'utf8',
|
|
252
251
|
);
|
|
252
|
+
|
|
253
|
+
await timer(5000);
|
|
254
|
+
|
|
255
|
+
runSteps([
|
|
256
|
+
// `date -s "${shellExec(`date '+%Y-%m-%d %H:%M:%S'`, { stdout: true }).trim()}"`,
|
|
257
|
+
// `date`,
|
|
258
|
+
...timeZoneSteps,
|
|
259
|
+
...chronySetUp(chronyConfPath),
|
|
260
|
+
...keyboardSteps,
|
|
261
|
+
]);
|
|
253
262
|
}
|
|
254
263
|
};
|
|
255
264
|
|
|
@@ -259,7 +268,7 @@ const chronySetUp = (path) => {
|
|
|
259
268
|
# Use public servers from the pool.ntp.org project.
|
|
260
269
|
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
|
|
261
270
|
# pool 2.pool.ntp.org iburst
|
|
262
|
-
server
|
|
271
|
+
server ${process.env.MAAS_NTP_SERVER} iburst
|
|
263
272
|
|
|
264
273
|
# Record the rate at which the system clock gains/losses time.
|
|
265
274
|
driftfile /var/lib/chrony/drift
|
|
@@ -1751,7 +1760,6 @@ EOF`);
|
|
|
1751
1760
|
|
|
1752
1761
|
switch (process.argv[3]) {
|
|
1753
1762
|
case 'rpi4mb':
|
|
1754
|
-
const resourceId = process.argv[4] ?? '12';
|
|
1755
1763
|
tftpSubDir = '/rpi4mb';
|
|
1756
1764
|
zipFirmwareFileName = `RPi4_UEFI_Firmware_v1.41.zip`;
|
|
1757
1765
|
zipFirmwareName = zipFirmwareFileName.split('.zip')[0];
|
|
@@ -1763,7 +1771,7 @@ EOF`);
|
|
|
1763
1771
|
await Downloader(zipFirmwareUrl, `../${zipFirmwareFileName}`);
|
|
1764
1772
|
shellExec(`cd .. && mkdir ${zipFirmwareName} && cd ${zipFirmwareName} && unzip ../${zipFirmwareFileName}`);
|
|
1765
1773
|
}
|
|
1766
|
-
resource = resources.find((o) => o.
|
|
1774
|
+
resource = resources.find((o) => o.architecture === 'arm64/ga-24.04' && o.name === 'ubuntu/noble');
|
|
1767
1775
|
name = resource.name;
|
|
1768
1776
|
architecture = resource.architecture;
|
|
1769
1777
|
resource = resources.find((o) => o.name === name && o.architecture === architecture);
|
|
@@ -2078,8 +2086,9 @@ BOOT_ORDER=0x21`;
|
|
|
2078
2086
|
newMachine = machineFactory(JSON.parse(newMachine));
|
|
2079
2087
|
machines.push(newMachine);
|
|
2080
2088
|
console.log(newMachine);
|
|
2089
|
+
// commissioning_scripts=90-verify-user.sh
|
|
2081
2090
|
shellExec(
|
|
2082
|
-
`maas ${process.env.MAAS_ADMIN_USERNAME} machine commission ${newMachine.system_id}
|
|
2091
|
+
`maas ${process.env.MAAS_ADMIN_USERNAME} machine commission ${newMachine.system_id} enable_ssh=1 skip_bmc_config=1 skip_networking=1 skip_storage=1`,
|
|
2083
2092
|
{
|
|
2084
2093
|
silent: true,
|
|
2085
2094
|
},
|
|
@@ -2185,6 +2194,7 @@ udp-port = 32766
|
|
|
2185
2194
|
const host = process.argv[4];
|
|
2186
2195
|
const nfsHostPath = `${process.env.NFS_EXPORT_PATH}/${host}`;
|
|
2187
2196
|
const ipaddr = process.env.RPI4_IP;
|
|
2197
|
+
const gatewayip = process.env.GATEWAY_IP;
|
|
2188
2198
|
await updateVirtualRoot({
|
|
2189
2199
|
IP_ADDRESS,
|
|
2190
2200
|
architecture,
|
|
@@ -2192,6 +2202,7 @@ udp-port = 32766
|
|
|
2192
2202
|
nfsHostPath,
|
|
2193
2203
|
ipaddr,
|
|
2194
2204
|
update: true,
|
|
2205
|
+
gatewayip,
|
|
2195
2206
|
});
|
|
2196
2207
|
break;
|
|
2197
2208
|
}
|
|
@@ -2201,6 +2212,7 @@ udp-port = 32766
|
|
|
2201
2212
|
const architecture = process.argv[3];
|
|
2202
2213
|
const host = process.argv[4];
|
|
2203
2214
|
const nfsHostPath = `${process.env.NFS_EXPORT_PATH}/${host}`;
|
|
2215
|
+
const gatewayip = process.env.GATEWAY_IP;
|
|
2204
2216
|
shellExec(`sudo dnf install -y iptables-legacy`);
|
|
2205
2217
|
shellExec(`sudo dnf install -y debootstrap`);
|
|
2206
2218
|
shellExec(`sudo dnf install kernel-modules-extra-$(uname -r)`);
|
|
@@ -2279,6 +2291,7 @@ EOF`);
|
|
|
2279
2291
|
host,
|
|
2280
2292
|
nfsHostPath,
|
|
2281
2293
|
ipaddr,
|
|
2294
|
+
gatewayip,
|
|
2282
2295
|
});
|
|
2283
2296
|
|
|
2284
2297
|
break;
|
|
@@ -2302,6 +2315,7 @@ EOF`);
|
|
|
2302
2315
|
shellExec(`sudo umount ${nfsHostPath}/sys`);
|
|
2303
2316
|
shellExec(`sudo umount ${nfsHostPath}/dev/pts`);
|
|
2304
2317
|
shellExec(`sudo umount ${nfsHostPath}/dev`);
|
|
2318
|
+
shellExec(`sudo umount ${nfsHostPath}/run`);
|
|
2305
2319
|
// shellExec(`sudo umount ${nfsHostPath}/lib/modules`);
|
|
2306
2320
|
break;
|
|
2307
2321
|
}
|
package/cli.md
CHANGED
package/docker-compose.yml
CHANGED
|
@@ -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.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.8.813
|
|
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.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.8.813
|
|
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.
|
|
5
|
+
"version": "2.8.813",
|
|
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",
|
package/src/index.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
# Use Rocky Linux 9 as the base image
|
|
2
1
|
FROM rockylinux:9
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
ENV DNF_ASSUMEYES=1
|
|
3
|
+
RUN dnf install -y --allowerasing bzip2
|
|
6
4
|
|
|
7
|
-
# Set root password to root
|
|
8
|
-
RUN echo 'root:root' | chpasswd
|
|
9
|
-
|
|
10
|
-
# Update system packages and install EPEL, then essential tools
|
|
11
|
-
# DNF is the package manager for Rocky Linux (RHEL-based)
|
|
12
5
|
RUN dnf update -y
|
|
13
6
|
RUN dnf install -y epel-release
|
|
14
7
|
RUN dnf install -y --allowerasing sudo
|
|
15
8
|
RUN dnf install -y --allowerasing curl
|
|
16
9
|
RUN dnf install -y --allowerasing net-tools
|
|
17
10
|
RUN dnf install -y --allowerasing openssh-server
|
|
18
|
-
RUN dnf install -y --allowerasing supervisor
|
|
19
11
|
RUN dnf install -y --allowerasing nano
|
|
20
12
|
RUN dnf install -y --allowerasing vim-enhanced
|
|
21
13
|
RUN dnf install -y --allowerasing less
|
|
@@ -25,11 +17,6 @@ RUN dnf install -y --allowerasing git
|
|
|
25
17
|
RUN dnf install -y --allowerasing gnupg2
|
|
26
18
|
RUN dnf clean all
|
|
27
19
|
|
|
28
|
-
# Configure SSH
|
|
29
|
-
RUN mkdir -p /var/run/sshd
|
|
30
|
-
# Allow root login via password
|
|
31
|
-
RUN sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
|
|
32
|
-
|
|
33
20
|
# Install LAMPP (XAMPP)
|
|
34
21
|
# Download the XAMPP installer for Linux
|
|
35
22
|
RUN curl -Lo xampp-linux-installer.run https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/7.4.33/xampp-linux-x64-7.4.33-0-installer.run?from_af=true
|
|
@@ -53,7 +40,6 @@ RUN mkdir /www
|
|
|
53
40
|
RUN ln -s /www /opt/lampp/htdocs
|
|
54
41
|
|
|
55
42
|
# Install Node.js
|
|
56
|
-
# Add NodeSource repository for Node.js 23.x (for RHEL-based systems)
|
|
57
43
|
RUN curl -fsSL https://rpm.nodesource.com/setup_23.x | bash -
|
|
58
44
|
RUN dnf install nodejs -y
|
|
59
45
|
RUN dnf clean all
|
|
@@ -71,25 +57,3 @@ EXPOSE 80
|
|
|
71
57
|
EXPOSE 443
|
|
72
58
|
EXPOSE 3000-3100
|
|
73
59
|
EXPOSE 4000-4100
|
|
74
|
-
|
|
75
|
-
# Default command to start SSH and XAMPP (Apache and MySQL)
|
|
76
|
-
# Using supervisord to manage multiple processes
|
|
77
|
-
CMD ["/usr/bin/supervisord", "-n"]
|
|
78
|
-
|
|
79
|
-
# To run XAMPP services under supervisord, you'll need to add a supervisord configuration file.
|
|
80
|
-
# For example, create a file named /etc/supervisord.d/xampp.ini inside the container:
|
|
81
|
-
#
|
|
82
|
-
# [program:sshd]
|
|
83
|
-
# command=/usr/sbin/sshd -D
|
|
84
|
-
# autostart=true
|
|
85
|
-
# autorestart=true
|
|
86
|
-
#
|
|
87
|
-
# [program:apache]
|
|
88
|
-
# command=/opt/lampp/bin/apachectl start
|
|
89
|
-
# autostart=true
|
|
90
|
-
# autorestart=true
|
|
91
|
-
#
|
|
92
|
-
# [program:mysql]
|
|
93
|
-
# command=/opt/lampp/bin/mysql.server start
|
|
94
|
-
# autostart=true
|
|
95
|
-
# autorestart=true
|