Permalink
Browse files

Automatically download and use Kernel and Initramfs of the latest rel…

…ease (#8)
  • Loading branch information...
frzb committed Dec 27, 2018
1 parent b7561ec commit 76685858c2794c5c4c63e51ed3f37cf1d41b621f
@@ -3,12 +3,12 @@ sudo: required
language: c
cache: ccache
env:
RELEASE: 20181223
before_install:
# always quit the build something fails with a non-zero return value
#- set -e
- sudo apt update
- sudo apt install --yes sshpass build-essential pkg-config
- sudo apt install --yes sshpass build-essential pkg-config jq
- export RELEASE=$(curl --silent "https://api.github.com/repos/frzb/coinboot-debirf/tags" | jq -r '.[0].name')
# Update 'dpkg' to get xz support which is needed for the following Bionic package.
- echo $PATH
- which gcc
@@ -19,8 +19,6 @@ before_install:
- sudo dpkg -i /tmp/ovmf_0~20180205.c0d9813c-2_all.deb
- sudo mkdir -p /usr/local/etc/qemu
- echo 'allow all' | sudo tee /usr/local/etc/qemu/bridge.conf
- wget https://github.com/frzb/coinboot-debirf/releases/download/${RELEASE}/coinboot-vmlinuz-4.4.0-139-generic -P ./boot
- wget https://github.com/frzb/coinboot-debirf/releases/download/${RELEASE}/coinboot-initramfs-4.4.0-139-generic -P ./boot
- wget https://download.qemu.org/qemu-3.0.0.tar.xz
- tar xJf qemu-3.0.0.tar.xz
- sudo apt-get build-dep qemu
@@ -30,7 +28,7 @@ before_install:
- sudo make -j4 install
- cd ..
script:
- sudo docker-compose -f docker-compose_travis-ci.yml up -d
- sudo docker-compose -f docker-compose_travis-ci.yml up -d
# This line can be used for debugging Qemu iPXE purposes.
#- sudo qemu-system-x86_64 -m 2048 -smp 2 -serial mon:stdio -curses -boot n -net nic,model=e1000 -net bridge,br=$(ip a|grep 192.168.1.1/24 | grep -oP br-.*)
# Boot with legacy BIOS
@@ -5,7 +5,6 @@

Coinboot is a framework for diskless computing.


Its core features are:

* **Running Diskless**
@@ -31,6 +30,9 @@ Its core features are:
Need to expand your machines with further configuration, software, libraries, proprietary drivers?
By packing them as Coinboot plugin you can use them right after your machines have booted.

This repository contains the Coinboot Server Docker container.
This container includes all services to get Coinboot up and running and boot diskless Coinboot Worker nodes over network.

## Requirements

Docker
@@ -39,17 +41,32 @@ Docker Compose

## Usage

### Preparations
### Quickstart

Clone this repository on the host where you want to execute the Coinboot Docker container.

#### IP address and network

Take care that your Docker host has assigned an IP address matching to the `dhcp-range` specified at `./conf/dnsmasq/coinboot.conf`.
For example the Docker host has assigned `192.168.1.2` then a matching DHCP-range configuration is: `dhcp-range=192.168.1.10,192.168.1.100,6h`.
Also verify that the network adapter you assigned this IP address on your Docker host is connected to the same L2/broadcast domain as the machines you want to boot with Coinboot.

#### Environment variables

Clone this repository one the host where you want to execute the Coinboot Docker container.
You can hand over environment variables to the worker nodes booting with Coinboot.
This way you can keep the configuration of your Coinboot Worker nodes at one point.
Just put these variables in a file in the directory `./conf/environment/`.
These variables are added to `/etc/environment` on the worker nodes during boot and are exported and available for login shells on these nodes.
If these variables are not exported and available, e.g. in Systemd units, just source the file `/etc/environment` to make them available.

#### RootFS and Kernel

The RootFS and Kernel are downloaded autmatically when the Coinboot Server Docker container is started based on the `RELEASE`set at `./conf/environment/default.env`. Out of the box the latest available release is used.

You can **build** your own Coinboot base image using: [coinboot-debirf](https://github.com/frzb/coinboot-debirf).
Or **download** a pre-build daily release at: https://github.com/frzb/coinboot-debirf/releases
These builds are made daily to contain all current packages updates and security fixes.

Put the Coinboot RootFS (`*initramfs*`) and Kernel (`*vmlinuz*`) you want to use into the directory `./boot`.
The RootFS (`*initramfs*`) and Kernel (`*vmlinuz*`) you want to use are to be placed in the directory `./boot`.

#### Plugins

@@ -84,19 +101,18 @@ Just put these variables in a file in the directory `./conf/environment/`.
These varibales are added to `/etc/environment` on your machines and are exported and available for login shells.
If these variables are no exported and available, e.g. in Systemd units, just source the file `/etc/environment` to make them available.

### Start the Coinboot container
### Start the Coinboot Server Docker container

Just bring the Coinboot Docker container up with `docker-compose`.
Just bring the Coinboot Server Docker container up with `docker-compose`.

```
$ docker-compose up -d
```

### Boot your machines with Coinboot
### Boot your worker nodes with Coinboot

Start your machines.
They are booting over network.
You can login to your machines over `ssh`.
Start your worker nodes.
After they have booted Coinboot over network you can login to your machines over `ssh`.
Default credentials are:

* login: `ubuntu`
@@ -116,7 +132,7 @@ $ docker-compose logs -f
## Test and development environment

There is Vagrant environment for developing purposes.
It consists of two Vagrant machines: One with the the Coinboot Docker container and one acting as client, which boots over PXE.
It consists of two Vagrant machines: One with the the Coinboot Server Docker container and one machine acting as worker node, which boots over PXE.

To spin up the Vagrant machines execute:

@@ -42,7 +42,7 @@ Vagrant.configure(2) do |config|
vb.customize ["modifyvm", :id, "--memory", 2048]
end

config.vm.define "client" do |machine|
config.vm.define "worker" do |machine|
# machine.vm.box = "bento/ubuntu-16.04"
# FIXME: Built own empty Vagrantbox
machine.vm.box = "c33s/empty"
@@ -1,5 +1,6 @@
# These environment variables are just for demonstration.
# Replace them with your own one.
RELEASE=latest
PURPOSE=test
COMPANY=ACME
ETHEREUM_ADDRESS=<add your Ethtereum ID here>
@@ -3,6 +3,8 @@ version: '3'
services:
coinboot:
container_name: coinboot
env_file:
- ./conf/environment/default.env
build: ./docker/
volumes:
- ./conf/dnsmasq:/etc/dnsmasq.d
@@ -12,6 +12,8 @@ networks:
services:
coinboot:
container_name: coinboot
env_file:
- ./conf/environment/default.env
build: ./docker/
volumes:
- ./conf/dnsmasq:/etc/dnsmasq.d
@@ -1,7 +1,7 @@
FROM alpine:3.8

#TODO add syslinux/pxelinux files
RUN apk --no-cache add nginx supervisor dnsmasq
RUN apk --no-cache add nginx supervisor dnsmasq jq curl

RUN mkdir -p /run/nginx /var/lib/tftpboot \
etc/dnsmasq.d /etc/supervisor /srv/plugins /opt/ipxe \
@@ -13,6 +13,7 @@ RUN mkdir -p /run/nginx /var/lib/tftpboot \
COPY ./dnsmasq/dnsmasq.conf /etc/dnsmasq.conf
COPY ./nginx /etc/nginx/conf.d
COPY ./supervisor /etc/supervisor
COPY ./coinboot-download-helper /usr/local/bin/coinboot-download-helper

CMD /usr/bin/supervisord -c /etc/supervisor/coinboot.ini

@@ -0,0 +1,45 @@
#!/bin/sh -e

# Copyright (C) 2018 Gunter Miegel coinboot.io
#
# This file is part of Coinboot.
#
# Coinboot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

BOOTDIR=/var/lib/tftpboot
# RELEASE is set via an environment variable under ./conf/environment
# If the value is 'latest' we determine the latest release, else we use the set value.
if [ $RELEASE = latest ]; then
RELEASE=$(curl --silent "https://api.github.com/repos/frzb/coinboot-debirf/tags" | jq -r '.[0].name')
echo "Using latest release: $RELEASE"
fi
URL=https://github.com/frzb/coinboot-debirf/releases/download/${RELEASE}
VMLINUZ=coinboot-vmlinuz-4.4.0-139-generic
INITRAMFS=coinboot-initramfs-4.4.0-139-generic

if ! [ -f $BOOTDIR/$VMLINUZ ]; then
wget $URL/$VMLINUZ -P $BOOTDIR
fi

if ! [ -f $BOOTDIR/$INITRAMFS ]; then
wget $URL/$INITRAMFS -P $BOOTDIR
fi

if ! [ -e $BOOTDIR/vmlinuz ]; then
ln -sfv $BOOTDIR/$VMLINUZ $BOOTDIR/vmlinuz
fi

if ! [ -e $BOOTDIR/initramfs ]; then
ln -sfv $BOOTDIR/$INITRAMFS $BOOTDIR/initramfs
fi
@@ -1,6 +1,17 @@
[supervisord]
nodaemon=true

[program:coinboot-download-helper]
command=/usr/local/bin/coinboot-download-helper
stdout_logfile=/dev/stdout
# Disable log rotation
stdout_logfile_maxbytes=0
stdout_events_enabled=true
stderr_events_enabled=true
redirect_stderr=true
username=root
autorestart=false

[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
stdout_logfile=/dev/stdout

0 comments on commit 7668585

Please sign in to comment.