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

Ability to use a local proxysql binary in testing #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
62 changes: 59 additions & 3 deletions docker-compose-init.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
#!/bin/bash

function die
{
printf "Fatal error: $1" >&2
exit
}

function cp_w_mkdir
{
local src="$1" dst="$2"
local d=$(dirname $2)
(mkdir -p $d && cp "$src" "$dst" ) || die "Error copying from $src to $dst"
}

. constants

printf "$BRIGHT"
Expand All @@ -9,9 +23,51 @@ printf "$NORMAL"

sleep 1

docker-compose up -d
./bin/docker-mysql-post.bash && ./bin/docker-orchestrator-post.bash && ./bin/docker-restart-binlog_reader.bash && ./bin/docker-proxy-post.bash
if [ -z "$PROXYSQL_BIN" ] && [ -x "../proxysql/src/proxysql" ]
then
PROXYSQL_BIN="../proxysql/src/proxysql"
fi

PROXYSQL_DOCKER_BASE="./conf/proxysql"
DOCKER_PROXYSQL="$PROXYSQL_DOCKER_BASE/usr/bin/proxysql"
PROXYSQL_DOCKERBUILD_EXTRA=
PROXYSQL_DOCKERFILE="$PROXYSQL_DOCKER_BASE/Dockerfile"
REBUILD_DOCKER=${REBUILD_DOCKER:-0}
PROXYSQL_BASE_IMAGE="renecannao/proxysql_205_pltx19:debian9"

if [ "$REBUILD_DOCKER" = "1" ]
then
rm -f $PROXYSQL_DOCKERFILE
fi

if [ ! -f "$PROXYSQL_DOCKERFILE" ]
then
if [ -x "$PROXYSQL_BIN" ]
then
cp_w_mkdir $PROXYSQL_BIN $DOCKER_PROXYSQL
PROXYSQL_BASE_IMAGE="spachev/proxysql-debian-stretch"
PROXYSQL_DOCKERBUILD_EXTRA=$(cat <<'eot'
COPY / /
eot
)
printf "Found proxysql local binary in $PROXYSQL_BIN, putting it in Docker\n"
fi

cat >$PROXYSQL_DOCKERFILE <<eot
FROM $PROXYSQL_BASE_IMAGE
$PROXYSQL_DOCKERBUILD_EXTRA
eot
REBUILD_DOCKER=1
fi

if [ "$REBUILD_DOCKER" = "1" ]
then
docker-compose build || die "Error building Docker containers"
fi

docker-compose up -d || die "Error bringing Docker containers up"
(./bin/docker-mysql-post.bash && ./bin/docker-orchestrator-post.bash && ./bin/docker-restart-binlog_reader.bash && ./bin/docker-proxy-post.bash) || die "Error running setup"

if [[ -z "$1" ]]; then
./bin/docker-benchmark.bash
./bin/docker-benchmark.bash || die "Error running the benchmark"
fi
18 changes: 9 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "2.0"
services:
mysql1:
image: mysql:5.7
ports:
ports:
- "13306:3306"
volumes:
- ./conf/mysql/mysql1:/etc/mysql/conf.d
Expand All @@ -12,7 +12,7 @@ services:
- MYSQL_ROOT_PASSWORD=root
mysql2:
image: mysql:5.7
ports:
ports:
- "13307:3306"
volumes:
- ./conf/mysql/mysql2:/etc/mysql/conf.d
Expand All @@ -24,7 +24,7 @@ services:
- MYSQL_ROOT_PASSWORD=root
mysql3:
image: mysql:5.7
ports:
ports:
- "13308:3306"
volumes:
- ./conf/mysql/mysql3:/etc/mysql/conf.d
Expand All @@ -40,7 +40,7 @@ services:
- "14306:6020"
volumes:
- ./entrypoint/reader/reader1:/etc/proxysql_binlog_reader
entrypoint: /etc/proxysql_binlog_reader/entrypoint.sh
entrypoint: /etc/proxysql_binlog_reader/entrypoint.sh
networks:
- backend
depends_on:
Expand All @@ -51,7 +51,7 @@ services:
- "14307:6020"
volumes:
- ./entrypoint/reader/reader2:/etc/proxysql_binlog_reader
entrypoint: /etc/proxysql_binlog_reader/entrypoint.sh
entrypoint: /etc/proxysql_binlog_reader/entrypoint.sh
networks:
- backend
depends_on:
Expand All @@ -62,13 +62,13 @@ services:
- "14308:6020"
volumes:
- ./entrypoint/reader/reader3:/etc/proxysql_binlog_reader
entrypoint: /etc/proxysql_binlog_reader/entrypoint.sh
entrypoint: /etc/proxysql_binlog_reader/entrypoint.sh
networks:
- backend
depends_on:
- mysql3
proxysql1:
image: renecannao/proxysql_205_pltx19:debian9
build: ./conf/proxysql/
ports:
- "16033:6033"
- "16032:6032"
Expand All @@ -83,7 +83,7 @@ services:
- frontend
- backend
proxysql2:
image: renecannao/proxysql_205_pltx19:debian9
build: ./conf/proxysql/
ports:
- "16043:6033"
- "16042:6032"
Expand All @@ -97,7 +97,7 @@ services:
- frontend
- backend
proxysql3:
image: renecannao/proxysql_205_pltx19:debian9
build: ./conf/proxysql/
ports:
- "16053:6033"
- "16052:6032"
Expand Down