Commit d07b216b authored by Tomas Krizek's avatar Tomas Krizek

Merge branch 'contrib-fix-docker-exitcode' into 'master'

contrib/*: minor fixes and container update

See merge request !43
parents 05cf8c8c 1bb0bf70
Pipeline #43090 passed with stage
in 1 minute and 5 seconds
FROM ubuntu:latest
MAINTAINER Knot Resolver <knot-resolver@labs.nic.cz>
ARG GIT_TAG=v9_13_2
ARG GIT_TAG=v9_13_4
RUN apt-get update -qq
RUN apt-get upgrade -y -qqq
RUN apt-get install -y -qqq git build-essential make libssl-dev
RUN apt-get install -y -qqq git build-essential make libssl-dev python3 python3-ply python3-dnspython
RUN git clone --depth 1 --branch=$GIT_TAG https://gitlab.isc.org/isc-projects/bind9.git /var/opt/bind9
WORKDIR /var/opt/bind9
RUN ./configure --disable-backtrace --disable-symtable --with-libtool --enable-full-report --without-lmdb --without-zlib --without-gssapi --without-libxml2 --without-dlopen --disable-linux-caps
RUN make
CMD /var/opt/bind9/bin/named/named -c /etc/bind9/named.conf -f
ENTRYPOINT ["/var/opt/bind9/bin/named/named", "-c", "/etc/bind9/named.conf", "-f"]
......@@ -39,4 +39,6 @@ RUN make install PREFIX=/var/opt/knot-resolver/.install
RUN mkdir /log
CMD /var/opt/knot-resolver/.install/sbin/kresd -c /etc/knot-resolver/kresd.conf -K /etc/knot-resolver/root.keys -v -f 1 /dev/shm >> /log/kresd.log
COPY kresd.entrypoint.sh /
ENTRYPOINT ["/kresd.entrypoint.sh"]
#!/bin/bash
exec /var/opt/knot-resolver/.install/sbin/kresd -c /etc/knot-resolver/kresd.conf -K /etc/knot-resolver/root.keys -v -f 1 /dev/shm >> /log/kresd.log
FROM ubuntu:latest
MAINTAINER Knot Resolver <knot-resolver@labs.nic.cz>
CMD ["tail", "-f", "/dev/null"]
RUN apt-get update
RUN apt-get install -y -qqq git wget build-essential bind9utils libbind-dev libssl-dev libkrb5-dev libcap-dev libxml2-dev libjson-c-dev libgeoip-dev
......@@ -11,4 +9,6 @@ RUN cd /var/opt; git clone https://github.com/akamai/dnsperf.git
WORKDIR /var/opt/dnsperf
RUN ./configure && make && make install
RUN wget -q https://gitlab.labs.nic.cz/knot/respdiff/uploads/9b95b53c04091849023b12b992edad0e/shortlist -O shortlist
RUN wget -q https://gitlab.labs.nic.cz/knot/respdiff/uploads/45c21d26fb1c1c06cb00f0aeb34742c7/shortlist3 -O shortlist
ENTRYPOINT ["resperf"]
......@@ -15,4 +15,4 @@ RUN make install
RUN useradd -s /usr/sbin/nologin -r unbound
CMD /var/opt/unbound/unbound -d
ENTRYPOINT ["/var/opt/unbound/unbound", "-d"]
......@@ -78,6 +78,7 @@ def create_resolver_configs(directory: str, config: Dict[str, Any]):
if not os.path.exists(dockerfile_dir):
os.makedirs(dockerfile_dir)
copy_file('Dockerfile.knot-resolver', dockerfile_dir, 'Dockerfile')
copy_file('kresd.entrypoint.sh', dockerfile_dir)
create_file_from_template(
'kresd.conf.j2', resolver, directory, name + '.conf')
copy_file('root.keys', directory)
......
......@@ -20,6 +20,10 @@ services:
KNOT_BRANCH: ${KNOT_BRANCH}
CFLAGS: {{ '-ggdb3 -O0 -fsanitize=address -fno-omit-frame-pointer' if asan else "''" }}
image: knot-resolver:{{ git_sha }}{{ '-asan' if asan else '' }}
{%- if asan %}
cap_add:
- SYS_PTRACE
{%- endif %}
volumes:
- "./{{ name }}.conf:/etc/knot-resolver/kresd.conf:ro"
- "./root.keys:/etc/knot-resolver/root.keys:ro"
......@@ -31,7 +35,7 @@ services:
{%- endif -%}
{%- if resolver['type'] == 'bind' %}
image: registry.labs.nic.cz/knot/respdiff/bind:latest
image: registry.labs.nic.cz/knot/respdiff/bind:v9_13_4
volumes:
- "./{{ name }}.conf:/etc/bind9/named.conf:ro"
- "./rfc1912.zones:/etc/bind9/rfc1912.zones:ro"
......@@ -39,7 +43,7 @@ services:
{%- endif -%}
{%- if resolver['type'] == 'unbound' %}
image: registry.labs.nic.cz/knot/respdiff/unbound:latest
image: registry.labs.nic.cz/knot/respdiff/unbound:v1.8.2
volumes:
- "./{{ name }}.conf:/usr/local/etc/unbound/unbound.conf:ro"
- "./root.keys:/usr/local/etc/unbound/root.keys:ro"
......@@ -48,9 +52,3 @@ services:
{%- endif -%}
{%- endfor -%}
{%- if resperf %}
resperf:
network_mode: host
image: registry.labs.nic.cz/knot/respdiff/resperf:latest
{%- endif -%}
../../docker/knot-resolver/kresd.entrypoint.sh
\ No newline at end of file
......@@ -12,7 +12,7 @@ tar -czf ${JOBNAME}_logs.tar.gz -T /dev/null # empty tar by default
# HACK (condor): Create proper dir structure
mkdir -p docker-knot-resolver || :
mv Dockerfile docker-knot-resolver/ || :
mv -t docker-knot-resolver/ Dockerfile kresd.entrypoint.sh || :
# Check no other docker containers are running
if [ -n "$(docker ps -q)" ]; then
......@@ -59,9 +59,8 @@ cleanup() {
{%if database['remove_after'] %}
rm -rf ./*.mdb || :
{% endif %}
exit 0
}
trap cleanup ERR EXIT
trap cleanup EXIT
# Get database
wget --quiet -O {{ database['dest'] }} {{ database['url'] }}
......
......@@ -3,16 +3,24 @@ set -o xtrace
JOBNAME=j$1.$2
exit_handler() {
exitcode=$?
docker-compose --no-ansi logs &>>${JOBNAME}_kresd.docker.txt || :
docker-compose --no-ansi rm -fsv || :
echo "$exitcode" > ${JOBNAME}_exitcode
}
trap exit_handler EXIT
# HACK (condor): ensure files for transfer exist to avoid held jobs
touch ${JOBNAME}_kresd.docker.txt
touch ${JOBNAME}_resperf.txt
echo '0' > ${JOBNAME}_exitcode
echo '1' > ${JOBNAME}_exitcode # failed unless job exits with 0
mkdir logs
tar -czf ${JOBNAME}_logs.tar.gz -T /dev/null # empty tar by default
# HACK (condor): Create proper dir structure
mkdir -p docker-knot-resolver || :
mv Dockerfile docker-knot-resolver/ || :
mv -t docker-knot-resolver/ Dockerfile kresd.entrypoint.sh || :
# HACK (condor): set PATH, otherwise docker-compose exec will fail
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
......@@ -26,17 +34,6 @@ fi
# Exit if any cmd fails from now on.
set -o errexit
cleanup() {
docker-compose --no-ansi rm -fsv || :
exit 0
}
trap cleanup EXIT
err_handle() {
echo '1' > ${JOBNAME}_exitcode
}
trap err_handle ERR
# Prepare ssh key for knot-resolver-security
set +o xtrace
SSH_PRIVATE_KEY=$(cat </home/respdiff/.ssh/knot_resolver_security.id_rsa || :)
......@@ -81,8 +78,7 @@ for i in $(seq 3); do
# Execute resperf
docker-compose --no-ansi up -d
docker-compose --no-ansi exec -T resperf resperf -q 500000 -m 10000 -C 200 -c 30 -d shortlist -t 15 -r 0 -s 127.0.0.1 -p {{ resperf['port'] }} &>>${JOBNAME}_resperf.txt
docker-compose --no-ansi logs &>>${JOBNAME}_kresd.docker.txt
docker-compose --no-ansi ps | (! grep Exit)
docker-compose --no-ansi kill
docker run registry.labs.nic.cz/knot/respdiff/resperf:shortlist3 -q 500000 -m 10000 -C 200 -c 30 -d shortlist -t 15 -r 0 -s 127.0.0.1 -p {{ resperf['port'] }} &>>${JOBNAME}_resperf.txt
docker-compose --no-ansi stop
docker-compose --no-ansi ps | (! grep 'Exit [1-9]')
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment