-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GODRIVER-3061 Expand the capabilities of the docker container (#378)
* Clean up docker handling * syntax * clean up and add client runner * clean up and handle load balancer * fix syntax * fix run-server * add an ignore * address review and add docker cleanup * Update .evergreen/docker/README.md Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com> --------- Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
- Loading branch information
1 parent
4c76122
commit d7db0ce
Showing
9 changed files
with
215 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Run a driver test in a docker container that targets the | ||
# the server running in docker. | ||
# | ||
set -eu | ||
|
||
# Docker related variables. | ||
IMAGE=${TARGET_IMAGE:-ubuntu20.04} | ||
PLATFORM=${DOCKER_PLATFORM:-} | ||
# e.g. --platform linux/amd64 | ||
|
||
# Mongo orchestration related variables. | ||
MONGODB_VERSION=${MONGODB_VERSION:-latest} | ||
TOPOLOGY=${TOPOLOGY:-replica_set} | ||
ORCHESTRATION_FILE=${ORCHESTRATION_FILE:-basic.json} | ||
SKIP_CRYPT_SHARED_LIB=${SKIP_CRYPT_SHARED_LIB:-false} | ||
AUTH=${AUTH:-""} | ||
SSL=${SSL:-""} | ||
|
||
# Internal variables. | ||
ROOT_DRIVERS_TOOLS=/root/drivers-evergeen-tools | ||
MONGODB_BINARIES="ROOT_DRIVERS_TOOLS/.evergreen/docker/$IMAGE/mongodb/bin" | ||
|
||
# Build up the arguments. | ||
ARGS="$PLATFORM --rm -i" | ||
ARGS+=" -e MONGODB_VERSION=$MONGODB_VERSION -e TOPOLOGY=$TOPOLOGY" | ||
ARGS+=" -e SSL=$SSL -e AUTH=$AUTH" | ||
ARGS+=" -e MONGODB_BINARIES=$MONGODB_BINARIES" | ||
ARGS+=" -e CRYPT_SHARED_LIB_PATH=$MONGODB_BINARIES/mongosh_crypt_v1.so" | ||
ARGS+=" -e ORCHESTRATION_FILE=$ORCHESTRATION_FILE" | ||
ARGS+=" -e SKIP_CRYPT_SHARED_LIB=$SKIP_CRYPT_SHARED_LIB" | ||
ARGS+=" -e DRIVERS_TOOLS=$ROOT_DRIVERS_TOOLS" | ||
|
||
# Ensure host.docker.internal is available on MacOS. | ||
if [ "$(uname -s)" = "Darwin" ]; then | ||
ARGS+=" -e MONGODB_URI=mongodb://host.docker.internal" | ||
fi | ||
|
||
# Ensure host network is available on Linux. | ||
if [ "$(uname -s)" = "Linux" ]; then | ||
ARGS+=" --network=host" | ||
fi | ||
|
||
# If there is a tty, add the -t arg. | ||
test -t 1 && ARGS+=" -t" | ||
|
||
# Map the cwd to /src and map in DRIVERS_TOOLS. | ||
ARGS+=" -v `pwd`:/src" | ||
ARGS+=" -v $DRIVERS_TOOLS:/root/drivers-evergreen-tools" | ||
|
||
# Launch client docker container. | ||
docker run $ARGS $@ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Run a local MongoDB orchestration inside a docker container | ||
# | ||
set -eu | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
NAME=drivers-evergreen-tools | ||
ENTRYPOINT=${ENTRYPOINT:-/root/local-entrypoint.sh} | ||
IMAGE=${TARGET_IMAGE:-ubuntu20.04} | ||
PLATFORM=${DOCKER_PLATFORM:-} | ||
# e.g. --platform linux/amd64 | ||
|
||
docker build $PLATFORM -t $NAME $IMAGE | ||
cd $SCRIPT_DIR/../.. | ||
|
||
# Remove existing mongodb files | ||
rm -rf $SCRIPT_DIR/$IMAGE/mongodb | ||
|
||
# Handle environment variables. | ||
AUTH=${AUTH:-noauth} | ||
SSL=${SSL:-nossl} | ||
TOPOLOGY=${TOPOLOGY:-server} | ||
LOAD_BALANCER=${LOAD_BALANCER:-} | ||
STORAGE_ENGINE=${STORAGE_ENGINE:-} | ||
REQUIRE_API_VERSION=${REQUIRE_API_VERSION:-} | ||
DISABLE_TEST_COMMANDS=${DISABLE_TEST_COMMANDS:-} | ||
MONGODB_VERSION=${MONGODB_VERSION:-latest} | ||
MONGODB_DOWNLOAD_URL=${MONGODB_DOWNLOAD_URL:-} | ||
ORCHESTRATION_FILE=${ORCHESTRATION_FILE:-basic.json} | ||
|
||
# Build up the args. | ||
ARGS="$PLATFORM --rm -i" | ||
ARGS+=" -e MONGODB_VERSION=$MONGODB_VERSION" | ||
ARGS+=" -e TOPOLOGY=$TOPOLOGY" | ||
ARGS+=" -e AUTH=$AUTH" | ||
ARGS+=" -e SSL=$SSL" | ||
ARGS+=" -e ORCHESTRATION_FILE=$ORCHESTRATION_FILE" | ||
ARGS+=" -e LOAD_BALANCER=$LOAD_BALANCER" | ||
ARGS+=" -e STORAGE_ENGINE=$STORAGE_ENGINE" | ||
ARGS+=" -e REQUIRE_API_VERSION=$REQUIRE_API_VERSION" | ||
ARGS+=" -e DISABLE_TEST_COMMANDS=$DISABLE_TEST_COMMANDS" | ||
ARGS+=" -e MONGODB_DOWNLOAD_URL=$MONGODB_DOWNLOAD_URL" | ||
|
||
# Expose the required ports. | ||
if [ "$TOPOLOGY" == "server" ]; then | ||
ARGS+=" -p 27017:27017" | ||
elif [ -n "$LOAD_BALANCER" ]; then | ||
ARGS+=" -p 27017:27017 -p 27018:27018 -p 27019:27019 -p 27050:27050 -p 27051:27051" | ||
else | ||
ARGS+=" -p 27017:27017 -p 27018:27018 -p 27019:27019" | ||
fi | ||
|
||
# If there is a tty, add the -t arg. | ||
test -t 1 && ARGS+=" -t" | ||
|
||
# Map in the DRIVERS_TOOLS directory. | ||
ARGS+=" -v `pwd`:/root/drivers-evergreen-tools" | ||
|
||
# Launch server docker container. | ||
docker run $ARGS $NAME $ENTRYPOINT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.