mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
metal: Update image and example for real hardware
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
FROM busybox:latest
|
||||
FROM alpine:latest
|
||||
MAINTAINER Dalton Hubble <dalton.hubble@coreos.com>
|
||||
ADD bin/server /bin/server
|
||||
|
||||
EXPOSE 8081
|
||||
CMD ./bin/server
|
||||
COPY bin/server /server
|
||||
EXPOSE 8080
|
||||
CMD ["./server"]
|
||||
|
||||
15
Makefile
15
Makefile
@@ -4,24 +4,21 @@
|
||||
build:
|
||||
./build
|
||||
|
||||
docker-build:
|
||||
docker build --rm=true -t dghubble.io/metapxe .
|
||||
build-docker:
|
||||
./docker-build
|
||||
|
||||
aci-build:
|
||||
build-aci:
|
||||
./acifile
|
||||
|
||||
run-docker:
|
||||
docker run -p 8081:8081 -v $(shell echo $$PWD)/static:/static dghubble.io/metapxe:latest
|
||||
docker run -p 8080:8080 --name=bcs -v $(shell echo $$PWD)/static:/static dghubble/bcs:latest
|
||||
|
||||
run-rkt:
|
||||
rkt --insecure-options=image run --no-overlay bin/metapxe-0.0.1-linux-amd64.aci
|
||||
rkt --insecure-options=image run --no-overlay bin/bcs-0.0.1-linux-amd64.aci
|
||||
|
||||
run-pixiecore:
|
||||
docker run -v $(shell echo $$PWD)/static:/static danderson/pixiecore -api http://172.17.0.2:8081/
|
||||
./scripts/pixiecore
|
||||
|
||||
run-dhcp:
|
||||
./scripts/vethdhcp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
40
README.md
40
README.md
@@ -1,34 +1,26 @@
|
||||
|
||||
Boot and cloud config service for PXE, iPXE, and Pixiecore.
|
||||
# Boot Config Service
|
||||
|
||||
Boot config service for PXE, iPXE, and Pixiecore.
|
||||
|
||||
## Validation
|
||||
|
||||
The config service can be validated in scenarios which use PXE, iPXE, or Pixiecore on a libvirt virtual network or on a physical network of bare metal machines.
|
||||
The boot config service can be validated in PXE, iPXE, and Pixiecore scenarios using a libvirt virtual network with VM or bare metal PXE clients.
|
||||
|
||||
### libvirt
|
||||
|
||||
A libvirt virtual network of containers and VMs can be used to validate PXE booting of VM clients in various scenarios (PXE, iPXE, Pixiecore).
|
||||
|
||||
To do this, start the appropriate set of containered services for the scenario, then boot a VM configured to use the PXE boot method.
|
||||
|
||||
Docker starts containers with virtual ethernet connections to the `docker0` bridge
|
||||
An ethernet bridge can be used to connect container services and VM or bare metal boot clients on the same network. Docker starts containers with virtual ethernet connections to the `docker0` bridge
|
||||
|
||||
$ brctl show
|
||||
$ docker network inspect bridge # docker client names the bridge "bridge"
|
||||
|
||||
which uses the default subnet 172.17.0.0/16. It is also possible to create your own network bridge and reconfigure Docker to start containers on that bridge, but that approach is not used here.
|
||||
which uses the default subnet 172.17.0.0/16. Rather than reconfiguring Docker to start containers on a user defined bridge, it is easier to attach VMs and bare metal machines to `docker0`.
|
||||
|
||||
PXE boot client VMs can be started within the same subnet by attaching to the `docker0` bridge.
|
||||
|
||||
Create a VM using the virt-manager UI, select Network Boot with PXE, and for the network selection, choose "Specify Shared Device" with bridge name `docker0`.
|
||||
|
||||
The VM should PXE boot using the boot config determined by the MAC address of the virtual network card which can be inspected in virt-manager.
|
||||
Start the container services specific to the scenario you wish to test, following the sections on PXE, iPXE, and Pixiecore below. Then create a client.
|
||||
|
||||
### iPXE
|
||||
|
||||
#### Pixecore
|
||||
|
||||
Run the config service container.
|
||||
Run the boot config service container.
|
||||
|
||||
make run-docker
|
||||
|
||||
@@ -42,3 +34,19 @@ Finally, run the `vethdhcp` to create a virtual ethernet connection on the `dock
|
||||
|
||||
Create a PXE boot client VM using virt-manager as described above. Let the VM PXE boot using the boot config determined the MAC address to config mapping set in the config service.
|
||||
|
||||
## Clients
|
||||
|
||||
Once boot services are running, create a PXE boot client VM or attach a bare metal machine to your host.
|
||||
|
||||
### VM
|
||||
|
||||
Create a VM using the virt-manager UI, select Network Boot with PXE, and for the network selection, choose "Specify Shared Device" with bridge name `docker0`. The VM should PXE boot using the boot configuration determined by its MAC address, which can be tweaked in virt-manager.
|
||||
|
||||
### Bare Metal
|
||||
|
||||
Link a bare metal machine, which has boot firmware (BIOS) support for PXE, to your host with a network adapter. Get the link and attach it to the bridge.
|
||||
|
||||
ip link show # find new link e.g. enp0s20u2
|
||||
brctl addif docker0 enp0s20u2
|
||||
|
||||
Configure the boot firmware to prefer PXE booting or network booting and restart the machine. It should PXE boot using the boot configuration determined by its MAC address.
|
||||
|
||||
8
acifile
8
acifile
@@ -1,13 +1,13 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
acbuild begin
|
||||
acbuild set-name dghubble.io/metapxe
|
||||
acbuild copy bin/server /bin/server
|
||||
acbuild set-exec /bin/server
|
||||
acbuild set-name dghubble/bcs
|
||||
acbuild copy bin/server /server
|
||||
acbuild set-exec /server
|
||||
acbuild port add www tcp 8080
|
||||
acbuild label add version 0.0.1
|
||||
acbuild label add arch amd64
|
||||
acbuild label add os linux
|
||||
acbuild annotation add authors "Dalton Hubble <dalton.hubble@coreos.com>"
|
||||
acbuild write bin/metapxe-0.0.1-linux-amd64.aci
|
||||
acbuild write bin/bcs-0.0.1-linux-amd64.aci
|
||||
acbuild end
|
||||
3
build
3
build
@@ -3,9 +3,8 @@
|
||||
# allow builds outside the standard GOPATH via symlink
|
||||
export GOPATH=${PWD}/Godeps/_workspace
|
||||
export GOBIN=${PWD}/bin
|
||||
|
||||
mkdir -p $GOPATH/src/github.com/coreos
|
||||
# directory or symlink must be present
|
||||
[ -d $GOPATH/src/github.com/coreos/coreos-baremetal ] || ln -s ${PWD} $GOPATH/src/github.com/coreos/coreos-baremetal
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux go build -o bin/server -ldflags '-w' github.com/coreos/coreos-baremetal/cmd
|
||||
CGO_ENABLED=0 GOOS=linux go build -o bin/server -a -tags netgo -ldflags '-w' github.com/coreos/coreos-baremetal/cmd
|
||||
|
||||
@@ -7,14 +7,14 @@ import (
|
||||
"github.com/coreos/coreos-baremetal/server"
|
||||
)
|
||||
|
||||
const address = ":8081"
|
||||
const address = ":8080"
|
||||
|
||||
func main() {
|
||||
bootConfigProvider := server.NewBootConfigProvider()
|
||||
bootConfigProvider.Add(server.DefaultAddr, server.CoreOSBootConfig)
|
||||
srv := server.NewServer(bootConfigProvider)
|
||||
h := srv.HTTPHandler()
|
||||
log.Printf("Starting coreos-baremetal metadata server")
|
||||
log.Printf("Starting boot config server")
|
||||
err := http.ListenAndServe(address, h)
|
||||
if err != nil {
|
||||
log.Fatal("ListenAndServe: ", err)
|
||||
|
||||
7
docker-build
Executable file
7
docker-build
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
REPO=dghubble/bcs
|
||||
GIT_SHA=$(git rev-parse HEAD)
|
||||
|
||||
docker build -q --rm=true -t $REPO:$GIT_SHA .
|
||||
docker tag -f $REPO:$GIT_SHA $REPO:latest
|
||||
11
docker-push
Executable file
11
docker-push
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
REPO=dghubble/bcs
|
||||
QUAY_REPO=quay.io/dghubble/bcs
|
||||
GIT_SHA=$(git rev-parse HEAD)
|
||||
|
||||
# quay.io
|
||||
docker tag $REPO:$GIT_SHA $QUAY_REPO:latest
|
||||
docker tag $REPO:$GIT_SHA $QUAY_REPO:$GIT_SHA
|
||||
docker push $QUAY_REPO:latest
|
||||
docker push $QUAY_REPO:$GIT_SHA
|
||||
11
scripts/pixiecore
Executable file
11
scripts/pixiecore
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
CONFIG_SERVICE=bcs
|
||||
CONFIG_SERVICE_IP=$(docker inspect --format {{.NetworkSettings.IPAddress}} ${CONFIG_SERVICE})
|
||||
CONFIG_SERVICE_PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' ${CONFIG_SERVICE})
|
||||
|
||||
docker run -v $PWD/static:/static danderson/pixiecore -api http://$CONFIG_SERVICE_IP:$CONFIG_SERVICE_PORT/
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user