From a6a085c726f4e1b27e4412c9fe074dd743f76e99 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 15 Apr 2022 15:17:31 -0500 Subject: [PATCH 01/26] add basic editor config to root dir --- .editorconfig | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..1e7d18272 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*.yml] +indent_style = space +indent_size = 2 From b08fdd13093656a71c69789bde79940c93b85e0e Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 18 Apr 2022 15:00:05 -0500 Subject: [PATCH 02/26] improve editor config --- .editorconfig | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 1e7d18272..ddf305feb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,21 @@ root = true -[*.yml] +[*] indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +# Makefiles need tab indentation +[{Makefile,*.mk}] +indent_style = tab +tab_width = 8 +end_of_line = lf + +[{*.ps1,*.cmd,*.bat}] +end_of_line = crlf + +[*.sh] +end_of_line = lf + +[*.yml] indent_size = 2 From b9547f23c44e803325b7df6e7953914cb79a3156 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 18 Apr 2022 15:13:44 -0500 Subject: [PATCH 03/26] ignore vim swap files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 6eb145179..608c90b57 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,6 @@ build/ ### VS Code ### .vscode/ *.log + +# vim swap files +.*.swp From ae683cab1aac0b52dec5ecbb29272bc578a68fa8 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 18 Apr 2022 15:14:06 -0500 Subject: [PATCH 04/26] Add devcontainer support For more easily portable development, including Github CodeSpaces support --- .devcontainer/devcontainer.json | 35 +++++++++++++++++++++++++++++++++ .dockerignore | 3 +++ Dockerfile | 8 ++++++++ 3 files changed, 46 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..c1fac7b5d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,35 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/docker-existing-dockerfile +{ + "name": "Workspace Dockerfile", + + // Sets the run context to one level up instead of the .devcontainer folder. + "context": "..", + + // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. + "dockerFile": "../Dockerfile", + + // Set *default* container specific settings.json values on container create. + "settings": {}, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "vscjava.vscode-java-pack", + "EditorConfig.EditorConfig" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Uncomment the next line to run commands after the container is created - for example installing curl. + // "postCreateCommand": "apt-get update && apt-get install -y curl", + + // Uncomment when using a ptrace-based debugger like C++, Go, and Rust + // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], + + // Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker. + // "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], + + // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "containeruser" +} diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..01d666892 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git/ +.mvn/ +target/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..5724caf5c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +# A simple dev environment container for benchbase. + +FROM --platform=linux maven:3.8.5-eclipse-temurin-17 + +RUN addgroup --gid 1000 containergroup \ + && adduser --disabled-password --gecos 'Container User' --uid 1000 --gid 1000 containeruser + +USER containeruser From 386c4eee3484c12a08654be41a4a929fe054e604 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 18 Apr 2022 15:20:25 -0500 Subject: [PATCH 05/26] instruction comments --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 5724caf5c..9f108fcea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,12 @@ # A simple dev environment container for benchbase. +# +# - Build: +# +# docker build -t benchbase . +# +# - Run: +# +# docker run -it --rm --name basebench -v $PWD:/src benchbase /bin/bash FROM --platform=linux maven:3.8.5-eclipse-temurin-17 @@ -6,3 +14,4 @@ RUN addgroup --gid 1000 containergroup \ && adduser --disabled-password --gecos 'Container User' --uid 1000 --gid 1000 containeruser USER containeruser +WORKDIR /src From 5f5c2ad11bd00999fdd96ca12101d3867dbccb9d Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Tue, 19 Apr 2022 15:06:36 -0500 Subject: [PATCH 06/26] refactor the docker containers to also support deploying and running a built copy, not just for local devcontainer purposes most things are controllable via environment variables - BENCHBASE_PROFILES (full image build) - BENCHBASE_PROFILE (which profile to run) --- .devcontainer/devcontainer.json | 8 ++- .dockerignore | 9 +++- Dockerfile | 17 ------- docker/benchbase/Dockerfile | 74 ++++++++++++++++++++++++++++ docker/benchbase/build-dev-image.sh | 1 + docker/benchbase/build-full-image.sh | 44 +++++++++++++++++ docker/benchbase/entrypoint.sh | 8 +++ docker/benchbase/run-dev-image.sh | 20 ++++++++ docker/benchbase/run-full-image.sh | 23 +++++++++ 9 files changed, 185 insertions(+), 19 deletions(-) delete mode 100644 Dockerfile create mode 100644 docker/benchbase/Dockerfile create mode 120000 docker/benchbase/build-dev-image.sh create mode 100755 docker/benchbase/build-full-image.sh create mode 100755 docker/benchbase/entrypoint.sh create mode 100755 docker/benchbase/run-dev-image.sh create mode 100755 docker/benchbase/run-full-image.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c1fac7b5d..39fcdd556 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,13 @@ "context": "..", // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. - "dockerFile": "../Dockerfile", + "dockerFile": "../docker/benchbase/Dockerfile", + "build": { + "target": "devcontainer", + "args": { + "--tag": "benchbase-dev:latest" + } + }, // Set *default* container specific settings.json values on container create. "settings": {}, diff --git a/.dockerignore b/.dockerignore index 01d666892..7c8dd010f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,10 @@ -.git/ +.dockerignore +docker/ +!docker/benchbase/entrypoint.sh +#.git/ .mvn/ +mvnw.cmd +mvnw target/ +results/ +profiles/ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 9f108fcea..000000000 --- a/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# A simple dev environment container for benchbase. -# -# - Build: -# -# docker build -t benchbase . -# -# - Run: -# -# docker run -it --rm --name basebench -v $PWD:/src benchbase /bin/bash - -FROM --platform=linux maven:3.8.5-eclipse-temurin-17 - -RUN addgroup --gid 1000 containergroup \ - && adduser --disabled-password --gecos 'Container User' --uid 1000 --gid 1000 containeruser - -USER containeruser -WORKDIR /src diff --git a/docker/benchbase/Dockerfile b/docker/benchbase/Dockerfile new file mode 100644 index 000000000..44f5a0c41 --- /dev/null +++ b/docker/benchbase/Dockerfile @@ -0,0 +1,74 @@ +# A simple dev environment container for benchbase. +# +# - Build: +# +# - Full image: +# +# docker build -t benchbase -f Dockerfile ../.. +# +# - Dev only: +# +# # Skip copying and building the source into the devcontainer image since we will map it in later. +# docker build -t benchbase-dev -f Dockerfile --target devcontainer ../.. +# +# - Run: +# +# - Full image: +# +# # Map the config to read in and a place for the results to be written out. +# docker run -it --rm --name benchbase -v $PWD/config:/benchbase/config -v $PWD/results:/benchbase/results --env BENCHBASE_PROFILE=postgres benchbase -- +# +# - Dev image: +# +# # Map the whole source directory into the container. +# # Optionally build the source as the container launch executable. +# docker run -it --rm --name benchbase-dev -v $PWD:/benchbase benchbase-dev mvn clean package -P postgres + +FROM --platform=linux maven:3.8.5-eclipse-temurin-17 AS devcontainer + +# Add a containeruser that allows vscode/codespaces to map the local host user +# (often uid 1000) to some non-root user inside the container. +RUN addgroup --gid 1000 containergroup \ + && adduser --disabled-password --gecos 'Container User' --uid 1000 --gid 1000 containeruser +USER containeruser + +WORKDIR /benchbase +RUN mkdir -p /benchbase/results && chown containeruser:containergroup /benchbase/results + +# When running the devcontainer, just launch an interactive shell by default. +ENTRYPOINT ["/bin/bash", "-l"] + +# Copy the full source into the container image. +# Assumes the context is given as the root of the repo. + +# Preload some dependencies. +COPY --chown=containeruser:containergroup pom.xml /benchbase/pom.xml +COPY --chown=containeruser:containergroup .git/ /benchbase/.git/ +RUN mvn initialize + +# Add an additional layer that also includes a built copy of the source. +FROM devcontainer AS fullimage + +ARG MAVEN_OPTS +USER containeruser + +VOLUME /benchbase/results + +COPY --chown=containeruser:containergroup ./ /benchbase/ +# Uncomment for slightly faster incremental testing at the expense of additional docker image layers. +RUN mvn process-resources compile test-compile # test +# Build all of the profiles into the image. +ARG BENCHBASE_PROFILES="cockroachdb mariadb mysql postgres spanner phoenix" +RUN for profile in ${BENCHBASE_PROFILES}; do \ + mvn --file pom.xml package -P $profile -D skipTests || exit 1; \ + mkdir -p profiles/$profile; \ + tar -C profiles/$profile/ --strip-components=1 -xvzf target/benchbase-$profile.tgz || exit 1; \ + rm -rf profiles/$profile/data/ && ln -s ../../data profiles/$profile/data; \ + done \ + && mvn clean \ + && test -d data \ + && test "`readlink -f profiles/postgres/data`" = "/benchbase/data" + +ENV BENCHBASE_PROFILE=postgres +ENTRYPOINT ["/benchbase/docker/benchbase/entrypoint.sh"] +CMD ["--help"] \ No newline at end of file diff --git a/docker/benchbase/build-dev-image.sh b/docker/benchbase/build-dev-image.sh new file mode 120000 index 000000000..e6f8938dc --- /dev/null +++ b/docker/benchbase/build-dev-image.sh @@ -0,0 +1 @@ +build-full-image.sh \ No newline at end of file diff --git a/docker/benchbase/build-full-image.sh b/docker/benchbase/build-full-image.sh new file mode 100755 index 000000000..9e7960de8 --- /dev/null +++ b/docker/benchbase/build-full-image.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -eu + +BENCHBASE_PROFILES="${BENCHBASE_PROFILES:-cockroachdb mariadb mysql postgres spanner phoenix}" + +scriptdir=$(dirname "$(readlink -f "$0")") +rootdir=$(readlink -f "$scriptdir/../../") +cd "$rootdir" + +http_proxy_host='' +http_proxy_port='' +https_proxy_host='' +https_proxy_port='' + +if echo "$http_proxy" | egrep -q 'http[s]?://[^:]+:[0-9]+[/]?$'; then + http_proxy_host=$(echo "$http_proxy" | sed -r -e 's|^http[s]?://([^:]+):([0-9]+)[/]?$|\1|') + http_proxy_port=$(echo "$http_proxy" | sed -r -e 's|^http[s]?://([^:]+):([0-9]+)[/]?$|\2|') +fi + +if echo "$https_proxy" | egrep -q 'http[s]?://[^:]+:[0-9]+[/]?$'; then + https_proxy_host=$(echo "$https_proxy" | sed -r -e 's|^http[s]?://([^:]+):([0-9]+)[/]?$|\1|') + https_proxy_port=$(echo "$https_proxy" | sed -r -e 's|^http[s]?://([^:]+):([0-9]+)[/]?$|\2|') +fi + +target= +tag= +basename=$(basename "$0") +if [ "$basename" == "build-full-image.sh" ]; then + target='fullimage' + tag='benchbase' +elif [ "$basename" == "build-dev-image.sh" ]; then + target='devcontainer' + tag='benchbase-dev' +else + echo "ERROR: Unhandled mode: $basename" >&2 + exit 1 +fi + +set -x +docker build --build-arg=http_proxy=${http_proxy:-} --build-arg=https_proxy=${https_proxy:-} \ + --build-arg MAVEN_OPTS="-Dhttp.proxyHost=${http_proxy_host} -Dhttp.proxyPort=${http_proxy_port} -Dhttps.proxyHost=${https_proxy_host} -Dhttps.proxyPort=${https_proxy_port}" \ + --build-arg BENCHBASE_PROFILES="${BENCHBASE_PROFILES}" \ + -t $tag -f ./docker/benchbase/Dockerfile --target $target . diff --git a/docker/benchbase/entrypoint.sh b/docker/benchbase/entrypoint.sh new file mode 100755 index 000000000..9cfb09e6a --- /dev/null +++ b/docker/benchbase/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# fullimage docker entrypoint script + +BENCHBASE_PROFILE="${BENCHBASE_PROFILE:-postgres}" +cd /benchbase +echo "INFO: Using environment variable BENCHBASE_PROFILE=${BENCHBASE_PROFILE} with args: $*" >&2 +java -jar "./profiles/${BENCHBASE_PROFILE}/benchbase.jar" $* diff --git a/docker/benchbase/run-dev-image.sh b/docker/benchbase/run-dev-image.sh new file mode 100755 index 000000000..535083fdd --- /dev/null +++ b/docker/benchbase/run-dev-image.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -eu + +scriptdir=$(dirname "$(readlink -f "$0")") +rootdir=$(readlink -f "$scriptdir/../../") + +cd "$scriptdir" +./build-dev-image.sh + +# Sync with Dockerfile +containeruser_uid=1000 + +if [ $EUID != $containeruser_uid ]; then + echo "NOTE: Local host user uid ($EUID) does not match container user uid $containeruser_uid." >&2 + # TODO: Fix it up for them? +fi + +cd "$rootdir" +docker run -it --rm -v "$PWD:/benchbase" benchbase-dev diff --git a/docker/benchbase/run-full-image.sh b/docker/benchbase/run-full-image.sh new file mode 100755 index 000000000..c09a727ff --- /dev/null +++ b/docker/benchbase/run-full-image.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -eu + +BENCHBASE_PROFILE="${BENCHBASE_PROFILE:-postgres}" + +scriptdir=$(dirname "$(readlink -f "$0")") +rootdir=$(readlink -f "$scriptdir/../../") + +cd "$scriptdir" +./build-full-image.sh + +# Sync with Dockerfile +containeruser_uid=1000 + +if [ $EUID != $containeruser_uid ]; then + echo "NOTE: Local host user uid ($EUID) does not match container user uid $containeruser_uid." >&2 + # TODO: Fix it up for them? +fi + +cd "$rootdir" +mkdir -p results/ +docker run -it --rm -v "$PWD/results:/benchbase/results" --env "BENCHBASE_PROFILE=$BENCHBASE_PROFILE" benchbase $* From a79f923048bf5eaa93f029177f4c7a7ccaaaf91d Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Tue, 19 Apr 2022 16:08:50 -0500 Subject: [PATCH 07/26] adding some short readme text on how to build and use the docker images --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 4804e5a35..25ab5c922 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,28 @@ To modify the logging level you can update [`logging.properties`](src/main/resou ./mvnw -B release:perform ``` +### How use with Docker + +- Build the full image: + + ```sh + # build an image with all profiles + ./docker/benchbase/build-full-image.sh + + # or if you only want to build some of them + BENCHBASE_PROFILES='postgres mysql' ./docker/benchbase/build-full-image.sh + ``` + +- Run the image for a given profile: + + ```sh + BENCHBASE_PROFILE='postgres' ./docker/benchbase/run-full-image.sh --help # or other benchbase args as before + ``` + +> See [scripts](./docker/benchbase/) for further details. + +[Github Codespaces](https://github.com/features/codespaces) and [VSCode devcontainer](https://code.visualstudio.com/docs/remote/containers) support is also available. + ### How to Add Support for a New Database Please see the existing MySQL and PostgreSQL code for an example. From 109a44f5428f24b9d0519d07c667707a997fed3e Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 21 Apr 2022 16:39:08 -0500 Subject: [PATCH 08/26] Add basic CI jobs for docker image as well Adds addition targets for the Dockerfile to allow reusing the compiled sources for running the tests vs. cleaning it for fullimage usage. --- .dockerignore | 1 + .github/workflows/maven.yml | 37 +++++++++++++++++++++++++++++++++++++ docker/benchbase/Dockerfile | 20 +++++++++++++------- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7c8dd010f..ee7d73f8b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,6 +2,7 @@ docker/ !docker/benchbase/entrypoint.sh #.git/ +.github/ .mvn/ mvnw.cmd mvnw diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 73c0e450a..7d949ad55 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -243,3 +243,40 @@ jobs: - name: Run benchmark run: | java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/cockroachdb/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true + + docker-build-test: + runs-on: ubuntu-latest + services: + postgres: # https://hub.docker.com/_/postgres + image: postgres:latest + env: + POSTGRES_DB: benchbase + POSTGRES_USER: admin + POSTGRES_PASSWORD: password + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + env: + BENCHBASE_PROFILES: 'cockroachdb mariadb mysql postgres spanner phoenix' + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Docker image build + run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . + - name: Run test suite while building docker image + run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" -f ./docker/benchbase/Dockerfile --target test . + + - name: Setup postgres test DB + PGPASSWORD=password dropdb -h localhost -U admin benchbase --if-exists + PGPASSWORD=password createdb -h localhost -U admin benchbase + - name: Run basic benchbase test from the docker image against postgres test DB + uses: docker://benchbase:latest + with: + env: + BENCHBASE_PROFILE: postgres + args: -b noop -c config/postgres/sample_noop_config.xml --create=true --load=true --execute=true diff --git a/docker/benchbase/Dockerfile b/docker/benchbase/Dockerfile index 44f5a0c41..18bc9e23b 100644 --- a/docker/benchbase/Dockerfile +++ b/docker/benchbase/Dockerfile @@ -44,31 +44,37 @@ ENTRYPOINT ["/bin/bash", "-l"] # Preload some dependencies. COPY --chown=containeruser:containergroup pom.xml /benchbase/pom.xml COPY --chown=containeruser:containergroup .git/ /benchbase/.git/ -RUN mvn initialize +ARG MAVEN_OPTS +RUN mvn -B --file pom.xml initialize # Add an additional layer that also includes a built copy of the source. -FROM devcontainer AS fullimage +FROM devcontainer AS buildpackages -ARG MAVEN_OPTS USER containeruser VOLUME /benchbase/results COPY --chown=containeruser:containergroup ./ /benchbase/ # Uncomment for slightly faster incremental testing at the expense of additional docker image layers. -RUN mvn process-resources compile test-compile # test +RUN mvn -B --file pom.xml process-resources compile test-compile # test # Build all of the profiles into the image. ARG BENCHBASE_PROFILES="cockroachdb mariadb mysql postgres spanner phoenix" RUN for profile in ${BENCHBASE_PROFILES}; do \ - mvn --file pom.xml package -P $profile -D skipTests || exit 1; \ + mvn -B --file pom.xml package -P $profile -D skipTests || exit 1; \ mkdir -p profiles/$profile; \ tar -C profiles/$profile/ --strip-components=1 -xvzf target/benchbase-$profile.tgz || exit 1; \ rm -rf profiles/$profile/data/ && ln -s ../../data profiles/$profile/data; \ done \ - && mvn clean \ && test -d data \ && test "`readlink -f profiles/postgres/data`" = "/benchbase/data" ENV BENCHBASE_PROFILE=postgres ENTRYPOINT ["/benchbase/docker/benchbase/entrypoint.sh"] -CMD ["--help"] \ No newline at end of file +CMD ["--help"] + +FROM buildpackages AS test +USER containeruser +RUN mvn -B --file pom.xml test + +FROM buildpackages AS fullimage +RUN mvn -B --file pom.xml clean From 46447dd489bf470ca0a2fc6ca8ae0f3b40fe6995 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Thu, 21 Apr 2022 16:56:04 -0500 Subject: [PATCH 09/26] reorg docker layers to save space and make testing a build arg --- .github/workflows/maven.yml | 6 ++---- docker/benchbase/Dockerfile | 19 ++++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7d949ad55..97d51f07f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -266,10 +266,8 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - - name: Docker image build - run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . - - name: Run test suite while building docker image - run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" -f ./docker/benchbase/Dockerfile --target test . + - name: Build docker image with all packages and run test suite + run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . - name: Setup postgres test DB PGPASSWORD=password dropdb -h localhost -U admin benchbase --if-exists diff --git a/docker/benchbase/Dockerfile b/docker/benchbase/Dockerfile index 18bc9e23b..ff72eb2d3 100644 --- a/docker/benchbase/Dockerfile +++ b/docker/benchbase/Dockerfile @@ -48,15 +48,17 @@ ARG MAVEN_OPTS RUN mvn -B --file pom.xml initialize # Add an additional layer that also includes a built copy of the source. -FROM devcontainer AS buildpackages +FROM devcontainer AS fullimage USER containeruser VOLUME /benchbase/results COPY --chown=containeruser:containergroup ./ /benchbase/ -# Uncomment for slightly faster incremental testing at the expense of additional docker image layers. -RUN mvn -B --file pom.xml process-resources compile test-compile # test +# Uncomment for slightly faster incremental testing (since intermediate layers can be cached) +# at the expense of additional docker image layers. +ARG TEST_TARGET= +RUN mvn -B --file pom.xml process-resources compile ${TEST_TARGET} # Build all of the profiles into the image. ARG BENCHBASE_PROFILES="cockroachdb mariadb mysql postgres spanner phoenix" RUN for profile in ${BENCHBASE_PROFILES}; do \ @@ -66,15 +68,10 @@ RUN for profile in ${BENCHBASE_PROFILES}; do \ rm -rf profiles/$profile/data/ && ln -s ../../data profiles/$profile/data; \ done \ && test -d data \ - && test "`readlink -f profiles/postgres/data`" = "/benchbase/data" + && test "`readlink -f profiles/postgres/data`" = "/benchbase/data" \ + && mvn -B --file pom.xml clean \ + && rm -rf ~/.m2/repository/* ENV BENCHBASE_PROFILE=postgres ENTRYPOINT ["/benchbase/docker/benchbase/entrypoint.sh"] CMD ["--help"] - -FROM buildpackages AS test -USER containeruser -RUN mvn -B --file pom.xml test - -FROM buildpackages AS fullimage -RUN mvn -B --file pom.xml clean From 146188164c457fe47efb1bd859574ec3719ec2ca Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 11:03:44 -0500 Subject: [PATCH 10/26] fixup --- .github/workflows/maven.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 97d51f07f..5a8780821 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -270,6 +270,7 @@ jobs: run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . - name: Setup postgres test DB + run: PGPASSWORD=password dropdb -h localhost -U admin benchbase --if-exists PGPASSWORD=password createdb -h localhost -U admin benchbase - name: Run basic benchbase test from the docker image against postgres test DB From d0630bfc224591915d1f4808931bca733e9cbef6 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 11:06:03 -0500 Subject: [PATCH 11/26] more fixups --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5a8780821..bec70c9f4 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -277,5 +277,5 @@ jobs: uses: docker://benchbase:latest with: env: - BENCHBASE_PROFILE: postgres + - BENCHBASE_PROFILE: postgres args: -b noop -c config/postgres/sample_noop_config.xml --create=true --load=true --execute=true From 04abd03afd2a3d75b2e342d282b8f7361b48d6f8 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 11:09:17 -0500 Subject: [PATCH 12/26] try again --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index bec70c9f4..d74be34b7 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -275,7 +275,7 @@ jobs: PGPASSWORD=password createdb -h localhost -U admin benchbase - name: Run basic benchbase test from the docker image against postgres test DB uses: docker://benchbase:latest + env: + BENCHBASE_PROFILE: postgres with: - env: - - BENCHBASE_PROFILE: postgres args: -b noop -c config/postgres/sample_noop_config.xml --create=true --load=true --execute=true From 22d4b5b03fa705a1a427db381dce7fbaec92fc71 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 14:28:28 -0500 Subject: [PATCH 13/26] split docker build and run into two dependent jobs --- .github/workflows/maven.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index d74be34b7..5048c2778 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -245,6 +245,17 @@ jobs: java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/cockroachdb/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true docker-build-test: + runs-on: ubuntu-latest + env: + BENCHBASE_PROFILES: 'cockroachdb mariadb mysql postgres spanner phoenix' + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Build docker image with all packages and run test suite + run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . + + docker-run-test: + needs: docker-build-test runs-on: ubuntu-latest services: postgres: # https://hub.docker.com/_/postgres @@ -260,15 +271,6 @@ jobs: --health-retries 5 ports: - 5432:5432 - env: - BENCHBASE_PROFILES: 'cockroachdb mariadb mysql postgres spanner phoenix' - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - - name: Build docker image with all packages and run test suite - run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . - - name: Setup postgres test DB run: PGPASSWORD=password dropdb -h localhost -U admin benchbase --if-exists From f41160f960e9156bda8ab1ca1fde049f2dc29d06 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 14:40:09 -0500 Subject: [PATCH 14/26] fix copy/paste error --- .github/workflows/maven.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5048c2778..af16d8e66 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -271,6 +271,7 @@ jobs: --health-retries 5 ports: - 5432:5432 + steps: - name: Setup postgres test DB run: PGPASSWORD=password dropdb -h localhost -U admin benchbase --if-exists From ff740530cc1c78524e982fba3cec01aeb64cbfb3 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 14:56:41 -0500 Subject: [PATCH 15/26] fixups to allow setting the UID/GID of the container user to match github actions runner uid/gid --- .github/workflows/maven.yml | 4 +++- docker/benchbase/Dockerfile | 6 ++++-- docker/benchbase/build-full-image.sh | 3 +++ docker/benchbase/run-dev-image.sh | 8 -------- docker/benchbase/run-full-image.sh | 8 -------- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index af16d8e66..f7556ced7 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -252,7 +252,9 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - name: Build docker image with all packages and run test suite - run: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . + run: | + docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test --build-arg UID=$UID --build-arg GID=$UID \ + -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . docker-run-test: needs: docker-build-test diff --git a/docker/benchbase/Dockerfile b/docker/benchbase/Dockerfile index ff72eb2d3..0818d283c 100644 --- a/docker/benchbase/Dockerfile +++ b/docker/benchbase/Dockerfile @@ -28,8 +28,10 @@ FROM --platform=linux maven:3.8.5-eclipse-temurin-17 AS devcontainer # Add a containeruser that allows vscode/codespaces to map the local host user # (often uid 1000) to some non-root user inside the container. -RUN addgroup --gid 1000 containergroup \ - && adduser --disabled-password --gecos 'Container User' --uid 1000 --gid 1000 containeruser +ARG UID=1000 +ARG GID=1000 +RUN addgroup --gid ${GID} containergroup \ + && adduser --disabled-password --gecos 'Container User' --uid ${UID} --gid ${GID} containeruser USER containeruser WORKDIR /benchbase diff --git a/docker/benchbase/build-full-image.sh b/docker/benchbase/build-full-image.sh index 9e7960de8..575e1922c 100755 --- a/docker/benchbase/build-full-image.sh +++ b/docker/benchbase/build-full-image.sh @@ -37,8 +37,11 @@ else exit 1 fi +GID=$(getent passwd $UID | cut -d: -f4) + set -x docker build --build-arg=http_proxy=${http_proxy:-} --build-arg=https_proxy=${https_proxy:-} \ --build-arg MAVEN_OPTS="-Dhttp.proxyHost=${http_proxy_host} -Dhttp.proxyPort=${http_proxy_port} -Dhttps.proxyHost=${https_proxy_host} -Dhttps.proxyPort=${https_proxy_port}" \ --build-arg BENCHBASE_PROFILES="${BENCHBASE_PROFILES}" \ + --build-arg UID=$UID --build-arg GID=$GID \ -t $tag -f ./docker/benchbase/Dockerfile --target $target . diff --git a/docker/benchbase/run-dev-image.sh b/docker/benchbase/run-dev-image.sh index 535083fdd..870191c59 100755 --- a/docker/benchbase/run-dev-image.sh +++ b/docker/benchbase/run-dev-image.sh @@ -8,13 +8,5 @@ rootdir=$(readlink -f "$scriptdir/../../") cd "$scriptdir" ./build-dev-image.sh -# Sync with Dockerfile -containeruser_uid=1000 - -if [ $EUID != $containeruser_uid ]; then - echo "NOTE: Local host user uid ($EUID) does not match container user uid $containeruser_uid." >&2 - # TODO: Fix it up for them? -fi - cd "$rootdir" docker run -it --rm -v "$PWD:/benchbase" benchbase-dev diff --git a/docker/benchbase/run-full-image.sh b/docker/benchbase/run-full-image.sh index c09a727ff..0924522ce 100755 --- a/docker/benchbase/run-full-image.sh +++ b/docker/benchbase/run-full-image.sh @@ -10,14 +10,6 @@ rootdir=$(readlink -f "$scriptdir/../../") cd "$scriptdir" ./build-full-image.sh -# Sync with Dockerfile -containeruser_uid=1000 - -if [ $EUID != $containeruser_uid ]; then - echo "NOTE: Local host user uid ($EUID) does not match container user uid $containeruser_uid." >&2 - # TODO: Fix it up for them? -fi - cd "$rootdir" mkdir -p results/ docker run -it --rm -v "$PWD/results:/benchbase/results" --env "BENCHBASE_PROFILE=$BENCHBASE_PROFILE" benchbase $* From f0c0e30f9b1d2a42224156b76ad1400ce8ec382a Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 14:57:12 -0500 Subject: [PATCH 16/26] override the base image's user env for MAVEN_CONFIG path --- docker/benchbase/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/benchbase/Dockerfile b/docker/benchbase/Dockerfile index 0818d283c..e8d41d5fa 100644 --- a/docker/benchbase/Dockerfile +++ b/docker/benchbase/Dockerfile @@ -33,6 +33,7 @@ ARG GID=1000 RUN addgroup --gid ${GID} containergroup \ && adduser --disabled-password --gecos 'Container User' --uid ${UID} --gid ${GID} containeruser USER containeruser +ENV MAVEN_CONFIG=/home/containeruser/.m2 WORKDIR /benchbase RUN mkdir -p /benchbase/results && chown containeruser:containergroup /benchbase/results From ada13acfca8ba45d7c7a7f40f32d26c4106fc7a1 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 15:21:10 -0500 Subject: [PATCH 17/26] fixups for non-buildkit based docker builds --- docker/benchbase/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/benchbase/Dockerfile b/docker/benchbase/Dockerfile index e8d41d5fa..20fa16dd1 100644 --- a/docker/benchbase/Dockerfile +++ b/docker/benchbase/Dockerfile @@ -32,11 +32,10 @@ ARG UID=1000 ARG GID=1000 RUN addgroup --gid ${GID} containergroup \ && adduser --disabled-password --gecos 'Container User' --uid ${UID} --gid ${GID} containeruser +RUN mkdir -p /benchbase/results && chown containeruser:containergroup /benchbase/ USER containeruser ENV MAVEN_CONFIG=/home/containeruser/.m2 - WORKDIR /benchbase -RUN mkdir -p /benchbase/results && chown containeruser:containergroup /benchbase/results # When running the devcontainer, just launch an interactive shell by default. ENTRYPOINT ["/bin/bash", "-l"] From 53f931de3577fb9339ed64dcf27d3e0b9d32ff59 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 15:21:31 -0500 Subject: [PATCH 18/26] more dev container image size reduction --- docker/benchbase/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker/benchbase/Dockerfile b/docker/benchbase/Dockerfile index 20fa16dd1..3bdc7702e 100644 --- a/docker/benchbase/Dockerfile +++ b/docker/benchbase/Dockerfile @@ -47,7 +47,8 @@ ENTRYPOINT ["/bin/bash", "-l"] COPY --chown=containeruser:containergroup pom.xml /benchbase/pom.xml COPY --chown=containeruser:containergroup .git/ /benchbase/.git/ ARG MAVEN_OPTS -RUN mvn -B --file pom.xml initialize +RUN mvn -B --file pom.xml initialize \ + && rm -rf /benchbase/.git /benchbase/target /benchbase/pom.xml # Add an additional layer that also includes a built copy of the source. FROM devcontainer AS fullimage @@ -72,7 +73,8 @@ RUN for profile in ${BENCHBASE_PROFILES}; do \ && test -d data \ && test "`readlink -f profiles/postgres/data`" = "/benchbase/data" \ && mvn -B --file pom.xml clean \ - && rm -rf ~/.m2/repository/* + && rm -rf ~/.m2/repository/* \ + && rm -rf .git/ ENV BENCHBASE_PROFILE=postgres ENTRYPOINT ["/benchbase/docker/benchbase/entrypoint.sh"] From 0ebb3ff476ef924f1d18b1ff222b846c7ffe2354 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 15:26:06 -0500 Subject: [PATCH 19/26] enable docker buildkit --- .github/workflows/maven.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index f7556ced7..a43461000 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -247,6 +247,7 @@ jobs: docker-build-test: runs-on: ubuntu-latest env: + DOCKER_BUILDKIT: 1 BENCHBASE_PROFILES: 'cockroachdb mariadb mysql postgres spanner phoenix' steps: - name: Checkout repo From 434f4549d9754f32d2fe52d81b0375a1965cdd90 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 16:57:44 -0500 Subject: [PATCH 20/26] attempt to build and run the docker image in the same job this avoids having to publish the docker image somewhere for a downstream job to use however, it requires use to manually lookup the docker network that the test database service was setup with to connect the container to we also have to dynamically rewrite the sample config to connect with a name instead of localhost since the benchmark is running inside a separate container --- .github/workflows/maven.yml | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a43461000..483fb674b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -245,20 +245,6 @@ jobs: java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/cockroachdb/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true docker-build-test: - runs-on: ubuntu-latest - env: - DOCKER_BUILDKIT: 1 - BENCHBASE_PROFILES: 'cockroachdb mariadb mysql postgres spanner phoenix' - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - name: Build docker image with all packages and run test suite - run: | - docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test --build-arg UID=$UID --build-arg GID=$UID \ - -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . - - docker-run-test: - needs: docker-build-test runs-on: ubuntu-latest services: postgres: # https://hub.docker.com/_/postgres @@ -279,9 +265,18 @@ jobs: run: PGPASSWORD=password dropdb -h localhost -U admin benchbase --if-exists PGPASSWORD=password createdb -h localhost -U admin benchbase - - name: Run basic benchbase test from the docker image against postgres test DB - uses: docker://benchbase:latest + - name: Checkout repo + uses: actions/checkout@v2 + - name: Build docker image with all packages and run test suite env: - BENCHBASE_PROFILE: postgres - with: - args: -b noop -c config/postgres/sample_noop_config.xml --create=true --load=true --execute=true + DOCKER_BUILDKIT: 1 + BENCHBASE_PROFILES: 'cockroachdb mariadb mysql postgres spanner phoenix' + run: | + docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test --build-arg UID=$UID --build-arg GID=$UID \ + -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . + - name: Run basic benchbase test from the docker image against postgres test DB + run: | + cat config/postgres/sample_noop_config.xml | sed -e 's/localhost:5432/postgres:5432/g' > /tmp/config.xml + docker run -it --rm --name benchbase-postgres --network=$(docker ps --filter expose=5432 --format '{{.Networks}}')" \ + --env BENCHBASE_PROFILE=postgres -v /tmp/config.xml:/tmp/config.xml \ + benchbase:latest -b noop -c /tmp/config.xml --create=true --load=true --execute=true \ No newline at end of file From d99eb2965e9c95b07f61a59543cd28ca9e316260 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Fri, 22 Apr 2022 17:00:56 -0500 Subject: [PATCH 21/26] fixup --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 483fb674b..5a39bbd20 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -262,7 +262,7 @@ jobs: - 5432:5432 steps: - name: Setup postgres test DB - run: + run: | PGPASSWORD=password dropdb -h localhost -U admin benchbase --if-exists PGPASSWORD=password createdb -h localhost -U admin benchbase - name: Checkout repo From 7b94308c10ed6793b492a5256ea388e7e60ac063 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 25 Apr 2022 10:06:35 -0500 Subject: [PATCH 22/26] quoting fixup and additional comments --- .github/workflows/maven.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5a39bbd20..47dc08231 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -275,8 +275,14 @@ jobs: docker build --build-arg "BENCHBASE_PROFILES=$BENCHBASE_PROFILES" --build-arg TEST_TARGET=test --build-arg UID=$UID --build-arg GID=$UID \ -t benchbase:latest -f ./docker/benchbase/Dockerfile --target fullimage . - name: Run basic benchbase test from the docker image against postgres test DB + env: + benchmark: noop run: | - cat config/postgres/sample_noop_config.xml | sed -e 's/localhost:5432/postgres:5432/g' > /tmp/config.xml - docker run -it --rm --name benchbase-postgres --network=$(docker ps --filter expose=5432 --format '{{.Networks}}')" \ + # Adjust the sample config to talk to the container service instead of localhost. + cat config/postgres/sample_${benchmark}_config.xml | sed -e 's/localhost:5432/postgres:5432/g' > /tmp/config.xml + # Lookup the service container's docker network so we can place the benchbase container in it too. + docker_network="$(docker ps --filter expose=5432 --format '{{.Networks}}')" + # Map the adjusted config into the container and use it to run the test. + docker run -it --rm --name benchbase-postgres --network "$docker_network" \ --env BENCHBASE_PROFILE=postgres -v /tmp/config.xml:/tmp/config.xml \ - benchbase:latest -b noop -c /tmp/config.xml --create=true --load=true --execute=true \ No newline at end of file + benchbase:latest -b "$benchmark" -c /tmp/config.xml --create=true --load=true --execute=true From 59f78fb643ff3fce948ec2ea9f831d7ad60064f0 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 25 Apr 2022 10:21:16 -0500 Subject: [PATCH 23/26] quoting --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 47dc08231..3992a9eae 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -279,7 +279,7 @@ jobs: benchmark: noop run: | # Adjust the sample config to talk to the container service instead of localhost. - cat config/postgres/sample_${benchmark}_config.xml | sed -e 's/localhost:5432/postgres:5432/g' > /tmp/config.xml + cat "config/postgres/sample_${benchmark}_config.xml" | sed -e 's/localhost:5432/postgres:5432/g' > /tmp/config.xml # Lookup the service container's docker network so we can place the benchbase container in it too. docker_network="$(docker ps --filter expose=5432 --format '{{.Networks}}')" # Map the adjusted config into the container and use it to run the test. From cbbbfbb5b3af11f8136fa44f913089c8cde22dad Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 25 Apr 2022 10:21:29 -0500 Subject: [PATCH 24/26] docker run can't be interactive in CI pipeline --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 3992a9eae..2c456e02a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -283,6 +283,6 @@ jobs: # Lookup the service container's docker network so we can place the benchbase container in it too. docker_network="$(docker ps --filter expose=5432 --format '{{.Networks}}')" # Map the adjusted config into the container and use it to run the test. - docker run -it --rm --name benchbase-postgres --network "$docker_network" \ + docker run --rm --name benchbase-postgres --network "$docker_network" \ --env BENCHBASE_PROFILE=postgres -v /tmp/config.xml:/tmp/config.xml \ benchbase:latest -b "$benchmark" -c /tmp/config.xml --create=true --load=true --execute=true From b7d7b2ca6522e3e8a01efa75596cb056618435c9 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 25 Apr 2022 10:46:42 -0500 Subject: [PATCH 25/26] fix a permissions issue --- .github/workflows/maven.yml | 4 +++- docker/benchbase/Dockerfile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index d1361367a..bf67dc808 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -346,6 +346,8 @@ jobs: # Lookup the service container's docker network so we can place the benchbase container in it too. docker_network="$(docker ps --filter expose=5432 --format '{{.Networks}}')" # Map the adjusted config into the container and use it to run the test. + mkdir -p results docker run --rm --name benchbase-postgres --network "$docker_network" \ - --env BENCHBASE_PROFILE=postgres -v /tmp/config.xml:/tmp/config.xml \ + --env BENCHBASE_PROFILE=postgres -v /tmp/config.xml:/tmp/config.xml -v "$PWD/results:/basebench/results" \ benchbase:latest -b "$benchmark" -c /tmp/config.xml --create=true --load=true --execute=true + ls results/${benchmark}_*.csv diff --git a/docker/benchbase/Dockerfile b/docker/benchbase/Dockerfile index 51156985e..02847e156 100644 --- a/docker/benchbase/Dockerfile +++ b/docker/benchbase/Dockerfile @@ -32,7 +32,7 @@ ARG UID=1000 ARG GID=1000 RUN addgroup --gid ${GID} containergroup \ && adduser --disabled-password --gecos 'Container User' --uid ${UID} --gid ${GID} containeruser -RUN mkdir -p /benchbase/results && chown containeruser:containergroup /benchbase/ +RUN mkdir -p /benchbase/results && chown -R containeruser:containergroup /benchbase/ USER containeruser ENV MAVEN_CONFIG=/home/containeruser/.m2 WORKDIR /benchbase From e3ad4eba21d7045be4a1a5b6f8debd903cfa8a10 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 25 Apr 2022 10:58:06 -0500 Subject: [PATCH 26/26] spelling --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index bf67dc808..973d88cfb 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -348,6 +348,6 @@ jobs: # Map the adjusted config into the container and use it to run the test. mkdir -p results docker run --rm --name benchbase-postgres --network "$docker_network" \ - --env BENCHBASE_PROFILE=postgres -v /tmp/config.xml:/tmp/config.xml -v "$PWD/results:/basebench/results" \ + --env BENCHBASE_PROFILE=postgres -v /tmp/config.xml:/tmp/config.xml -v "$PWD/results:/benchbase/results" \ benchbase:latest -b "$benchmark" -c /tmp/config.xml --create=true --load=true --execute=true ls results/${benchmark}_*.csv