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

Docker script tweaks #331

Merged
merged 9 commits into from
Jun 28, 2023
Merged
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
12 changes: 8 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ For instance:
```bash
# Set which database to target.
export BENCHBASE_PROFILE='sqlserver'
# Set which benchmark to run.
benchmark='tpcc'

# Optional additional overrides (defaults shown):

# Set which profiles to build.
export BENCHBASE_PROFILES=$BENCHBASE_PROFILE
# Specify a different version of the profile to use (suffix in this directory).
export PROFILE_VERSION='latest'
# Whether or not to rebuild the package/image.
export CLEAN_BUILD="false"
# When rebuilding, whether or not to run the unit tests.
export SKIP_TESTS="true"

# Set which benchmark to run.
benchmark='tpcc'

./docker/build-run-benchmark-with-docker.sh $benchmark
```

This will use the selected profile's `up.sh` script to start the database as a local container, and the [`run-full-image.sh`](./benchbase/run-full-image.sh) to optionally build benchbase and then run the benchmark against it.
This will use the selected profile's `up.sh` script to start the database as a local container, and the [`run-full-image.sh`](./benchbase/run-full-image.sh) to optionally build benchbase and then run the benchmark against it.
2 changes: 2 additions & 0 deletions docker/benchbase/devcontainer/build-in-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# A simple script for building one or more profiles (in parallel) inside the container.

# TODO: Convert this to a multi-stage build for better caching.
bpkroth marked this conversation as resolved.
Show resolved Hide resolved

# Make sure any failure halts the rest of the operation.
set -eu -o pipefail

Expand Down
2 changes: 2 additions & 0 deletions docker/benchbase/fullimage/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO: Use a multi-stage build to build the fullimage from the devcontainer.

# Use a smaller base image that only has the jre, not the full jdk.
#FROM --platform=linux eclipse-temurin:17-jre AS fullimage
FROM eclipse-temurin:17-jre AS fullimage
Expand Down
6 changes: 3 additions & 3 deletions docker/benchbase/run-full-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if [ "$imagename" != 'benchbase' ]; then
echo "ERROR: Unexpected imagename: $imagename" >&2
fi

SRC_DIR="$PWD"
if [ -n "$LOCAL_WORKSPACE_FOLDER" ]; then
SRC_DIR="$rootdir"
if [ -n "${LOCAL_WORKSPACE_FOLDER:-}" ]; then
SRC_DIR="$LOCAL_WORKSPACE_FOLDER"
fi

Expand All @@ -33,7 +33,7 @@ mkdir -p results/
set -x
docker run -it --rm \
${EXTRA_DOCKER_ARGS:-} \
--env=http_proxy="${http_proxy:-}" --env=https_proxy="${https_proxy:-}" \
--env=http_proxy="${http_proxy:-}" --env=https_proxy="${https_proxy:-}" --env=no_proxy="${no_proxy:-}" \
--env BENCHBASE_PROFILE="$BENCHBASE_PROFILE" \
--user "$CONTAINERUSER_UID:$CONTAINERUSER_GID" \
-v "$SRC_DIR/results:/benchbase/results" benchbase-$BENCHBASE_PROFILE:latest $*
Expand Down
10 changes: 6 additions & 4 deletions docker/build-run-benchmark-with-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ benchmark="${1:-noop}"
# Let these pass through from the .env file from the devcontainer.
export BENCHBASE_PROFILE="${BENCHBASE_PROFILE:-postgres}"
export BENCHBASE_PROFILES="$BENCHBASE_PROFILE"
PROFILE_VERSION=${PROFILE_VERSION:-latest}

# When we are running the full image we don't generally want to have to rebuild it repeatedly.
export CLEAN_BUILD="${CLEAN_BUILD:-false}"
Expand All @@ -17,20 +18,21 @@ scriptdir=$(dirname "$(readlink -f "$0")")
rootdir=$(readlink -f "$scriptdir/..")
cd "$rootdir"

EXTRA_DOCKER_ARGS=''
if [ "$BENCHBASE_PROFILE" == 'sqlite' ]; then
# Map the sqlite db back to the host.
touch $PWD/$benchmark.db
SRC_DIR="$PWD"
if [ -n "$LOCAL_WORKSPACE_FOLDER" ]; then
if [ -n "${LOCAL_WORKSPACE_FOLDER:-}" ]; then
SRC_DIR="$LOCAL_WORKSPACE_FOLDER"
fi
EXTRA_DOCKER_ARGS="-v $SRC_DIR/$benchmark.db:/benchbase/profiles/sqlite/$benchmark.db"
else
if [ ! -x "docker/${BENCHBASE_PROFILE}-latest/up.sh" ]; then
if [ ! -x "docker/${BENCHBASE_PROFILE}-${PROFILE_VERSION}/up.sh" ]; then
echo "ERROR: No docker up.sh script available for '$BENCHBASE_PROFILE'"
fi

"./docker/${BENCHBASE_PROFILE}-latest/up.sh"
"./docker/${BENCHBASE_PROFILE}-${PROFILE_VERSION}/up.sh"
fi

CREATE_DB_ARGS='--create=true --load=true'
Expand All @@ -44,4 +46,4 @@ SKIP_TESTS=${SKIP_TESTS:-true} EXTRA_DOCKER_ARGS="--network=host $EXTRA_DOCKER_A
$CREATE_DB_ARGS --execute=true \
--sample 1 --interval-monitor 1000 \
--json-histograms results/histograms.json
./scripts/check_histogram_results.sh results/historgrams.json
./scripts/check_histogram_results.sh results/histograms.json
2 changes: 2 additions & 0 deletions docker/mysql-5/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ services:
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_ROOT_HOST: "%"
MYSQL_USER: admin
MYSQL_PASSWORD: password
MYSQL_DATABASE: benchbase
ports:
- "3306:3306"
Expand Down