Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker setup #6

Open
wants to merge 1 commit into
base: quic23
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions doc/examples/quic/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# we need python2 support, which was dropped after buster:
FROM debian:buster

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update
RUN apt-get install -y apt-utils

# Install and configure locale `en_US.UTF-8`
RUN apt-get install -y locales && \
sed -i -e "s/# $en_US.*/en_US.UTF-8 UTF-8/" /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8

RUN apt-get update
RUN apt-get install -y git python2 python-pip g++ cmake python-ply git python-tk tix pkg-config libssl-dev sudo python-setuptools vim zsh tmux

# create a user:
RUN useradd -ms /bin/bash user && echo 'user:user' | chpasswd && adduser user sudo
RUN echo "ALL ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER user
WORKDIR /home/user

# install Ivy:
RUN git clone --recurse-submodules https://github.com/kenmcmil/ivy.git
WORKDIR /home/user/ivy/
RUN git checkout quic23
RUN python build_submodules.py # takes a while (builds z3...)
RUN mkdir -p "/home/user/python/lib/python2.7/site-packages"
ENV PYTHONPATH="/home/user/python/lib/python2.7/site-packages"
RUN python2.7 setup.py develop --prefix="/home/user/python/"
ENV PATH=$PATH:"/home/user/python/bin/"

RUN pip install pexpect chardet # additional dependencies of Ivy's test feature
RUN mkdir -p /home/user/ivy/doc/examples/quic/test/temp
RUN mkdir /home/user/ivy/doc/examples/quic/build

# build quant:
WORKDIR /home/user/
RUN git clone https://github.com/NTAP/quant.git
RUN sudo apt-get install -y libssl-dev libhttp-parser-dev libbsd-dev pkgconf
RUN sudo apt-get install -y aptitude
WORKDIR /home/user/quant
# checkout the implementation of version 23 of the spec:
RUN git checkout 23
RUN git submodule update --init --recursive
RUN mkdir Debug
WORKDIR /home/user/quant/Debug
RUN cmake .. && make

# build picotls
WORKDIR /home/user/
RUN git clone https://github.com/h2o/picotls.git
WORKDIR /home/user/picotls
RUN git checkout 549bc7c4321f7cfd426c32c375c17240b9b1258f
RUN git submodule init
RUN git submodule update
RUN cmake .
RUN make
#RUN make check

# build picoquic
WORKDIR /home/user/
RUN git clone https://github.com/private-octopus/picoquic.git
WORKDIR /home/user/picoquic
RUN git checkout 4c061c0b24e35282108d8c57eef41939a692a6c4
RUN cmake .
RUN make

# tell Ivy where the quic implementations are:
ENV QUIC_IMPL_DIR=/home/user/

COPY resources/run-test.sh /home/user/ivy/doc/examples/quic
WORKDIR /home/user/ivy/doc/examples/quic/
2 changes: 2 additions & 0 deletions doc/examples/quic/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The script `run.sh` will build a Docker image, create a container, and run the specified test.
For example, `run.sh -s picoquic -t quic_server_test_stream` runs the test from file `quic_server_test_stream.ivy` against the picoquic server. The test results are copied to the `results` directory.
12 changes: 12 additions & 0 deletions doc/examples/quic/docker/resources/run-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

TEST_NAME=$1
SERVER=$2

ivyc target=test ${TEST_NAME}.ivy

cd test

python test.py iters=1 server=${SERVER} stats=true test=${TEST_NAME}

sudo cp -R temp /results
27 changes: 27 additions & 0 deletions doc/examples/quic/docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

IMAGE_NAME=galoisinc/quicmbt
IMAGE_TAG=latest

docker build -t ${IMAGE_NAME}:${IMAGE_TAG} .

TEST_NAME=quic_server_test_stream
SERVER=picoquic #quant is also an option

while getopts ":s:t:" opt; do
case ${opt} in
t )
TEST_NAME=$OPTARG
;;
s )
SERVER=$OPTARG
;;
* )
show_error_and_exit "Unknown argument: " $OPTARG
;;
esac
done

echo "RUNNING TEST: ${TEST_NAME}"

docker run -it --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" -v ${PWD}/results:/results -e DISPLAY=$DISPLAY ${IMAGE_NAME}:${IMAGE_TAG} ./run-test.sh ${TEST_NAME} ${SERVER}