underpost 2.8.811 → 2.8.812
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 +49 -30
- 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 = [
|
|
@@ -76,9 +76,10 @@ 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
81
|
`apt update`,
|
|
81
|
-
`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`,
|
|
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`,
|
|
82
83
|
`ln -sf /lib/systemd/systemd /sbin/init`,
|
|
83
84
|
|
|
84
85
|
`echo 'deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe multiverse
|
|
@@ -98,14 +99,13 @@ deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe
|
|
|
98
99
|
|
|
99
100
|
`apt update -qq`,
|
|
100
101
|
`apt install -y xinput x11-xkb-utils usbutils`,
|
|
101
|
-
];
|
|
102
102
|
|
|
103
|
-
let steps = [
|
|
104
103
|
// `date -s "${shellExec(`date '+%Y-%m-%d %H:%M:%S'`, { stdout: true }).trim()}"`,
|
|
105
104
|
// `date`,
|
|
106
105
|
|
|
107
106
|
...timeZoneSteps,
|
|
108
107
|
...chronySetUp(chronyConfPath),
|
|
108
|
+
...keyboardSteps,
|
|
109
109
|
|
|
110
110
|
// Create root user
|
|
111
111
|
`useradd -m -s /bin/bash -G sudo root`,
|
|
@@ -118,7 +118,9 @@ deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted universe
|
|
|
118
118
|
`chown -R root /home/root/.ssh`,
|
|
119
119
|
`chmod 700 /home/root/.ssh`,
|
|
120
120
|
`chmod 600 /home/root/.ssh/authorized_keys`,
|
|
121
|
+
];
|
|
121
122
|
|
|
123
|
+
let steps = [
|
|
122
124
|
// Configure cloud-init for MAAS
|
|
123
125
|
`cat <<EOF_MAAS_CFG > /etc/cloud/cloud.cfg.d/90_maas.cfg
|
|
124
126
|
#cloud-config
|
|
@@ -189,9 +191,12 @@ network:
|
|
|
189
191
|
version: 2
|
|
190
192
|
ethernets:
|
|
191
193
|
${process.env.RPI4_INTERFACE_NAME}:
|
|
192
|
-
dhcp4:
|
|
194
|
+
dhcp4: false
|
|
193
195
|
addresses:
|
|
194
196
|
- ${ipaddr}/24
|
|
197
|
+
routes:
|
|
198
|
+
- to: default
|
|
199
|
+
via: ${gatewayip}
|
|
195
200
|
|
|
196
201
|
# chpasswd:
|
|
197
202
|
# expire: false
|
|
@@ -209,40 +214,49 @@ bootcmd:
|
|
|
209
214
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
210
215
|
- echo "Init bootcmd"
|
|
211
216
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
212
|
-
|
|
217
|
+
- ntpdate -u ${IP_ADDRESS} || ntpdate -u ${process.env.MAAS_NTP_SERVER}
|
|
213
218
|
runcmd:
|
|
214
219
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
215
220
|
- echo "Init runcmd"
|
|
216
221
|
- echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
217
222
|
EOF_MAAS_CFG`,
|
|
218
|
-
...keyboardSteps,
|
|
219
223
|
];
|
|
220
224
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
225
|
+
const runSteps = (steps = []) => {
|
|
226
|
+
const script = steps
|
|
227
|
+
.map(
|
|
228
|
+
(s, i) => `echo "step ${i + 1}/${steps.length}: ${s.split('\n')[0]}"
|
|
229
|
+
${s}`,
|
|
230
|
+
)
|
|
231
|
+
.join('\n');
|
|
224
232
|
|
|
225
|
-
|
|
226
|
-
${
|
|
227
|
-
|
|
228
|
-
(s, i) => `echo "step ${i + 1}/${steps.length}: ${s.split('\n')[0]}"
|
|
229
|
-
${s}
|
|
230
|
-
`,
|
|
231
|
-
)
|
|
232
|
-
.join(``)}
|
|
233
|
-
EOF`);
|
|
233
|
+
const cmd = `sudo chroot ${nfsHostPath} /usr/bin/qemu-aarch64-static /bin/bash <<'EOF_OUTER'
|
|
234
|
+
${script}
|
|
235
|
+
EOF_OUTER`;
|
|
234
236
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
apt update
|
|
238
|
-
EOF`);
|
|
237
|
+
shellExec(cmd);
|
|
238
|
+
};
|
|
239
239
|
|
|
240
240
|
if (update) {
|
|
241
|
+
// --reboot
|
|
241
242
|
shellExec(`sudo chroot ${nfsHostPath} /usr/bin/qemu-aarch64-static /bin/bash <<'EOF'
|
|
242
|
-
sudo cloud-init clean --logs --
|
|
243
|
+
sudo cloud-init clean --logs --seed --configs all --machine-id
|
|
244
|
+
sudo rm -rf /var/lib/cloud/*
|
|
243
245
|
EOF`);
|
|
244
|
-
fs.writeFileSync(`${nfsHostPath}/var/log/cloud-init.log`, '', 'utf8');
|
|
245
246
|
|
|
247
|
+
if (fs.existsSync(`${nfsHostPath}/var/log/`)) {
|
|
248
|
+
fs.writeFileSync(`${nfsHostPath}/var/log/cloud-init.log`, '', 'utf8');
|
|
249
|
+
fs.writeFileSync(`${nfsHostPath}/var/log/cloud-init-output.log`, '', 'utf8');
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
runSteps(steps);
|
|
253
|
+
} else {
|
|
254
|
+
runSteps(installSteps.concat(steps));
|
|
255
|
+
|
|
256
|
+
shellExec(`sudo chroot ${nfsHostPath} /usr/bin/qemu-aarch64-static /bin/bash <<'EOF'
|
|
257
|
+
echo "nameserver ${process.env.MAAS_DNS}" | tee /etc/resolv.conf > /dev/null
|
|
258
|
+
apt update
|
|
259
|
+
EOF`);
|
|
246
260
|
fs.writeFileSync(
|
|
247
261
|
`${nfsHostPath}/dns.sh`,
|
|
248
262
|
`rm /etc/resolv.conf
|
|
@@ -259,7 +273,7 @@ const chronySetUp = (path) => {
|
|
|
259
273
|
# Use public servers from the pool.ntp.org project.
|
|
260
274
|
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
|
|
261
275
|
# pool 2.pool.ntp.org iburst
|
|
262
|
-
server
|
|
276
|
+
server ${process.env.MAAS_NTP_SERVER} iburst
|
|
263
277
|
|
|
264
278
|
# Record the rate at which the system clock gains/losses time.
|
|
265
279
|
driftfile /var/lib/chrony/drift
|
|
@@ -1751,7 +1765,6 @@ EOF`);
|
|
|
1751
1765
|
|
|
1752
1766
|
switch (process.argv[3]) {
|
|
1753
1767
|
case 'rpi4mb':
|
|
1754
|
-
const resourceId = process.argv[4] ?? '12';
|
|
1755
1768
|
tftpSubDir = '/rpi4mb';
|
|
1756
1769
|
zipFirmwareFileName = `RPi4_UEFI_Firmware_v1.41.zip`;
|
|
1757
1770
|
zipFirmwareName = zipFirmwareFileName.split('.zip')[0];
|
|
@@ -1763,7 +1776,7 @@ EOF`);
|
|
|
1763
1776
|
await Downloader(zipFirmwareUrl, `../${zipFirmwareFileName}`);
|
|
1764
1777
|
shellExec(`cd .. && mkdir ${zipFirmwareName} && cd ${zipFirmwareName} && unzip ../${zipFirmwareFileName}`);
|
|
1765
1778
|
}
|
|
1766
|
-
resource = resources.find((o) => o.
|
|
1779
|
+
resource = resources.find((o) => o.architecture === 'arm64/ga-24.04' && o.name === 'ubuntu/noble');
|
|
1767
1780
|
name = resource.name;
|
|
1768
1781
|
architecture = resource.architecture;
|
|
1769
1782
|
resource = resources.find((o) => o.name === name && o.architecture === architecture);
|
|
@@ -2078,8 +2091,9 @@ BOOT_ORDER=0x21`;
|
|
|
2078
2091
|
newMachine = machineFactory(JSON.parse(newMachine));
|
|
2079
2092
|
machines.push(newMachine);
|
|
2080
2093
|
console.log(newMachine);
|
|
2094
|
+
// commissioning_scripts=90-verify-user.sh
|
|
2081
2095
|
shellExec(
|
|
2082
|
-
`maas ${process.env.MAAS_ADMIN_USERNAME} machine commission ${newMachine.system_id}
|
|
2096
|
+
`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
2097
|
{
|
|
2084
2098
|
silent: true,
|
|
2085
2099
|
},
|
|
@@ -2185,6 +2199,7 @@ udp-port = 32766
|
|
|
2185
2199
|
const host = process.argv[4];
|
|
2186
2200
|
const nfsHostPath = `${process.env.NFS_EXPORT_PATH}/${host}`;
|
|
2187
2201
|
const ipaddr = process.env.RPI4_IP;
|
|
2202
|
+
const gatewayip = process.env.GATEWAY_IP;
|
|
2188
2203
|
await updateVirtualRoot({
|
|
2189
2204
|
IP_ADDRESS,
|
|
2190
2205
|
architecture,
|
|
@@ -2192,6 +2207,7 @@ udp-port = 32766
|
|
|
2192
2207
|
nfsHostPath,
|
|
2193
2208
|
ipaddr,
|
|
2194
2209
|
update: true,
|
|
2210
|
+
gatewayip,
|
|
2195
2211
|
});
|
|
2196
2212
|
break;
|
|
2197
2213
|
}
|
|
@@ -2201,6 +2217,7 @@ udp-port = 32766
|
|
|
2201
2217
|
const architecture = process.argv[3];
|
|
2202
2218
|
const host = process.argv[4];
|
|
2203
2219
|
const nfsHostPath = `${process.env.NFS_EXPORT_PATH}/${host}`;
|
|
2220
|
+
const gatewayip = process.env.GATEWAY_IP;
|
|
2204
2221
|
shellExec(`sudo dnf install -y iptables-legacy`);
|
|
2205
2222
|
shellExec(`sudo dnf install -y debootstrap`);
|
|
2206
2223
|
shellExec(`sudo dnf install kernel-modules-extra-$(uname -r)`);
|
|
@@ -2279,6 +2296,7 @@ EOF`);
|
|
|
2279
2296
|
host,
|
|
2280
2297
|
nfsHostPath,
|
|
2281
2298
|
ipaddr,
|
|
2299
|
+
gatewayip,
|
|
2282
2300
|
});
|
|
2283
2301
|
|
|
2284
2302
|
break;
|
|
@@ -2302,6 +2320,7 @@ EOF`);
|
|
|
2302
2320
|
shellExec(`sudo umount ${nfsHostPath}/sys`);
|
|
2303
2321
|
shellExec(`sudo umount ${nfsHostPath}/dev/pts`);
|
|
2304
2322
|
shellExec(`sudo umount ${nfsHostPath}/dev`);
|
|
2323
|
+
shellExec(`sudo umount ${nfsHostPath}/run`);
|
|
2305
2324
|
// shellExec(`sudo umount ${nfsHostPath}/lib/modules`);
|
|
2306
2325
|
break;
|
|
2307
2326
|
}
|
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.812
|
|
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.812
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
package/package.json
CHANGED
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
|