@underpostnet/underpost 2.95.8 → 2.96.1
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 +2 -2
- package/baremetal/commission-workflows.json +44 -0
- package/baremetal/packer-workflows.json +24 -0
- package/cli.md +29 -31
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
- package/package.json +1 -1
- package/packer/images/Rocky9Amd64/Makefile +62 -0
- package/packer/images/Rocky9Amd64/QUICKSTART.md +113 -0
- package/packer/images/Rocky9Amd64/README.md +122 -0
- package/packer/images/Rocky9Amd64/http/rocky9.ks.pkrtpl.hcl +114 -0
- package/packer/images/Rocky9Amd64/rocky9.pkr.hcl +164 -0
- package/packer/images/Rocky9Arm64/Makefile +69 -0
- package/packer/images/Rocky9Arm64/README.md +122 -0
- package/packer/images/Rocky9Arm64/http/rocky9.ks.pkrtpl.hcl +114 -0
- package/packer/images/Rocky9Arm64/rocky9.pkr.hcl +171 -0
- package/packer/scripts/fuse-nbd +64 -0
- package/packer/scripts/fuse-tar-root +63 -0
- package/scripts/maas-setup.sh +13 -2
- package/scripts/maas-upload-boot-resource.sh +183 -0
- package/scripts/packer-init-vars-file.sh +40 -0
- package/scripts/packer-setup.sh +289 -0
- package/src/cli/baremetal.js +342 -55
- package/src/cli/cloud-init.js +1 -1
- package/src/cli/env.js +24 -3
- package/src/cli/index.js +19 -0
- package/src/cli/repository.js +164 -0
- package/src/index.js +2 -1
- package/manifests/mariadb/config.yaml +0 -10
- package/manifests/mariadb/secret.yaml +0 -8
- package/src/client/ssr/pages/404.js +0 -12
- package/src/client/ssr/pages/500.js +0 -12
- package/src/client/ssr/pages/maintenance.js +0 -14
- package/src/client/ssr/pages/offline.js +0 -21
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<!-- badges -->
|
|
20
20
|
|
|
21
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/2.96.1) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](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.
|
|
69
|
+
## underpost ci/cd cli v2.96.1
|
|
70
70
|
|
|
71
71
|
### Usage: `underpost [options] [command]`
|
|
72
72
|
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"rpi4mb": {
|
|
3
|
+
"menuentryStr": "UNDERPOST.NET UEFI/GRUB/MAAS RPi4 commissioning (ARM64)",
|
|
4
|
+
"systemProvisioning": "ubuntu",
|
|
5
|
+
"kernelLibVersion": "6.8.0-41-generic",
|
|
6
|
+
"networkInterfaceName": "enabcm6e4ei0",
|
|
7
|
+
"netmask": "255.255.255.0",
|
|
8
|
+
"firmwares": [
|
|
9
|
+
{
|
|
10
|
+
"url": "https://github.com/pftf/RPi4/releases/download/v1.41/RPi4_UEFI_Firmware_v1.41.zip",
|
|
11
|
+
"gateway": "192.168.1.1",
|
|
12
|
+
"subnet": "255.255.255.0"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"chronyc": {
|
|
16
|
+
"timezone": "America/New_York",
|
|
17
|
+
"chronyConfPath": "/etc/chrony/chrony.conf"
|
|
18
|
+
},
|
|
19
|
+
"debootstrap": {
|
|
20
|
+
"image": {
|
|
21
|
+
"architecture": "arm64",
|
|
22
|
+
"name": "noble"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"maas": {
|
|
26
|
+
"image": {
|
|
27
|
+
"architecture": "arm64/ga-24.04",
|
|
28
|
+
"name": "ubuntu/noble"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"nfs": {
|
|
32
|
+
"mounts": {
|
|
33
|
+
"bind": [
|
|
34
|
+
"/proc",
|
|
35
|
+
"/sys",
|
|
36
|
+
"/run"
|
|
37
|
+
],
|
|
38
|
+
"rbind": [
|
|
39
|
+
"/dev"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Rocky9Amd64": {
|
|
3
|
+
"dir": "packer/images/Rocky9Amd64",
|
|
4
|
+
"maas": {
|
|
5
|
+
"name": "custom/rocky9",
|
|
6
|
+
"title": "Rocky 9 Custom",
|
|
7
|
+
"architecture": "amd64/generic",
|
|
8
|
+
"base_image": "rhel/9",
|
|
9
|
+
"filetype": "tgz",
|
|
10
|
+
"content": "rocky9.tar.gz"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"Rocky9Arm64": {
|
|
14
|
+
"dir": "packer/images/Rocky9Arm64",
|
|
15
|
+
"maas": {
|
|
16
|
+
"name": "custom/rocky9-arm64",
|
|
17
|
+
"title": "Rocky 9 Arm64 Custom",
|
|
18
|
+
"architecture": "arm64/generic",
|
|
19
|
+
"base_image": "rhel/9",
|
|
20
|
+
"filetype": "tgz",
|
|
21
|
+
"content": "rocky9.tar.gz"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.
|
|
1
|
+
## underpost ci/cd cli v2.96.1
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -268,14 +268,16 @@ Options:
|
|
|
268
268
|
Manages Underpost configurations using various operators.
|
|
269
269
|
|
|
270
270
|
Arguments:
|
|
271
|
-
operator
|
|
272
|
-
|
|
273
|
-
key
|
|
274
|
-
value
|
|
271
|
+
operator The configuration operation to perform. Options: set,
|
|
272
|
+
delete, get, list, clean.
|
|
273
|
+
key Optional: The specific configuration key to manage.
|
|
274
|
+
value Optional: The value to set for the configuration key.
|
|
275
275
|
|
|
276
276
|
Options:
|
|
277
|
-
--plain
|
|
278
|
-
|
|
277
|
+
--plain Prints the configuration value in plain text.
|
|
278
|
+
--filter <keyword> Filters the list by matching key or value (only for list
|
|
279
|
+
operation).
|
|
280
|
+
-h, --help display help for command
|
|
279
281
|
|
|
280
282
|
```
|
|
281
283
|
|
|
@@ -898,30 +900,26 @@ Manages baremetal server operations, including installation, database setup,
|
|
|
898
900
|
commissioning, and user management.
|
|
899
901
|
|
|
900
902
|
Options:
|
|
901
|
-
--control-server-install
|
|
902
|
-
--control-server-uninstall
|
|
903
|
-
--control-server-db-install
|
|
904
|
-
|
|
905
|
-
--
|
|
906
|
-
|
|
907
|
-
--
|
|
908
|
-
|
|
909
|
-
--
|
|
910
|
-
|
|
911
|
-
--
|
|
912
|
-
|
|
913
|
-
--nfs-
|
|
914
|
-
workflow id config architecture.
|
|
915
|
-
--nfs-sh
|
|
916
|
-
|
|
917
|
-
--
|
|
918
|
-
|
|
919
|
-
--
|
|
920
|
-
|
|
921
|
-
--dev Sets the development context environment for
|
|
922
|
-
baremetal operations.
|
|
923
|
-
--ls Lists available boot resources and machines.
|
|
924
|
-
-h, --help display help for command
|
|
903
|
+
--control-server-install Installs the baremetal control server.
|
|
904
|
+
--control-server-uninstall Uninstalls the baremetal control server.
|
|
905
|
+
--control-server-db-install Installs up the database for the baremetal control server.
|
|
906
|
+
--control-server-db-uninstall Uninstalls the database for the baremetal control server.
|
|
907
|
+
--install-packer Installs Packer CLI.
|
|
908
|
+
--packer-maas-image-template <template-path> Creates a new image folder from canonical/packer-maas template path (requires workflow-id).
|
|
909
|
+
--packer-workflow-id <workflow-id> Specifies the workflow ID for Packer MAAS image operations.
|
|
910
|
+
--packer-maas-image-build Builds a MAAS image using Packer for the workflow specified by --packer-workflow-id.
|
|
911
|
+
--packer-maas-image-upload Uploads an existing MAAS image artifact without rebuilding for the workflow specified by --packer-workflow-id.
|
|
912
|
+
--packer-maas-image-cached Continue last build without removing artifacts (used with --packer-maas-image-build).
|
|
913
|
+
--commission Init workflow for commissioning a physical machine.
|
|
914
|
+
--nfs-build Builds an NFS root filesystem for a workflow id config architecture using QEMU emulation.
|
|
915
|
+
--nfs-mount Mounts the NFS root filesystem for a workflow id config architecture.
|
|
916
|
+
--nfs-unmount Unmounts the NFS root filesystem for a workflow id config architecture.
|
|
917
|
+
--nfs-sh Copies QEMU emulation root entrypoint shell command to the clipboard.
|
|
918
|
+
--cloud-init-update Updates cloud init for a workflow id config architecture.
|
|
919
|
+
--logs <log-id> Displays logs for log id: dhcp, cloud, machine, cloud-config.
|
|
920
|
+
--dev Sets the development context environment for baremetal operations.
|
|
921
|
+
--ls Lists available boot resources and machines.
|
|
922
|
+
-h, --help display help for command
|
|
925
923
|
|
|
926
924
|
```
|
|
927
925
|
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.96.1
|
|
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.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.96.1
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -18,7 +18,7 @@ spec:
|
|
|
18
18
|
spec:
|
|
19
19
|
containers:
|
|
20
20
|
- name: dd-test-development-blue
|
|
21
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
21
|
+
image: localhost/rockylinux9-underpost:v2.96.1
|
|
22
22
|
|
|
23
23
|
command:
|
|
24
24
|
- /bin/sh
|
|
@@ -103,7 +103,7 @@ spec:
|
|
|
103
103
|
spec:
|
|
104
104
|
containers:
|
|
105
105
|
- name: dd-test-development-green
|
|
106
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
106
|
+
image: localhost/rockylinux9-underpost:v2.96.1
|
|
107
107
|
|
|
108
108
|
command:
|
|
109
109
|
- /bin/sh
|
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.
|
|
5
|
+
"version": "2.96.1",
|
|
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,62 @@
|
|
|
1
|
+
#!/usr/bin/make -f
|
|
2
|
+
|
|
3
|
+
include ../scripts/check.mk
|
|
4
|
+
|
|
5
|
+
PACKER ?= packer
|
|
6
|
+
PACKER_LOG ?= 0
|
|
7
|
+
TIMEOUT ?= 1h
|
|
8
|
+
ARCH ?= x86_64
|
|
9
|
+
|
|
10
|
+
# Detect if running on ARM host
|
|
11
|
+
ifeq ($(shell uname -m),aarch64)
|
|
12
|
+
HOST_IS_ARM = true
|
|
13
|
+
else
|
|
14
|
+
HOST_IS_ARM = false
|
|
15
|
+
endif
|
|
16
|
+
|
|
17
|
+
ifeq ($(wildcard /usr/share/OVMF/OVMF_CODE.fd),)
|
|
18
|
+
OVMF_SFX ?= _4M
|
|
19
|
+
else
|
|
20
|
+
OVMF_SFX ?=
|
|
21
|
+
endif
|
|
22
|
+
|
|
23
|
+
export PACKER_LOG
|
|
24
|
+
|
|
25
|
+
# Fallback
|
|
26
|
+
ifeq ($(strip $(ARCH)),amd64)
|
|
27
|
+
ARCH = x86_64
|
|
28
|
+
endif
|
|
29
|
+
|
|
30
|
+
.PHONY: all clean
|
|
31
|
+
|
|
32
|
+
all: rocky9.tar.gz
|
|
33
|
+
|
|
34
|
+
$(eval $(call check_packages_deps))
|
|
35
|
+
|
|
36
|
+
lint:
|
|
37
|
+
packer validate .
|
|
38
|
+
packer fmt -check -diff .
|
|
39
|
+
|
|
40
|
+
format:
|
|
41
|
+
packer fmt .
|
|
42
|
+
|
|
43
|
+
OVMF_VARS.fd: /usr/share/OVMF/OVMF_VARS${OVMF_SFX}.fd
|
|
44
|
+
cp -v $< ${ARCH}_VARS.fd
|
|
45
|
+
|
|
46
|
+
SIZE_VARS.fd:
|
|
47
|
+
ifeq ($(strip $(ARCH)),aarch64)
|
|
48
|
+
truncate -s 64m ${ARCH}_VARS.fd
|
|
49
|
+
else
|
|
50
|
+
truncate -s 2m ${ARCH}_VARS.fd
|
|
51
|
+
endif
|
|
52
|
+
|
|
53
|
+
rocky9.tar.gz: check-deps clean OVMF_VARS.fd SIZE_VARS.fd
|
|
54
|
+
${PACKER} init rocky9.pkr.hcl && ${PACKER} build \
|
|
55
|
+
-var architecture=${ARCH} \
|
|
56
|
+
-var host_is_arm=${HOST_IS_ARM} \
|
|
57
|
+
-var timeout=${TIMEOUT} \
|
|
58
|
+
-var ovmf_suffix=${OVMF_SFX} \
|
|
59
|
+
rocky9.pkr.hcl
|
|
60
|
+
|
|
61
|
+
clean:
|
|
62
|
+
${RM} -rf *.fd output-rocky9 rocky9.tar.gz
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Quick Start Guide - Rocky9 MAAS Image Build
|
|
2
|
+
|
|
3
|
+
## Prerequisites Check
|
|
4
|
+
|
|
5
|
+
Run these commands to verify your system is ready:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Check hardware virtualization
|
|
9
|
+
egrep -c '(vmx|svm)' /proc/cpuinfo # Should be > 0
|
|
10
|
+
|
|
11
|
+
# Check libvirt
|
|
12
|
+
systemctl status libvirtd
|
|
13
|
+
|
|
14
|
+
# Check QEMU
|
|
15
|
+
qemu-system-x86_64 --version
|
|
16
|
+
|
|
17
|
+
# Check Packer
|
|
18
|
+
packer version
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Build Commands
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# From the engine root directory
|
|
25
|
+
cd /home/dd/engine
|
|
26
|
+
|
|
27
|
+
# Option 1: Build and Upload (recommended)
|
|
28
|
+
node bin baremetal --dev --packer-workflow-id Rocky9Amd64 --packer-maas-image-build
|
|
29
|
+
|
|
30
|
+
# Option 2: Upload Only (skip rebuild, use existing artifact)
|
|
31
|
+
node bin baremetal --dev --packer-workflow-id Rocky9Amd64 --packer-maas-image-upload
|
|
32
|
+
|
|
33
|
+
# Option 3: Manual build
|
|
34
|
+
cd packer/images/Rocky9Amd64
|
|
35
|
+
packer init .
|
|
36
|
+
PACKER_LOG=1 packer build .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Build Process Timeline
|
|
40
|
+
|
|
41
|
+
- **Download ISO**: ~5-10 minutes (1.3GB)
|
|
42
|
+
- **VM Installation**: ~20-40 minutes
|
|
43
|
+
- **Post-processing**: ~5-10 minutes
|
|
44
|
+
- **Total**: ~30-60 minutes
|
|
45
|
+
|
|
46
|
+
## Output
|
|
47
|
+
|
|
48
|
+
The build produces:
|
|
49
|
+
- `rocky9.tar.gz` - The MAAS-ready image (~1.2GB)
|
|
50
|
+
|
|
51
|
+
## Upload to MAAS
|
|
52
|
+
|
|
53
|
+
After successful build, upload happens automatically. To re-upload:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Option 1: Use the CLI (recommended, includes MAAS profile auto-detection)
|
|
57
|
+
node bin baremetal --dev --packer-workflow-id Rocky9Amd64 --packer-maas-image-upload
|
|
58
|
+
|
|
59
|
+
# Option 2: Use the upload script directly
|
|
60
|
+
./scripts/maas-upload-boot-resource.sh maas \
|
|
61
|
+
custom/rocky9 \
|
|
62
|
+
"Rocky 9 Custom" \
|
|
63
|
+
amd64/generic \
|
|
64
|
+
rhel/9 \
|
|
65
|
+
tgz \
|
|
66
|
+
packer/images/Rocky9Amd64/rocky9.tar.gz
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Upload-Only Flag Benefits
|
|
70
|
+
|
|
71
|
+
The `--packer-maas-image-upload` flag allows you to:
|
|
72
|
+
- ⚡ **Skip rebuild** - Saves 30-60 minutes
|
|
73
|
+
- 💾 **Reuse artifacts** - Uses existing 1.2GB tarball
|
|
74
|
+
- 🔄 **Retry uploads** - Re-upload if upload failed
|
|
75
|
+
- 🎯 **Test uploads** - Upload to different MAAS instances
|
|
76
|
+
|
|
77
|
+
## Common Issues
|
|
78
|
+
|
|
79
|
+
### "No checksum found"
|
|
80
|
+
✅ Fixed - ISO URL now uses Rocky-9-latest naming
|
|
81
|
+
|
|
82
|
+
### "qemu-system-x86_64 not found"
|
|
83
|
+
✅ Fixed - Symlink created to /usr/libexec/qemu-kvm
|
|
84
|
+
|
|
85
|
+
### "OVMF_CODE.fd not found"
|
|
86
|
+
✅ Fixed - OVMF symlinks created
|
|
87
|
+
|
|
88
|
+
### Build hangs or times out
|
|
89
|
+
- Check system resources (RAM, CPU)
|
|
90
|
+
- Verify network connectivity
|
|
91
|
+
- Check logs: `packer_cache/` and console output
|
|
92
|
+
|
|
93
|
+
## Monitoring Build Progress
|
|
94
|
+
|
|
95
|
+
Watch the Packer output for:
|
|
96
|
+
```
|
|
97
|
+
==> qemu.rocky9: Downloading ISO...
|
|
98
|
+
==> qemu.rocky9: Starting HTTP server on port...
|
|
99
|
+
==> qemu.rocky9: Starting VM...
|
|
100
|
+
==> qemu.rocky9: Waiting for shutdown...
|
|
101
|
+
==> qemu.rocky9: Converting image...
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Clean Up After Build
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Remove build artifacts (keep only the tarball)
|
|
108
|
+
cd packer/images/Rocky9Amd64
|
|
109
|
+
rm -rf output-rocky9 packer_cache x86_64_VARS.fd
|
|
110
|
+
|
|
111
|
+
# Disconnect NBD devices if build failed
|
|
112
|
+
for i in {0..15}; do sudo qemu-nbd -d /dev/nbd${i} 2>/dev/null; done
|
|
113
|
+
```
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Rocky 9 Packer template for MAAS
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The Packer template in this directory creates a Rocky 9 AMD64/ARM64 image for use with MAAS.
|
|
6
|
+
|
|
7
|
+
## Prerequisites to create the image
|
|
8
|
+
|
|
9
|
+
* A machine running Ubuntu 22.04+ with the ability to run KVM virtual machines.
|
|
10
|
+
* qemu-utils, libnbd-bin, nbdkit and fuse2fs
|
|
11
|
+
* qemu-system
|
|
12
|
+
* qemu-system-modules-spice (If building on Ubuntu 24.04 LTS "Noble")
|
|
13
|
+
* ovmf
|
|
14
|
+
* cloud-image-utils
|
|
15
|
+
* parted
|
|
16
|
+
* [Packer.](https://www.packer.io/intro/getting-started/install.html), v1.11.0 or newer
|
|
17
|
+
|
|
18
|
+
## Requirements to deploy the image
|
|
19
|
+
|
|
20
|
+
* [MAAS](https://maas.io) 3.3 or later, as that version introduces support for Rocky
|
|
21
|
+
* [Curtin](https://launchpad.net/curtin) 22.1. If you have a MAAS with an earlier Curtin version, you can [patch](https://code.launchpad.net/~xnox/curtin/+git/curtin/+merge/415604) distro.py to deploy Rocky.
|
|
22
|
+
|
|
23
|
+
## Customizing the image
|
|
24
|
+
|
|
25
|
+
You can customize the deployment image by modifying http/rocky.ks. See the [RHEL kickstart documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/performing_an_advanced_rhel_installation/kickstart-commands-and-options-reference_installing-rhel-as-an-experienced-user#part-or-partition_kickstart-commands-for-handling-storage) for more information.
|
|
26
|
+
|
|
27
|
+
## Building the image using a proxy
|
|
28
|
+
|
|
29
|
+
The Packer template downloads the Rocky ISO image from the Internet. You can tell Packer to use a proxy by setting the HTTP_PROXY environment variable to point to your proxy server. You can also redefine rocky_iso_url to a local file. If you want to skip the base image integrity check, set iso_checksum_type to none and remove iso_checksum.
|
|
30
|
+
|
|
31
|
+
To use a proxy during the installation define the `KS_PROXY` variable in the environment, as bellow:
|
|
32
|
+
|
|
33
|
+
```shell
|
|
34
|
+
export KS_PROXY="\"${HTTP_PROXY}\""
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
# Building the image using a kickstart mirror
|
|
38
|
+
|
|
39
|
+
To tell Packer to use a specific mirror set the `KS_MIRROR` environment variable
|
|
40
|
+
poiniting to the mirror URL.
|
|
41
|
+
|
|
42
|
+
```shell
|
|
43
|
+
export KS_MIRROR="https://dl.rockylinux.org/pub/rocky/9"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Building an image
|
|
47
|
+
|
|
48
|
+
You can build the image using the Makefile:
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
make
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
You can also manually run packer. Set your current working directory to packer-maas/rocky9, where this file resides, and generate an image with:
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
packer init
|
|
58
|
+
PACKER_LOG=1 packer build .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The installation runs in a non-interactive mode.
|
|
62
|
+
|
|
63
|
+
Note: rocky9.pkr.hcl runs Packer in headless mode, with the serial port output from qemu redirected to stdio to give feedback on image creation process. If you wish to see more, change the value of `headless` to `false` in rocky9.pkr.hcl, remove `[ "-serial", "stdio" ]` from `qemuargs` section and select `View`, then `serial0` in the qemu window that appears during build. This lets you watch progress of the image build script. Press `ctrl-b 2` to switch to shell to explore more, and `ctrl-b 1` to go back to log view.
|
|
64
|
+
|
|
65
|
+
### Makefile Parameters
|
|
66
|
+
|
|
67
|
+
#### ARCH
|
|
68
|
+
|
|
69
|
+
Defaults to x86_64 to build AMD64 compatible images. In order to build ARM64 images, use ARCH=aarch64
|
|
70
|
+
|
|
71
|
+
#### TIMEOUT
|
|
72
|
+
|
|
73
|
+
The timeout to apply when building the image. The default value is set to 1h.
|
|
74
|
+
|
|
75
|
+
## Uploading an image to MAAS
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
maas $PROFILE boot-resources create name='custom/rocky9' \
|
|
79
|
+
title='Rocky 9 Custom' architecture='amd64/generic' \
|
|
80
|
+
base_image='rhel/9' filetype='tgz' \
|
|
81
|
+
content@=rocky9.tar.gz
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For ARM64, use:
|
|
85
|
+
|
|
86
|
+
```shell
|
|
87
|
+
maas $PROFILE boot-resources create name='custom/rocky9' \
|
|
88
|
+
title='Rocky 9 Custom' architecture='arm64/generic' \
|
|
89
|
+
base_image='rhel/9' filetype='tgz' \
|
|
90
|
+
content@=rocky9.tar.gz
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Please note that, currently due to lack of support in curtin, deploying ARM64 images needs a preseed file. This is due to [LP# 2090874](https://bugs.launchpad.net/curtin/+bug/2090874) and currently is in the process of getting fixed.
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
#cloud-config
|
|
97
|
+
debconf_selections:
|
|
98
|
+
maas: |
|
|
99
|
+
{{for line in str(curtin_preseed).splitlines()}}
|
|
100
|
+
{{line}}
|
|
101
|
+
{{endfor}}
|
|
102
|
+
|
|
103
|
+
extract_commands:
|
|
104
|
+
grub_install: curtin in-target -- cp -v /boot/efi/EFI/rocky/shimaa64.efi /boot/efi/EFI/rocky/shimx64.efi
|
|
105
|
+
|
|
106
|
+
late_commands:
|
|
107
|
+
maas: [wget, '--no-proxy', '{{node_disable_pxe_url}}', '--post-data', '{{node_disable_pxe_data}}', '-O', '/dev/null']
|
|
108
|
+
bootloader_01: ["curtin", "in-target", "--", "cp", "-v", "/boot/efi/EFI/rocky/shimaa64.efi", "/boot/efi/EFI/BOOT/bootaa64.efi"]
|
|
109
|
+
bootloader_02: ["curtin", "in-target", "--", "cp", "-v", "/boot/efi/EFI/rocky/grubaa64.efi", "/boot/efi/EFI/BOOT/"]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This file needs to be saved on Region Controllers under /var/snap/maas/current/preseeds/curtin_userdata_custom_arm64_generic_rocky9 or /etc/maas/preseeds/curtin_userdata_custom_arm64_generic_rocky9. The last portion of this file must match the image name uploaded in MAAS.
|
|
113
|
+
|
|
114
|
+
## Default username
|
|
115
|
+
|
|
116
|
+
MAAS uses cloud-init to create ```cloud-user``` account using the ssh keys configured for the MAAS admin user (e.g. imported from Launchpad). Log in to the machine:
|
|
117
|
+
|
|
118
|
+
```shell
|
|
119
|
+
ssh -i ~/.ssh/<your_identity_file> cloud-user@<machine-ip-address>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Next to that, the kickstart script creates an account with both username and password set to ```rocky```. Note that the default sshd configuration in Rocky 9 disallows password-based authentication when logging in via ssh, so trying `ssh rocky@<machine-ip-address>` will fail. Password-based authentication can be enabled by having `PasswordAuthentication yes` in /etc/ssh/sshd_config after logging in with ```cloud-user```. Perhaps there is a way to make that change using kickstart script, but it is not obvious as ```anaconda```, the installer, makes its own changes to sshd_config file during installation. If you know how to do this, a PR is welcome.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
url ${KS_OS_REPOS} ${KS_PROXY}
|
|
2
|
+
repo --name="AppStream" ${KS_APPSTREAM_REPOS} ${KS_PROXY}
|
|
3
|
+
repo --name="Extras" ${KS_EXTRAS_REPOS} ${KS_PROXY}
|
|
4
|
+
|
|
5
|
+
eula --agreed
|
|
6
|
+
|
|
7
|
+
# Turn off after installation
|
|
8
|
+
poweroff
|
|
9
|
+
|
|
10
|
+
# Do not start the Inital Setup app
|
|
11
|
+
firstboot --disable
|
|
12
|
+
|
|
13
|
+
# System language, keyboard and timezone
|
|
14
|
+
lang en_US.UTF-8
|
|
15
|
+
keyboard us
|
|
16
|
+
timezone UTC --utc
|
|
17
|
+
|
|
18
|
+
# Set the first NIC to acquire IPv4 address via DHCP
|
|
19
|
+
network --device eth0 --bootproto=dhcp
|
|
20
|
+
# Enable firewal, let SSH through
|
|
21
|
+
firewall --enabled --service=ssh
|
|
22
|
+
# Enable SELinux with default enforcing policy
|
|
23
|
+
selinux --enforcing
|
|
24
|
+
|
|
25
|
+
# Do not set up XX Window System
|
|
26
|
+
skipx
|
|
27
|
+
|
|
28
|
+
# Initial disk setup
|
|
29
|
+
# Use the first paravirtualized disk
|
|
30
|
+
ignoredisk --only-use=vda
|
|
31
|
+
# No need for bootloader
|
|
32
|
+
bootloader --disabled
|
|
33
|
+
# Wipe invalid partition tables
|
|
34
|
+
zerombr
|
|
35
|
+
# Erase all partitions and assign default labels
|
|
36
|
+
clearpart --all --initlabel
|
|
37
|
+
# Initialize the primary root partition with ext4 filesystem
|
|
38
|
+
part / --size=1 --grow --asprimary --fstype=ext4
|
|
39
|
+
|
|
40
|
+
# Set root password
|
|
41
|
+
rootpw --plaintext password
|
|
42
|
+
|
|
43
|
+
# Add a user named packer
|
|
44
|
+
user --groups=wheel --name=rocky --password=rocky --plaintext --gecos="rocky"
|
|
45
|
+
|
|
46
|
+
%post --erroronfail
|
|
47
|
+
# workaround anaconda requirements and clear root password
|
|
48
|
+
passwd -d root
|
|
49
|
+
passwd -l root
|
|
50
|
+
|
|
51
|
+
# Clean up install config not applicable to deployed environments.
|
|
52
|
+
for f in resolv.conf fstab; do
|
|
53
|
+
rm -f /etc/$f
|
|
54
|
+
touch /etc/$f
|
|
55
|
+
chown root:root /etc/$f
|
|
56
|
+
chmod 644 /etc/$f
|
|
57
|
+
done
|
|
58
|
+
|
|
59
|
+
rm -f /etc/sysconfig/network-scripts/ifcfg-[^lo]*
|
|
60
|
+
|
|
61
|
+
# Kickstart copies install boot options. Serial is turned on for logging with
|
|
62
|
+
# Packer which disables console output. Disable it so console output is shown
|
|
63
|
+
# during deployments
|
|
64
|
+
sed -i 's/^GRUB_TERMINAL=.*/GRUB_TERMINAL_OUTPUT="console"/g' /etc/default/grub
|
|
65
|
+
sed -i '/GRUB_SERIAL_COMMAND="serial"/d' /etc/default/grub
|
|
66
|
+
sed -ri 's/(GRUB_CMDLINE_LINUX=".*)\s+console=ttyS0(.*")/\1\2/' /etc/default/grub
|
|
67
|
+
sed -i 's/GRUB_ENABLE_BLSCFG=.*/GRUB_ENABLE_BLSCFG=false/g' /etc/default/grub
|
|
68
|
+
|
|
69
|
+
dnf clean all
|
|
70
|
+
|
|
71
|
+
# Passwordless sudo for the user 'rocky'
|
|
72
|
+
echo "rocky ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/rocky
|
|
73
|
+
chmod 440 /etc/sudoers.d/rocky
|
|
74
|
+
|
|
75
|
+
#---- Optional - Install your SSH key ----
|
|
76
|
+
# mkdir -m0700 /home/rocky/.ssh/
|
|
77
|
+
#
|
|
78
|
+
# cat <<EOF >/home/rocky/.ssh/authorized_keys
|
|
79
|
+
# ssh-rsa <your_public_key_here> you@your.domain
|
|
80
|
+
# EOF
|
|
81
|
+
#
|
|
82
|
+
### set permissions
|
|
83
|
+
# chmod 0600 /home/rocky/.ssh/authorized_keys
|
|
84
|
+
#
|
|
85
|
+
#### fix up selinux context
|
|
86
|
+
# restorecon -R /home/rocky/.ssh/
|
|
87
|
+
|
|
88
|
+
%end
|
|
89
|
+
|
|
90
|
+
%packages --ignoremissing
|
|
91
|
+
@core
|
|
92
|
+
bash-completion
|
|
93
|
+
cloud-init
|
|
94
|
+
cloud-utils-growpart
|
|
95
|
+
rsync
|
|
96
|
+
tar
|
|
97
|
+
patch
|
|
98
|
+
yum-utils
|
|
99
|
+
grub2-pc
|
|
100
|
+
grub2-efi-*
|
|
101
|
+
shim-*
|
|
102
|
+
grub2-efi-*-modules
|
|
103
|
+
efibootmgr
|
|
104
|
+
dosfstools
|
|
105
|
+
lvm2
|
|
106
|
+
mdadm
|
|
107
|
+
device-mapper-multipath
|
|
108
|
+
iscsi-initiator-utils
|
|
109
|
+
-plymouth
|
|
110
|
+
# Remove ALSA firmware
|
|
111
|
+
-a*-firmware
|
|
112
|
+
# Remove Intel wireless firmware
|
|
113
|
+
-i*-firmware
|
|
114
|
+
%end
|