Skip to content

Instantly share code, notes, and snippets.

@kacole2
Last active December 29, 2015 07:12
Show Gist options
  • Save kacole2/04e5c70c65e40506a9c9 to your computer and use it in GitHub Desktop.
Save kacole2/04e5c70c65e40506a9c9 to your computer and use it in GitHub Desktop.
RackHD Docker Installation WIP

RackHD Docker Installation WIP

This assumes you have a machine available, created with Docker Machine and VirtualBox

Create the docker images

Go into each folder with the Dockerfile and create the image. ie cd on-tftp.

Create the image with the tag:

  1. docker build -t rackhd/on-tftp .
  2. docker build -t rackhd/on-syslog .
  3. docker build -t rackhd/on-http .
  4. docker build -t rackhd/on-dhcp-proxy .

Network:

Create a private bridged network on the VirtualBox VM. This will eventually work with overlay networks if configured properly.

docker network create --driver bridge rackhd_nw

Mongo:

  1. Create the MongoDB Container. Since it's on the rackhd_nw no port needs to be exposed. If going outside this network, add -p 27017:27017:
docker run -d --name on-mongo --restart=always --net=rackhd_nw mongo
  1. Insert the first table into MongoDB so the database is ready
docker exec on-mongo mongo --eval 'printjson(db.getSiblingDB("rackhd").firsttest.insert({"name":"its rackhd time"}));'

RabbitMQ:

Create the RabbitMQ Container. Since it's on the rackhd_nw no port needs to be exposed. If going outside this network, add -p 5672:5672:

docker run -d --name on-rabbitmq --restart=always --net=rackhd_nw --hostname on-rabbitmq  rabbitmq:3

StatsD:

Will figure this out later

On-Syslog:

Start the On-Syslog container

docker run -d --name on-syslog --restart=always --net=rackhd_nw -p 514:514 -e "amqp=amqp://on-rabbitmq" -e "mongo=mongodb://on-mongo/rackhd" rackhd/on-syslog

On-TFTP:

Start the On-TFTP container

docker run -d --name on-tftp --restart=always --net=rackhd_nw -p 69:69 -e "amqp=amqp://on-rabbitmq" -e "mongo=mongodb://on-mongo/rackhd" rackhd/on-tftp

On-HTTP:

Start the On-HTTP container

docker run -d --name on-http --restart=always --net=rackhd_nw -p 80:80 -p 443:443 -e "amqp=amqp://on-rabbitmq" -e "mongo=mongodb://on-mongo/rackhd" rackhd/on-http

On-DHCP-Proxy & On-Taskgraph (Manual):

This process is required since --net=host is used on the container. DHCP will not work by exposing ports alone. This process gets the output of /etc/hosts from on-http and puts those IP/DNS matches into /etc/hosts of the on-dhcp-proxy container. Be sure to remove DHCP service from the VirtualBox network by going into Preferences. A VM on that network (Assuming it's on 192.168.99.0/24) will receive a DHCP address, but PXE booting is not currently working.

ONRACKSERVICES=$(docker exec on-http sed '1,/ip6-allrouters/d' /etc/hosts)
docker run -dti --entrypoint="/bin/bash" --name on-dhcp-proxy --restart=always --net=host -p 67:67 -p 67:67/udp -p 68:68 -p 69:69 -p 4011:4011 -e "amqp=amqp://on-rabbitmq" -e "mongo=mongodb://on-mongo/rackhd" -e "dhcpGateway=on-tftp" rackhd/on-dhcp-proxy
docker exec on-dhcp-proxy /bin/sh -c "echo \"$ONRACKSERVICES\" >> /etc/hosts"
docker exec -d on-http mkdir -p /usr/src/on-http/static/files/coreos
docker exec -d on-http wget --continue http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz -O /usr/src/on-http/static/files/coreos/coreos_production_pxe_image.cpio.gz
docker exec -d on-http wget --continue http://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz -O /usr/src/on-http/static/files/coreos/coreos_production_pxe.vmlinuz

7.(you are now in the container)

docker attach on-dhcp-proxy

8.(can't tell if this gets started during Docker Run or not)

dhcpd &

9.(start the service)

node /usr/src/on-dhcp-proxy/index.js &

10.(start the service)

node /usr/src/on-taskgraph/index.js &

On-DHCP-Proxy & On-Taskgraph (Automated but not working):

  1. This script is located in the on-dhcp-proxy folder
./on-dhcp-docker.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment