scripts/docker: Added docker.io scripts to bootstrap a fail demo

The docker files provide containers with the full toolchain required to
build FAIL*. They also contain a demonstration FI campaign.

Change-Id: I280210eb0487718e82505f0343fa9303c21b8048
This commit is contained in:
Christian Dietrich
2014-10-22 14:29:07 +02:00
parent c00268242a
commit 6ab55a8359
7 changed files with 160 additions and 3 deletions

19
scripts/docker/Makefile Normal file
View File

@ -0,0 +1,19 @@
all:
docker build -t danceos/fail-base fail-base
docker build -t danceos/fail-generic-tracing fail-generic-tracing
docker build -t danceos/fail-demo fail-demo
run-fail-db:
docker run --name fail-db \
-e MYSQL_ROOT_PASSWORD=fail \
-e MYSQL_USER=fail \
-e MYSQL_PASSWORD=fail \
-e MYSQL_DATABASE=fail \
-d mysql
run-fail-demo:
docker run --name fail-demo -p 127.0.0.1:5000:5000 --link fail-db:mysql -d danceos/fail-demo
ssh-fail-demo:
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no fail@$$(docker inspect --format "{{ .NetworkSettings.IPAddress }}" fail-demo)

View File

@ -0,0 +1,59 @@
# Set the base image to Ubuntu Utopic (14.10)
FROM ubuntu:utopic
MAINTAINER Christian Dietrich <stettberger@dokucode.de>
# Install Packages required to build FAIL*
RUN apt-get update
RUN apt-get install -y \
binutils-dev \
build-essential \
cmake \
git \
libboost-regex-dev \
libboost-system-dev \
libboost-thread-dev \
libdwarf-dev \
libelf-dev \
libfontconfig1-dev \
libiberty-dev \
libmysqlclient-dev \
libpcl1-dev \
libprotobuf-dev \
libsvga1-dev \
llvm-3.4-dev \
screen \
protobuf-compiler \
wget \
openssh-server \
vim \
zlib1g-dev
# Add a user for compiling FAIL*
RUN useradd fail; mkdir /home/fail; chown fail /home/fail
RUN echo 'fail:fail' | chpasswd; chsh fail --shell /bin/bash
RUN adduser fail sudo
# SSH login fix. Otherwise user is kicked off after login
RUN mkdir /var/run/sshd
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
USER fail
ENV HOME /home/fail
WORKDIR /home/fail
# Get the latest version of AspectC++ for 64 Bit
RUN wget http://aspectc.org:8080/job/Build_Binaries/Platform=linux_x86_64/lastBuild/artifact/binaries.tar.bz2
RUN tar xvjf binaries.tar.bz2; mv AspectC++/bin/linux-release bin; rm -rf 'AspectC++'
ENV PATH /home/fail/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Clone FAIL*
RUN git clone https://github.com/danceos/fail.git
WORKDIR fail
USER root
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]

View File

@ -0,0 +1,45 @@
# Inherit from docker container that has the fail source code
# prepared, including all tools which are needed to build FAIL*. The
# generic-tracing experiment was already built and the binaries are in
# place (~fail/bin/*)
FROM danceos/fail-generic-tracing
MAINTAINER Christian Dietrich <stettberger@dokucode.de>
# Install Additional Packages
RUN apt-get install -y \
python-minimal \
grub-common \
xorriso \
grub-pc-bin \
mysql-client \
python-flask \
python-mysqldb \
python-yaml
# Passwort for MySQL Daemon
ADD my.cnf /home/fail/.my.cnf
RUN chown fail /home/fail/.my.cnf
USER fail
WORKDIR /home/fail
RUN echo 'export PATH=$HOME/bin:$PATH' >> ~/.profile;\
echo 'cd $HOME/fail-targets' >> ~/.profile
RUN git clone https://github.com/danceos/fail-targets.git
WORKDIR fail
RUN mkdir build; cd build; ../configurations/x86_pruning.sh generic-experiment
WORKDIR build
# Make FAIL*
RUN make -j$(getconf _NPROCESSORS_ONLN) || make -j$(getconf _NPROCESSORS_ONLN)
RUN ln -s /home/fail/fail/build/bin/fail-client /home/fail/bin/generic-experiment-client; \
ln -s /home/fail/fail/build/bin/generic-experiment-server /home/fail/bin/; \
ln -s /home/fail/fail/tools/analysis/resultbrowser/run.py /home/fail/bin/resultbrowser
# For the resultbrowser, we expose port 5000 to the outside world.
EXPOSE 5000
USER root

View File

@ -0,0 +1,5 @@
[client]
host=mysql
user=fail
password=fail
database=fail

View File

@ -0,0 +1,25 @@
# Inherit from docker container that has the fail source code prepared,
# including all tools which are needed to build FAIL*
FROM danceos/fail-base
MAINTAINER Christian Dietrich <stettberger@dokucode.de>
USER fail
# Configure the Weather Monitor Experiment
ENV PATH /home/fail/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
WORKDIR /home/fail/fail
RUN mkdir build-tracer; cd build-tracer; ../configurations/x86_pruning.sh generic-tracing
WORKDIR build-tracer
# Make FAIL*
RUN make -j$(getconf _NPROCESSORS_ONLN) || make -j$(getconf _NPROCESSORS_ONLN)
RUN ln -s /home/fail/fail/build-tracer/bin/fail-client /home/fail/bin/fail-x86-tracing; \
ln -s /home/fail/fail/build-tracer/bin/import-trace /home/fail/bin/; \
ln -s /home/fail/fail/build-tracer/bin/prune-trace /home/fail/bin/; \
ln -s /home/fail/fail/build-tracer/bin/dump-trace /home/fail/bin/; \
ln -s /home/fail/fail/build-tracer/bin/convert-trace /home/fail/bin/; \
cp /home/fail/fail/tools/bochs-experiment-runner/bochs-experiment-runner.py /home/fail/bin/bochs-experiment-runner.py; \
chmod a+x /home/fail/bin/bochs-experiment-runner.py;
USER root