Skip to content

Commit

Permalink
update docs and examples w/ new OCI functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
jeefy committed Dec 21, 2023
1 parent ca770cb commit 1f72465
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 22 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Booty

A simple (i)PXE Server for booting Flatcar-Linux and CoreOS
A simple (i)PXE Server for booting Flatcar-Linux, CoreOS, and [Universal Blue](https://universal-blue.org)

```
> booty --help
Easy iPXE server for Flatcar
Easy iPXE server for Flatcar, CoreOS, and more
Usage:
booty [flags]
Expand Down Expand Up @@ -37,8 +37,9 @@ Flags:
* Web UI to add/edit/remove hosts
* Unrecognized MAC addresses go into the brig (boot loop till the MAC is registered)
* Support for different operating systems and ignition files per machine
* **EXPERIMENTAL**: Support for per-ostree images per machine (in conjunction with ignition rebase scripts)

* **EXPERIMENTAL**: Support for per-ostree images per machine (in conjunction with [ignition rebase scripts](examples/bazzite.but))
* Auto-caches OCI images used for hosts (and has a page listing cached artifacts)
* When "Install" is set to Y, it will auto-flip to N when iPXE file is grabbed the first time

## Examples

Expand All @@ -55,6 +56,8 @@ ghcr.io/jeefy/booty:main \
--joinString="kubeadm join 192.168.1.10:6443 --token ${TOKEN} --discovery-token-ca-cert-hash sha256:${SHA_HASH}
--serverIP=192.168.1.10
--serverHttpPort=8080
--flatcarChannel=beta
--coreOSChannel=testing
```

### Kubernetes
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

var Cmd = &cobra.Command{
Use: "booty",
Long: "Easy iPXE server for Flatcar",
Long: "Easy iPXE server for Flatcar, CoreOS, and more",
RunE: run,
}

Expand Down
79 changes: 79 additions & 0 deletions examples/bazzite.but
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
variant: flatcar
version: 1.1.0

passwd:
users:
- name: core
ssh_authorized_keys:
- SSH Pub Key go brrrr
- name: gamer
password_hash: Generate your own password here and paste it here
home_dir: /home/gamer
groups:
- wheel
shell: /bin/bash

systemd:
units:
- enabled: true
name: update-registry-config.service
contents: |
[Unit]
Description=Add Booty registry endpoint to /etc/containers/registries.conf
After=network-online.target
ConditionPathExists=!/root/.postRegistryConfig

[Service]
type=oneshot
ExecStartPre=/usr/bin/bash -c 'echo "[[registry]]" >> /etc/containers/registries.conf'
ExecStartPre=/usr/bin/bash -c 'echo "location = \"\\\"{{ .ServerIP }}\\\"\"" >> /etc/containers/registries.conf'
ExecStartPre=/usr/bin/bash -c 'echo "insecure = true" >> /etc/containers/registries.conf'
ExecStart=touch /root/.postRegistryConfig

[Install]
WantedBy=multi-user.target
- enabled: true
name: rebase-custom.service
contents: |
[Unit]
Description=Fetch and deploy target image
# Only run on the firstboot
After=network-online.target
ConditionPathExists=!/root/.postRebase
ConditionPathExists=/root/.postRegistryConfig

[Service]
# This ordering is important
Type=oneshot
RemainAfterExit=yes
ExecStartPre=sleep 10
ExecStartPre=mount /dev/disk/by-label/boot /boot

ExecStart=rpm-ostree rebase ostree-unverified-registry:{{ .OSTreeImage }}

ExecStartPost=touch /root/postRebase
ExecStartPost=systemctl reboot

[Install]
WantedBy=multi-user.target
# This is assuming we're using `bazzite-nvidia` images
- enabled: true
name: ensure-nvidia-kmod.service
contents: |
[Unit]
Description=Install things we like
# Only run on the second boot
After=rebase-custom.service
ConditionPathExists=!/root/.postRebaseNvidia

[Service]
# This ordering is important
After=ignition-firstboot-complete.service
Type=oneshot
RemainAfterExit=yes
ExecStart=rpm-ostree kargs --append=rd.driver.blacklist=nouveau --append=modprobe.blacklist=nouveau --append=nvidia-drm.modeset=1
ExecStartPost=touch /root/.postRebaseNvidia
ExecStartPost=systemctl reboot

[Install]
WantedBy=multi-user.target
43 changes: 26 additions & 17 deletions examples/k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,28 +215,37 @@ spec:
app: booty
spec:
containers:
- name: booty
imagePullPolicy: Always
- args:
- --dataDir
- /data
- --serverIP
- YOUR IP ADDRESS HERE
- --httpPort
- "80"
- --debug
- --joinString
- YOUR JOIN STRING HERE
- --flatcarChannel
- beta
- --coreOSChannel
- testing
image: ghcr.io/jeefy/booty:main
args:
- "--dataDir"
- "/data"
- "--joinString"
- "kubeadm join 192.168.1.10:6443 --token LOLNOPE --discovery-token-ca-cert-hash sha256:LOLNOPE" # This should be the IP of your K8s Control Plane
- "--serverIP"
- "192.168.50.20" # This should be the IP of the service your hosts can connect to
imagePullPolicy: Always
name: booty
ports:
- containerPort: 69
- containerPort: 8080
volumeMounts:
- name: booty-data
mountPath: /data/
- name: booty-config
mountPath: /data/config/
hostPort: 69
protocol: TCP
- containerPort: 80
hostPort: 80
protocol: TCP
resources:
limits:
cpu: "500m" # This could probably be tuned lower
memory: "512Mi" # This could probably be tuned lower
cpu: "1"
memory: 2Gi
requests:
cpu: 500m
memory: 1Gi
volumes:
- name: booty-config
configMap:
Expand Down
49 changes: 49 additions & 0 deletions examples/ublue.ipxe
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!ipxe

echo Hello from Booty!

set menu-timeout 5000

###################### MAIN MENU ####################################

:start
menu iPXE boot menu for Booty
item --gap -- ------------------------- Booty ------------------------------
item --key i install Install ublue
item --key d run-from-disk Boot from Disk
item shell Drop to iPXE shell
item reboot Reboot computer
item
item --key x exit Exit iPXE and continue BIOS boot
choose --timeout ${menu-timeout} --default ${menu-default} selected || goto cancel
set menu-timeout 0
goto ${selected}

#######

:shell
echo Type 'exit' to get the back to the menu
shell
set menu-timeout 0
set submenu-timeout 0
goto start

:failed
echo Booting failed, dropping to shell
goto shell

:reboot
reboot

:exit
exit

:install
kernel ${BASEURL}/fedora-coreos-${VERSION}-live-kernel-x86_64 initrd=main coreos.inst.install_dev=/dev/sda coreos.live.rootfs_url=${BASEURL}/fedora-coreos-${VERSION}-live-rootfs.x86_64.img ignition.firstboot ignition.platform.id=metal ignition.firstboot=1 coreos.inst.ignition_url=${CONFIGURL}
initrd --name main ${BASEURL}/fedora-coreos-${VERSION}-live-initramfs.x86_64.img
boot || goto failed
goto start

:run-from-disk
sanboot --no-describe --drive 0x80 || goto failed
goto start

0 comments on commit 1f72465

Please sign in to comment.