netboot/pixiecore
Mathias Kaufmann 574ee88ab1 Switch naming of FirmwareEFIBC/FirmwareEFI64
Signed-off-by: Mathias Kaufmann <me@stei.gr>
2017-01-23 00:40:58 -08:00
..
api-example pixiecore/api-example: unexport the HTTP handler function. 2016-08-15 00:46:11 -07:00
cli Switch naming of FirmwareEFIBC/FirmwareEFI64 2017-01-23 00:40:58 -08:00
ui pixiecore: Add a basic HTTP status UI. 2016-09-19 03:43:57 -07:00
boot.ipxe pixiecore: Add a retry loop in the iPXE boot. 2016-08-14 16:55:27 -07:00
booters_test.go pixiecore: set Content-Length when serving the kernel/initrd. 2016-09-14 20:54:04 -07:00
booters.go pixiecore: return file size on apibooter version of ReadBootFile (#14) 2016-10-01 14:20:58 -07:00
bootgraph.dot pixiecore: flesh out the boot graph. 2016-09-18 16:23:46 -07:00
bootgraph.svg pixiecore: flesh out the boot graph. 2016-09-18 16:23:46 -07:00
dhcp_server.go pixiecore: checkpoint early bits of a full DHCP server. 2016-08-16 13:49:17 -07:00
dhcp.go pixiecore: Add a basic HTTP status UI. 2016-09-19 03:43:57 -07:00
http_test.go pixiecore: Add a basic HTTP status UI. 2016-09-19 03:43:57 -07:00
http.go Add missing param 'name' to log entry text (#12) 2016-09-22 21:24:17 -07:00
logging.go pixiecore: Add a basic HTTP status UI. 2016-09-19 03:43:57 -07:00
pixiecore-ui.png pixiecore: shrink the screenshot again. 2016-09-19 03:49:56 -07:00
pixiecore.go Switch naming of FirmwareEFIBC/FirmwareEFI64 2017-01-23 00:40:58 -08:00
pxe.go pixiecore: Add a basic HTTP status UI. 2016-09-19 03:43:57 -07:00
README.api.md Update notes on Example API server 2016-09-04 09:44:12 +02:00
README.booting.md pixiecore: github doesn't correctly serve SVGs. Are you kidding me? 2016-08-24 02:12:35 -07:00
README.ipv6.md pixiecore: note the problem with using ULAs for v6 addressing. 2017-01-20 00:21:26 -08:00
README.md Document the ACI container image as well as the docker image. 2017-01-05 02:51:41 -08:00
tftp.go pixiecore: Add a basic HTTP status UI. 2016-09-19 03:43:57 -07:00
ui.go pixiecore: fix import mangled by goimports. 2016-09-19 03:56:42 -07:00
urlsign_test.go pixiecore: factor out URL signing/decoding, and unit test it. 2016-08-14 21:46:12 -07:00
urlsign.go pixiecore: factor out URL signing/decoding, and unit test it. 2016-08-14 21:46:12 -07:00

Pixiecore

Pixiecore is an all-in-one tool to manage network booting of machines. It can be used either as a simple tool for ad-hoc network boots, or as a building block of machine management infrastructure.

license Travis api cli cli

Pixiecore UI

Why?

Booting a Linux system over the network is quite tedious. You have to set up a TFTP server, reconfigure your DHCP server to recognize PXE clients, and send them the right set of magical options to get them to boot, often fighting rubbish PXE ROM implementations.

Pixiecore aims to simplify this process, by packing the whole process into a single binary that can cooperate with your network's existing DHCP server. You don't need to reconfigure anything else in the network.

If you're curious about the whole process that Pixiecore manages, you can read the details in README.booting.

Installation

Install Pixiecore via go get:

go get go.universe.tf/netboot/cmd/pixiecore

Pixiecore is also available in other formats:

Using Pixiecore in static mode ("I just want to boot a machine")

Run the pixiecore binary, passing it a kernel and initrd, and optionally some extra kernel commandline arguments. For example, here's how you make all machines in your network netboot into the alpha release of CoreOS, with automatic login:

sudo pixiecore boot \
  https://alpha.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz \
  https://alpha.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz \
  --cmdline='coreos.autologin'

That's it! Any machine that tries to boot from the network will now boot into CoreOS.

That's a bit slow to boot, because Pixiecore is refetching the images from core-os.net each time a machine tries to boot. We can also download the files and use those:

wget https://alpha.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz
wget https://alpha.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz
sudo pixiecore boot \
  coreos_production_pxe.vmlinuz \
  coreos_production_pxe_image.cpio.gz \
  --cmdline='coreos.autologin'

Sometimes, you want to give extra files to the booting OS. For example, CoreOS lets you pass a Cloud Init file via the cloud-config-url kernel commandline parameter. That's fine if you have a URL, but what if you have a local file?

For this, Pixiecore lets you specify that you want an additional file served over HTTP to the booting OS, via a template function. Let's grab a cloud-config.yml that sets the hostname to pixiecore-test, and serve it:

wget -O my-cloud-config.yml https://goo.gl/7HzZf2
sudo pixiecore boot \
  coreos_production_pxe.vmlinuz \
  coreos_production_pxe_image.cpio.gz \
  --cmdline='coreos.autologin cloud-config-url={{ ID "./my-cloud-config.yml" }}'

Pixiecore will transform the template invocation into a URL that, when fetched, serves my-cloud-config.yml. Similarly to the kernel and initrd arguments, you can also pass a URL to the ID template function.

Pixiecore in API mode

Think of Pixiecore in API mode as a "PXE to HTTP" translator. Whenever Pixiecore sees a machine trying to netboot, it will ask a remote HTTP API (which you implement) what to do. The API server can tell Pixiecore to ignore the machine, or tell it to boot into a given kernel/initrd/commandline.

Effectively, Pixiecore in API mode lets you pretend that your machines speak a simple JSON protocol when trying to netboot. This makes it far easier to play with netbooting in your own software.

To start Pixiecore in API mode, pass it the URL of your API endpoint:

sudo pixiecore api https://foo.example/pixiecore

The endpoint you provide must implement the Pixiecore boot API, as described in the API spec.

You can find a sample API server implementation in the api-example subdirectory. The code is not production-grade, but gives a short illustration of how the protocol works by reimplementing a subset of Pixiecore's static mode as an API server.

Running in containers

Pixiecore is available both as an ACI image for rkt, and as a Docker image for Docker Engine. Both images are automatically built whenever the github repository changes.

Because Pixiecore needs to listen for DHCP traffic, it has to run with access to the host's networking stack. Both Rkt and Docker do this with the --net=host commandline flag.

sudo rkt run --net=host \
  --volume images,kind=host,source=/var/images \
  --mount volume=images,target=/image \
  quay.io/pixiecore/pixiecore -- \
    boot /image/coreos_production_pxe.vmlinuz /image/coreos_production_pxe_image.cpio.gz

sudo docker run \
  --net=host \
  -v .:/image \
  danderson/pixiecore \
    boot /image/coreos_production_pxe.vmlinuz /image/coreos_production_pxe_image.cpio.gz