This assumes you have a machine available, created with Docker Machine and VirtualBox
Go into each folder with the Dockerfile and create the image. ie cd on-tftp
.
Create the image with the tag:
docker build -t rackhd/on-tftp .
docker build -t rackhd/on-syslog .
docker build -t rackhd/on-http .
docker build -t rackhd/on-dhcp-proxy .
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
- 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
- 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"}));'
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
Will figure this out later
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
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
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
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 &
- This script is located in the
on-dhcp-proxy
folder
./on-dhcp-docker.sh