Skip to content

Commit b05e8b9

Browse files
authored
Merge pull request #12 from KarmaComputing/multiple-lom-systems-bootstrap
Catch up main with bootstrapping branch
2 parents 1aa6379 + 00b4cab commit b05e8b9

File tree

15 files changed

+164
-52
lines changed

15 files changed

+164
-52
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
www
2-
key
1+
key*
2+
deploy/serve/www/*
3+
!deploy/serve/www/bootfile

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ URL=https://192.168.0.230 USERNAME=Administrator PASSWORD=A0F7HKUU VALIDCERT=fal
1414

1515
## How to Use This
1616

17-
1. Building (NOTE: Ensure you are running the scripts from the `deploy/scripts` directory as they use relative paths)
17+
1. Building
1818
- Building ipxe.iso image
1919
- Use new/existing iPXE config file in `deploy/build/ipxe/scripts`
2020
- Input its name as FILE variable in `deploy/scripts/build-ipxe-iso.sh`

compose.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
services:
22
controller:
3-
build: ./internal/controller
4-
ports:
5-
- 8081:8080
3+
build: ./internal/runner
4+
# ports:
5+
# - 8081:8080
6+
volumes:
7+
- ./deploy/ssh/key:/app/key:z
8+
- ./deploy/ansible:/app/ansible:z
9+
environment:
10+
- LC_ALL=en_US.UTF-8
11+
- USERNAME=Administrator
12+
- PASSWORD=A0F7HKUU
13+
- URL=https://192.168.0.230
14+
- VALIDCERT=false
15+
- WIPEINTERVAL=300
616
apache:
717
build: ./deploy/serve
818
volumes:

deploy/ansible/playbook.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
- name: Test
3+
hosts: all
4+
gather_facts: false
5+
6+
tasks:
7+
- name: Install python
8+
raw: test -e /usr/bin/python3 || apk add --no-cache python3
9+
10+
- name: Gather facts
11+
setup:
12+
vars:
13+
ansible_python_interpreter: /usr/bin/python3

deploy/ansible/scripts/hello.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
echo "Running script!"

deploy/build/ipxe/Containerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ WORKDIR /build
1616
RUN git clone https://github.com/ipxe/ipxe.git
1717
WORKDIR /build/ipxe/src
1818

19-
CMD make -j${ISO_MAKE_THREADS} bin/ipxe.iso EMBED=/input/${FILE} && mv bin/ipxe.iso /output/ipxe.iso
19+
RUN sed -i 's$//#define PING_CMD$#define PING_CMD$g' config/general.h &&\
20+
sed -i 's$//#define NET_PROTO_IPV6$#define NET_PROTO_IPV6$g' config/general.h &&\
21+
sed -i 's/undef.*DOWNLOAD_PROTO_HTTPS/define DOWNLOAD_PROTO_HTTPS/g' config/general.h
22+
23+
CMD make -j${ISO_MAKE_THREADS} bin/ipxe.iso EMBED=/input/${FILE} \
24+
&& mv bin/ipxe.iso /output/ipxe.iso
Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,8 @@
11
#!ipxe
22

3-
# The iPXE script below is based on:
4-
# https://boot.alpinelinux.org/boot.ipxe
3+
echo Setting temporary DHCP address to chain into bootfile
4+
dhcp
55

6-
ifopen
7-
ifstat
8-
set net0/ip:ipv4 192.168.0.231
9-
set net0/netmask:ipv4 255.255.255.0
10-
set net0/gateway:ipv4 192.168.0.1
11-
set net0/dns:ipv4 192.168.0.1
12-
ifopen net0
13-
14-
set serverip 192.168.0.170
15-
16-
set console console=tty0
17-
set cmdline modules=loop,squashfs nomodeset
18-
set branch v3.20
19-
set flavor lts
20-
set arch x86_64
21-
set img-url http://${serverip}/iso/alpine-netboot/boot
22-
set modloop-url ${img-url}/modloop-${flavor}
23-
24-
imgfree
25-
kernel ${img-url}/vmlinuz-${flavor} ${cmdline} init=/sbin/init ${console} modloop=${modloop-url} ip=192.168.0.231
26-
initrd ${img-url}/initramfs-${flavor}
27-
boot
6+
set chain-url http://192.168.0.160:8080/bootfile
7+
echo Chaining to ${chain_url}
8+
chain ${chain-url}?uuid=${uuid}

deploy/build/ipxe/scripts/vm-test.ipxe

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# The iPXE script below is based on:
44
# https://boot.alpinelinux.org/boot.ipxe
55

6-
#!ipxe
7-
86
dhcp
97

108
set console console=tty0

deploy/scripts/build-alpine.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
cd "$(dirname "$0")"
23

34
PODMAN_IMAGE_NAME="alpine_builder"
45
WWW_DIR="../serve/www/iso/alpine-netboot"
@@ -8,7 +9,7 @@ echo "--- Creating directory at ${WWW_DIR} ---"
89
mkdir -p ${WWW_DIR}
910

1011
echo "--- Building ${PODMAN_IMAGE_NAME} ---"
11-
podman build --no-cache --tag ${PODMAN_IMAGE_NAME} ${BUILD_DIR}
12+
podman build --tag ${PODMAN_IMAGE_NAME} ${BUILD_DIR}
1213

1314
echo "--- Running ${PODMAN_IMAGE_NAME} ---"
1415
podman run --rm -v ${WWW_DIR}:/output:z \

deploy/scripts/build-ipxe-iso.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,39 @@
11
#!/bin/bash
2+
cd "$(dirname "$0")"
23

3-
FILE="vm-test.ipxe"
4+
FILE="alpinebooter.ipxe"
45

56
WWW_DIR="../serve/www"
67
BUILD_DIR="../build/ipxe"
78
PODMAN_IMAGE_NAME="ipxe_builder"
9+
SSH_KEY_DIR="../ssh"
810
ISO_MAKE_THREADS=16
911

1012
echo "--- Creating serve directory at ${WWW_DIR} ---"
1113
mkdir -p ${WWW_DIR}
1214

13-
echo "--- Generating new SSH key pair ---"
14-
ssh-keygen -t rsa -f ../build/key -N ""
15+
echo "--- Creating ssh key directory at ${SSH_KEY_DIR} ---"
16+
mkdir -p ${SSH_KEY_DIR}
17+
18+
echo "--- Generating new SSH key pair in ${SSH_KEY_DIR} ---"
19+
ssh-keygen -t rsa -f ${SSH_KEY_DIR}/key -N ""
1520

1621
echo "--- Copying public SSH key to ${WWW_DIR} ---"
1722
mkdir -p ${WWW_DIR}/ssh
18-
mv -f ../build/key.pub ${WWW_DIR}/ssh/key.pub
23+
mv -f ${SSH_KEY_DIR}/key.pub ${WWW_DIR}/ssh/key.pub
1924

2025
echo "--- Setting correct permissions for private key ---"
21-
chmod 600 ../build/key
26+
chmod 600 ${SSH_KEY_DIR}/key
27+
28+
# echo "--- Building ${PODMAN_IMAGE_NAME} ---"
29+
# podman build \
30+
# --tag ${PODMAN_IMAGE_NAME} \
31+
# ${BUILD_DIR}
2232

23-
echo "--- Building ${PODMAN_IMAGE_NAME} ---"
24-
podman build \
25-
--tag ${PODMAN_IMAGE_NAME} \
26-
--no-cache \
27-
${BUILD_DIR}
33+
if [ $? -neq 0 ]; then
34+
echo "!!! BUILD FAILED, EXITING !!!"
35+
exit
36+
fi
2837

2938
echo "--- Building ipxe.iso with ${FILE} embedded, writing to ${WWW_DIR} (using ${ISO_MAKE_THREADS} threads) ---"
3039
podman run \

0 commit comments

Comments
 (0)