Skip to content

Commit

Permalink
Emulate blades using docker containers
Browse files Browse the repository at this point in the history
Fix #37

Each blade is emulated with an ubnutu 14.04 container
running an SSH server. This give the ability to test
some networking features like IP address resolution
and the command API (through SSH)
  • Loading branch information
ggiamarchi committed Sep 14, 2016
1 parent 3aa8f68 commit 260e708
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,58 @@ sleep 5 # Dnsmasq startup can cause temporary network issue during a short time
# Wait to avoid any problem
##################################################################
### Install Docker
##################################################################
curl -s 'https://sks-keyservers.net/pks/lookup?op=get&search=0xee6d536cf7dc86e2d7d56f59a178ac6c6238f52e' | sudo apt-key add --import
echo "deb https://packages.docker.com/1.11/apt/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y --force-yes linux-headers-3.13.0-85-generic \
apt-transport-https \
linux-image-extra-virtual \
docker-engine
sudo usermod -aG docker vagrant
sudo bash -c 'echo "DOCKER_OPTS=\\\"-H unix:// -H tcp://0.0.0.0:2375\\\"" > /etc/default/docker'
sudo service docker restart
##################################################################
### Wait for docker deamon to be ready
##################################################################
set +e
while true ; do
sleep 1
sudo docker info
if [ $? -eq 0 ] ; then
break
fi
done
set -e
##################################################################
### Build Docker image for blade emulation
##################################################################
sudo docker build -t blade:latest /vagrant/dev
##################################################################
### Run four containers to emulate the four blades
##################################################################
for i in 1 2 3 4 ; do
sudo docker run -d --restart=always --name blade${i} blade:latest
done
##################################################################
### Install Apache + System dependencies for python app
##################################################################
Expand Down
12 changes: 12 additions & 0 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:14.04

RUN set -ex && \
apt-get update && \
apt-get install -y --force-yes openssh-server

RUN mkdir /root/.ssh

ADD keys/blade.pub /root/.ssh/authorized_keys

RUN mkdir /var/run/sshd
CMD ["/usr/sbin/sshd", "-D"]
27 changes: 27 additions & 0 deletions dev/keys/blade
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAnMTI+fXVH1XvSa6nLGzYaRfmwpiSrXbs4KT6mLhxpjLDX00t
OGeMKGN9R9mG/yVPE228BrH48TXRHyaQzK7rylp8fD0o+unt6x/o8Kcgo4RWYRwR
RrZSUgUBNv0heE7Zxg+rE5gib17eIKjWBQ4YWFOBnANHP7QJonr5l8ECZvwkPYze
Sax0M5u1fz/8c5vcFx9m1vw+vxkw7Oq7nV7hvNFViDJl5/9oInYs14axZFJPwZbw
cwQGjoBQLEVCk0u178NxviDSWsHC81jC5rHxber2w7iVFGKHqkjBrE9A3HXxAYig
SYLnmYfX9+afEmiCo7PeVvGXWoLrox1qxV61kwIDAQABAoIBAFz8mF0zhOOeXF3v
G7fNJBxKEhVQ3IfJp72j/gSCOt8i8yHfLDhtqwP150Sr8Vf78EiM6V9rR0cD7fO1
M2RFSRTw0S/8MweJpBa4Cbpc145GG9pkBJdV48REtbDBOo4a7y988bOgpKQ8uDLV
EoVTE/uoJJO+mg9eIezfVpa95Efiz2WfHm2ZfGyCXItHYmPQk1U2+vWEnlY/vU6m
mQll7G3UKBBECzrbAIoBfJL2qQxqw94dNXkcxYVyJKynwDgkRiq2BAiuEUym5xz5
NFUsJmJK8Mt99uFjvPWguYK6eYi+k/mUKlGIuDrBH28UuOiKbY9MxxAs/KlQvK7U
ueNkJIkCgYEAz/z3wpKGnPp0RC+lha4l8E01zC8RmxC4QnSGW/T6TfT33CkE3Ll9
9X0HCWgvjcOS4W8bdgytE3/PYSprwcFN9zBWcn8UaXmbJWcfa65zpjX63e8deS0T
oO8YKbMtWkEVXom1h1gD9IKTx+vU4VIQenqIMvU0WJwqmwReMDkQhE8CgYEAwPUC
iIzPVTK/bG1FkLQzPB0w+Ha5rUHmp2w+DD7JjEtmB7jisBb5Vct96Z4QNMazlpf3
SFWVm1RyjfUT010+9bKaPc+dHuLZPJ2qwUcIAxc2T8BI06NT/weLdBr0tYROrKoS
R6S4qQg0vPS49iXzODsD4+6krpw4/ns92dNKdX0CgYEAwX28XNYFx3o0uc59tUya
3OBngQn03gaC9MgEyv2v8uBHyhia/mDObpge+MBlJQRh27mKmZsXVMGdgu59Cuaz
ipf8hE33BlzsWbKDB6Fm06T6OoeeKsIltZ1ZJEodkg5kO+vu5feazli/9MhP5kJ7
NAZUONvnE9xMwqQgn8omtH8CgYBWJ4+gBK82bVhHQ2sCN1OBDc+lwO0azQf9zTjP
IuG/AJNn80dUNI3Tnu5zdx3pUqcxIF1LMNuB5WzYsYrOnx3TepGf86lF9yfkBsoN
TnfnWV/osARUauLARlAf4UFOIus18SIEVyoUXxOdIu/LCBrXCpKsHQvu4tYX2lM9
hTgDyQKBgCZpyzw8RgV91rp51omc75TMJgHtrKD/q43zNx1hwYaQJx1do1tpKvPN
yJ6ZDGPEFOK+7BuAMdI5ZjYSci6N88fKEnuo495FGn8GuMrlUOn15X4O6OTEMrGn
YNarqP2+UXX50/GvsQB2nvrUfBAvRyrto5el00dBlurtiFBs9Hjs
-----END RSA PRIVATE KEY-----
1 change: 1 addition & 0 deletions dev/keys/blade.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCcxMj59dUfVe9JrqcsbNhpF+bCmJKtduzgpPqYuHGmMsNfTS04Z4woY31H2Yb/JU8TbbwGsfjxNdEfJpDMruvKWnx8PSj66e3rH+jwpyCjhFZhHBFGtlJSBQE2/SF4TtnGD6sTmCJvXt4gqNYFDhhYU4GcA0c/tAmievmXwQJm/CQ9jN5JrHQzm7V/P/xzm9wXH2bW/D6/GTDs6rudXuG80VWIMmXn/2gidizXhrFkUk/BlvBzBAaOgFAsRUKTS7Xvw3G+INJawcLzWMLmsfFt6vbDuJUUYoeqSMGsT0DcdfEBiKBJgueZh9f35p8SaIKjs95W8ZdaguujHWrFXrWT vagrant@vagrant-ubuntu-trusty-64

0 comments on commit 260e708

Please sign in to comment.