diff options
author | Richard Samuels <richard.l.samuels@gmail.com> | 2021-10-13 22:22:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-13 22:54:24 +0000 |
commit | d9edcac7b12ccfe8eb8c2b95f071b4a8918e18d3 (patch) | |
tree | b38eec855c73ade5cb91ca9f27dc3ee689e8504d /buildscripts/antithesis | |
parent | fb5fc15108425209fe8b5fb4a33e45e7980214b3 (diff) | |
download | mongo-d9edcac7b12ccfe8eb8c2b95f071b4a8918e18d3.tar.gz |
SERVER-60618 Add docker image build for Antithesis.io
Diffstat (limited to 'buildscripts/antithesis')
-rw-r--r-- | buildscripts/antithesis/Dockerfile | 6 | ||||
-rw-r--r-- | buildscripts/antithesis/README.md | 15 | ||||
-rw-r--r-- | buildscripts/antithesis/database/Dockerfile | 25 | ||||
-rw-r--r-- | buildscripts/antithesis/docker-compose.yml | 63 | ||||
-rw-r--r-- | buildscripts/antithesis/workload/Dockerfile | 37 | ||||
-rwxr-xr-x | buildscripts/antithesis/workload/init.sh | 7 | ||||
-rw-r--r-- | buildscripts/antithesis/workload/preseed.txt | 2 |
7 files changed, 155 insertions, 0 deletions
diff --git a/buildscripts/antithesis/Dockerfile b/buildscripts/antithesis/Dockerfile new file mode 100644 index 00000000000..58681a1dee7 --- /dev/null +++ b/buildscripts/antithesis/Dockerfile @@ -0,0 +1,6 @@ +FROM scratch +COPY docker-compose.yml / +#COPY .env / +ADD workload /workload +ADD database /database +ADD logs /logs diff --git a/buildscripts/antithesis/README.md b/buildscripts/antithesis/README.md new file mode 100644 index 00000000000..bfbebb0cbb5 --- /dev/null +++ b/buildscripts/antithesis/README.md @@ -0,0 +1,15 @@ +# Antithesis Docker Image Building + +This directory contains `Dockerfile`s and other resources for constructing +the workload, SUT, and config docker images for use with Antithesis. + +- workload: the workload image that runs resmoke +- database: the System Under Test, spawned multiple times to form the + appropriate topology +- config: this directory, contains the above and a docker-compose.yml file for + spawning the system +- logs: the log folders of each database node will be mounted as a subdirectory + in logs. + +Please also see evergreen/antithesis_image_build.sh, which prepares the build +contexts for building these images, and uploads them to the docker registry diff --git a/buildscripts/antithesis/database/Dockerfile b/buildscripts/antithesis/database/Dockerfile new file mode 100644 index 00000000000..11ca1b2e8bc --- /dev/null +++ b/buildscripts/antithesis/database/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:18.04 + +EXPOSE 27017 +EXPOSE 27018 +EXPOSE 27019 + +# prep the environment +RUN mkdir -p /data/db +RUN mkdir -p /var/log/mongodb + +# Install dependencies of MongoDB Server +RUN apt-get update +RUN apt-get install -qy libcurl4 libgssapi-krb5-2 libldap-2.4-2 libwrap0 libsasl2-2 libsasl2-modules libsasl2-modules-gssapi-mit snmp openssl liblzma5 + +# ------------------- +# Everything above this line should be common image setup +# Everything below should be specific to the version of mongodb being installed + +COPY dist-test/bin/* /usr/bin/ +RUN chmod +x /usr/bin/* +COPY libvoidstar.so /usr/lib/libvoidstar.so + +RUN /usr/bin/mongo --version + +CMD /usr/bin/mongod --bind_ip 0.0.0.0 --replSet RollbackFuzzerTest --logpath /var/log/mongodb/mongodb.log diff --git a/buildscripts/antithesis/docker-compose.yml b/buildscripts/antithesis/docker-compose.yml new file mode 100644 index 00000000000..041faed007f --- /dev/null +++ b/buildscripts/antithesis/docker-compose.yml @@ -0,0 +1,63 @@ +version: '3.0' + +services: + database1: + container_name: database1 + hostname: database1 + build: ./database + image: database:evergreen-latest + volumes: + - ./logs/database1:/var/log/mongodb/ + networks: + antithesis-net: + ipv4_address: 10.20.20.3 + # Set the an IPv4 with an address of 10.20.20.130 or higher + # to be ignored by the fault injector + # + database2: + container_name: database2 + hostname: database2 + build: ./database + image: database:evergreen-latest + volumes: + - ./logs/database2:/var/log/mongodb/ + networks: + antithesis-net: + ipv4_address: 10.20.20.4 + # Set the an IPv4 with an address of 10.20.20.130 or higher + # to be ignored by the fault injector + # + database3: + container_name: database3 + hostname: database3 + build: ./database + image: database:evergreen-latest + volumes: + - ./logs/database3:/var/log/mongodb/ + networks: + antithesis-net: + ipv4_address: 10.20.20.5 + # Set the an IPv4 with an address of 10.20.20.130 or higher + # to be ignored by the fault injector + + workload: + container_name: workload + hostname: workload + build: ./workload + image: workload:evergreen-latest + depends_on: + - "database1" + - "database2" + - "database3" + networks: + antithesis-net: + ipv4_address: 10.20.20.130 + # The subnet provided here is an example + # An alternative subnet can be used + +networks: + antithesis-net: + driver: bridge + ipam: + config: + - subnet: 10.20.20.0/24 diff --git a/buildscripts/antithesis/workload/Dockerfile b/buildscripts/antithesis/workload/Dockerfile new file mode 100644 index 00000000000..7c345658223 --- /dev/null +++ b/buildscripts/antithesis/workload/Dockerfile @@ -0,0 +1,37 @@ +FROM ubuntu:18.04 + +EXPOSE 27017 +EXPOSE 27018 +EXPOSE 27019 + +# tzdata will block waiting for interactive input. Ensure that dpkg gets run +# in a non-interactive fashion by preseeding tzdata +COPY preseed.txt /tmp/preseed.txt +RUN debconf-set-selections /tmp/preseed.txt +RUN rm /tmp/preseed.txt + +RUN apt-get update +RUN apt-get install -qy libcurl4 libgssapi-krb5-2 libldap-2.4-2 libwrap0 libsasl2-2 libsasl2-modules libsasl2-modules-gssapi-mit snmp openssl liblzma5 libssl-dev build-essential software-properties-common +RUN add-apt-repository ppa:deadsnakes/ppa +RUN apt-get update + +# python 3.9 +RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qy python3.9 python3.9-dev python3.9-venv + +# ------------------- +# Everything above this line should be common image setup +# Everything below should be specific to the version of mongodb being installed + +# copy resmoke, make the venv, and pip install +COPY src /resmoke + +RUN bash -c "cd /resmoke && python3.9 -m venv python3-venv && . python3-venv/bin/activate && pip install --upgrade pip wheel && pip install -r ./buildscripts/requirements.txt && ./buildscripts/antithesis_suite.py generate-all" + +COPY init.sh /resmoke/init.sh +COPY mongo /usr/bin +RUN chmod +x /usr/bin/mongo +COPY libvoidstar.so /usr/lib/libvoidstar.so + +RUN /usr/bin/mongo --version + +ENTRYPOINT /resmoke/init.sh diff --git a/buildscripts/antithesis/workload/init.sh b/buildscripts/antithesis/workload/init.sh new file mode 100755 index 00000000000..57c90d17176 --- /dev/null +++ b/buildscripts/antithesis/workload/init.sh @@ -0,0 +1,7 @@ +sleep 5s +mongo --host database1 --port 27017 --eval "config={\"_id\" : \"RollbackFuzzerTest\",\"protocolVersion\" : 1,\"members\" : [{\"_id\" : 0,\"host\" : \"database1:27017\"}, {\"_id\" : 1,\"host\" : \"database2:27017\"}, {\"_id\" : 2,\"host\" : \"database3:27017\"} ],\"settings\" : {\"chainingAllowed\" : false,\"electionTimeoutMillis\" : 500, \"heartbeatTimeoutSecs\" : 700, \"catchUpTimeoutMillis\": 700}}; rs.initiate(config)" + +mongo --host database1 --eval "rs.config()" + +# this cryptic statement keeps the workload container running. +tail -f /dev/null diff --git a/buildscripts/antithesis/workload/preseed.txt b/buildscripts/antithesis/workload/preseed.txt new file mode 100644 index 00000000000..5b20c6f355c --- /dev/null +++ b/buildscripts/antithesis/workload/preseed.txt @@ -0,0 +1,2 @@ +tzdata tzdata/Areas select America +tzdata tzdata/Zones/America select New_York |