From 8d338c0e9f9e8ccec4c9e11f88a7b0c21146757a Mon Sep 17 00:00:00 2001 From: Sasha Pachev Date: Mon, 13 Apr 2020 16:40:10 -0600 Subject: [PATCH 1/2] Fixes for the orchestrator containers. Go was refusing to build the orchestrator because go version was 1.10, required 1.12. So I upgraded alpine image to the latest. After that I had to fix the file copy because the directory structure apparently changed between versions. docker-compose-init.bash is still giving me problems even after I had created a local alias for orchestrator-client, which with the new version apparently has been replaced with orchestrator cli. It fails on discover with MySQL access denied message printed previously. I have not yet investigated that, but at least docker-compose build succeeds and I can see orchestrator containers coming up and printing messages that suggest they are doing something. --- conf/orchestrator/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/orchestrator/Dockerfile b/conf/orchestrator/Dockerfile index 5bdcfc9..0567240 100644 --- a/conf/orchestrator/Dockerfile +++ b/conf/orchestrator/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.8 +FROM alpine:latest EXPOSE 3000 @@ -16,8 +16,8 @@ RUN set -ex \ && { go get -d github.com/github/orchestrator ; : ; } \ && cd $GOPATH/src/github.com/github/orchestrator \ && bash build.sh -b \ - && rsync -av $(find /tmp/orchestrator-release -type d -name orchestrator -maxdepth 2)/ / \ - && rsync -av $(find /tmp/orchestrator-release -type d -name orchestrator-cli -maxdepth 2)/ / \ + && mkdir -p /usr/local/orchestrator \ + && cp build/bin/orchestrator /usr/local/orchestrator/ \ && cd / \ && apk del .build-deps \ && rm -rf /tmp/* \ From 8720164943f2c310952bd2ede40d8a62270aecfb Mon Sep 17 00:00:00 2001 From: Sasha Pachev Date: Sat, 2 May 2020 22:28:17 -0600 Subject: [PATCH 2/2] Refactored proxysql containers to use spachev/proxysql-debian-stretch image with proxysql binary replaced with the locally build one if running with REBUILD_DOCKER=1 and if the binary exists - defaulting to ../proxysql/src/proxysql, but can be overrided with PROXYSQL_BIN setting. If running with defaults or if the binary does not exist, use the original renecannao/proxysql_205_pltx19:debian9 image. --- docker-compose-init.bash | 62 ++++++++++++++++++++++++++++++++++++++-- docker-compose.yml | 18 ++++++------ 2 files changed, 68 insertions(+), 12 deletions(-) diff --git a/docker-compose-init.bash b/docker-compose-init.bash index cf7bbcd..7d2de17 100755 --- a/docker-compose-init.bash +++ b/docker-compose-init.bash @@ -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" @@ -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 <