Git Product home page Git Product logo

astralboot's Introduction

#Astral Boot

Simon Kirkby [email protected] 20150304

This repository has been moved to gb format https://getgb.io/ , it’s cool.

Description

Astralboot is a golang server that provides network services to boot virtual and metal machines from pxe boot. The following services are provided

  1. DHCP , for ip allocation and boot information
  2. TFTP , simple file transfer
  3. HTTP , for serving images and configs

It can pull its data files out of ipfs, which means that they are downloaded on request and then stored locally.

Local file serving also works with local file system folders ( see INSTRUCTIONS for details )

Required for development

  1. golang dev environment
  2. running ipfs node
  3. a network under your control.

Warning

As this server has a naive dhcp server it can be dangerous to run in an office environment. Running this server can interfere with normal network services.

Installation

assumes a working golang environment.

git clone github.com/zignig/astralboot

cd astralboot

gb build

also the ipfs service, which is currently in alpha , is available from http://github.com/ipfs/go-ipfs

will need to be installed and running

Setup

Testing so far has been done on a virtual machine with two network interfaces, one on a home network and the other an isolated VM network.

This machine will probably need to have masquerading setup , this is not needed for astral boot , but is for the machines to access the internet.

enable forwarding

echo 1 > /proc/sys/net/ipv4/ip_forward

make it stick

edit /etc/sysctl.conf  and change  net.ipv4.ip_forward = 1

change the firewall

/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

The test machines to be bootstrapped have one network interface attached to isolated VM network.

The default hashes for booting are included in the git repository , put them into place by running.

cp refs.toml.dist refs.toml

It is worth noting that this will need to be run as root , dhcp, tftp and http not running on the machine

Now you are good to go, run the astralboot binary

  1. If the config.toml file does not exists it will ask some questions to set up
  2. It will grab some files from ipfs ( or local file system )and load up the various operating system files.
  3. On the first run it will populate the leases.db file with empty ip addresses.
  4. All the services will start and it will be ready to serve.

Verbosity can be changed by adding -v , -vv and -vvv to the command line.

Now comes the fun bit ....

Running the server

Create a virtual machine that is connected to the isolated network that astralboot is serving on and configure it to PXE boot.

The boot sequence should happen in this order

  1. The new virtual server should ask for an ip address.
  2. Astral boot serves an address with extra information pointing back to the astral bootserver.
  3. A undionly.kpxe image is served to the machine.
  4. it asks again for an ip address ( it will get the same address ).
  5. A menu to select the operating system is presented on the boot line.
  6. Select the OS of you choice ( coreos , or debian at this point ).
  7. It will boot the server.

Debian will be fairly quick , coreos will take some time as the .gz file is 165 Mb , so it will take some time to download

To precache the files into ipfs, run ipfs refs -r HashFromConfigFile and it will download everything

Changing the Services

As the server boots it will show an implied config , this shows possible entries to the config file to change.

Developing boot services, To develop modified boot services it is possible to serve the files from disk rather than ifps Downloading the files can be done with the following ipfs commands

In the astralboot folder :

ipfs get -o=data “hash from the refs.toml file”

If the config has IPFS = false the local file system will be used.

Development

all comments, patches and pull requests welcome

TODO

  1. Better templating of preseed
  2. Add more operating systems
  3. More stuff

astralboot's People

Contributors

zignig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

astralboot's Issues

feature request: proxy DHCP mode

dnsmasq has the proxy DHCP mode for PXE, which can assist an existing DHCP server in providing boot information. This would allow decoupling of IP allocations from this service.

core boot to allwo boot partitin fallback

so that a bad boot does not brick the machine, and to be able to rollback upgrades it would be nice to support dual partitions. This is how ChromeOS and CoreOS works.

It relation to upgrades, even with IPFS, you want to be able to rollback to the last known good partition.

Also you want to be able to do differential deploys, like Chrome and CoreOS do. they diff on the provisionng server and only send what extra you need. The beauty of ipfs is that it just does this based on the hash anyway.

vm Makefile

example makefile to make VM from vbox

vmname="PXE Booter"
iso=/ipfs/QmdTmSQtCz9D6vt2AbvQkYo3edFcTYoU7FDmDD7bPWDccA/ipfs.iso

boot: vm
    VBoxManage startvm $(vmname)

vm:
    VBoxManage list vms | grep $(vmname) || make createvm

createvm:
    # create the vm
    VBoxManage createvm --name $(vmname) --register
    VBoxManage modifyvm $(vmname) --memory 512 --acpi on --boot1 dvd
    VBoxManage modifyvm $(vmname) --nic1 nat --nictype1 82540EM --cableconnected1 on
    VBoxManage modifyvm $(vmname) --ostype Linux

    # add a hdd
    VBoxManage createhd --filename ./disk.vdi --size 10000
    VBoxManage storagectl $(vmname) --name "IDE Controller" --add ide
    VBoxManage storageattach $(vmname) --storagectl "IDE Controller"  \
        --port 0 --device 0 --type hdd --medium ./disk.vdi

    # attach the iso
    VBoxManage storageattach $(vmname) --storagectl "IDE Controller" \
        --port 1 --device 0 --type dvddrive --medium "$(iso)"

I successfully booted the iso from the network by mounting fuse 😄 👍

ipfs daemon & ; sleep 10
ipfs mount
make

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.