From 172a05ff22cefa95ebfff2f7ed64e13f5cae01c9 Mon Sep 17 00:00:00 2001 From: rluisr Date: Sat, 22 Jul 2023 01:50:46 +0900 Subject: [PATCH 1/5] MySQL 8.1 / 8.0.34 --- .idea/aws.xml | 17 +++++++++++++++++ README.md | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .idea/aws.xml diff --git a/.idea/aws.xml b/.idea/aws.xml new file mode 100644 index 0000000..ef13aed --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 85c619e..bb359e0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ client for getting mysql-router information. Supported version ----------------- -- 20190715 (8.0.17 - 8.0.32) +- 20190715 (8.0.17 - 8.0.34 / 8.1.0) Enable HTTP Server and REST API ------------------------------- From 61fbc36fce41870f3502ac7f6b388498bc7e1c46 Mon Sep 17 00:00:00 2001 From: rluisr Date: Sat, 22 Jul 2023 01:56:23 +0900 Subject: [PATCH 2/5] chore: Update MySQL versions and URLs --- test/.env | 2 +- test/mysql-router/Dockerfile_http | 2 +- test/mysql-router/Dockerfile_https | 2 +- test/mysql-shell/Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/.env b/test/.env index 0bba8e1..cf41101 100644 --- a/test/.env +++ b/test/.env @@ -1 +1 @@ -VERSION=8.0.32 \ No newline at end of file +VERSION=8.1 \ No newline at end of file diff --git a/test/mysql-router/Dockerfile_http b/test/mysql-router/Dockerfile_http index e36c02a..b81c5d4 100644 --- a/test/mysql-router/Dockerfile_http +++ b/test/mysql-router/Dockerfile_http @@ -1,7 +1,7 @@ FROM oraclelinux:7-slim RUN rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 \ - && yum install -y yum install http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm \ + && yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm \ && yum install -y mysql-community-client mysql-router-community libpwquality \ && yum clean all diff --git a/test/mysql-router/Dockerfile_https b/test/mysql-router/Dockerfile_https index c34b4e2..122a6c6 100644 --- a/test/mysql-router/Dockerfile_https +++ b/test/mysql-router/Dockerfile_https @@ -1,7 +1,7 @@ FROM oraclelinux:7-slim RUN rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 \ - && yum install -y yum install http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm \ + && yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm \ && yum install -y mysql-community-client mysql-router-community libpwquality \ && yum clean all diff --git a/test/mysql-shell/Dockerfile b/test/mysql-shell/Dockerfile index 486597b..bdbd27f 100644 --- a/test/mysql-shell/Dockerfile +++ b/test/mysql-shell/Dockerfile @@ -3,7 +3,7 @@ FROM oraclelinux:7-slim ARG KEY=https://repo.mysql.com/RPM-GPG-KEY-mysql -ARG MYSQL_SHELL_PACKAGE_URL="https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-8.0.29-1.el7.x86_64.rpm" +ARG MYSQL_SHELL_PACKAGE_URL="https://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm" COPY run.sh /run.sh RUN chmod +x /run.sh From 8e7d1370ab7f5c10c50b2aea1fc412569f991375 Mon Sep 17 00:00:00 2001 From: rluisr Date: Sat, 22 Jul 2023 02:01:03 +0900 Subject: [PATCH 3/5] refactor: Use container-registry.oracle.com/mysql/community-server:latest image --- test/docker-compose.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/docker-compose.yml b/test/docker-compose.yml index ebd59fc..c955cd9 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -14,10 +14,12 @@ services: - mysql-router-http - mysql-router-https + # why using `latest` tag? + # Oracle does not pin the version of mysql-server of linux/amd64 ^^ mysql-server-1: env_file: - mysql-server.env - image: mysql/mysql-server:${VERSION} + image: container-registry.oracle.com/mysql/community-server:latest command: [ "mysqld","--server_id=1", "--binlog-transaction-dependency-tracking=WRITESET", "--binlog_checksum=NONE","--gtid_mode=ON","--enforce_gtid_consistency=ON","--log_bin","--log_slave_updates=ON","--master_info_repository=TABLE","--relay_log_info_repository=TABLE","--transaction_write_set_extraction=XXHASH64","--user=mysql","--skip-host-cache","--skip-name-resolve", "--default_authentication_plugin=mysql_native_password" ] ports: - "3301:3306" @@ -25,7 +27,7 @@ services: mysql-server-2: env_file: - mysql-server.env - image: mysql/mysql-server:${VERSION} + image: container-registry.oracle.com/mysql/community-server:latest command: [ "mysqld","--server_id=2","--binlog-transaction-dependency-tracking=WRITESET", "--binlog_checksum=NONE","--gtid_mode=ON","--enforce_gtid_consistency=ON","--log_bin","--log_slave_updates=ON","--master_info_repository=TABLE","--relay_log_info_repository=TABLE","--transaction_write_set_extraction=XXHASH64","--user=mysql","--skip-host-cache","--skip-name-resolve", "--default_authentication_plugin=mysql_native_password" ] ports: - "3302:3306" @@ -33,7 +35,7 @@ services: mysql-server-3: env_file: - mysql-server.env - image: mysql/mysql-server:${VERSION} + image: container-registry.oracle.com/mysql/community-server:latest command: [ "mysqld","--server_id=3","--binlog-transaction-dependency-tracking=WRITESET", "--binlog_checksum=NONE","--gtid_mode=ON","--enforce_gtid_consistency=ON","--log_bin","--log_slave_updates=ON","--master_info_repository=TABLE","--relay_log_info_repository=TABLE","--transaction_write_set_extraction=XXHASH64","--user=mysql","--skip-host-cache","--skip-name-resolve", "--default_authentication_plugin=mysql_native_password" ] ports: - "3303:3306" From 2341ac7c2c7c1a2e62228c55c6158a0f501b0313 Mon Sep 17 00:00:00 2001 From: rluisr Date: Sun, 23 Jul 2023 22:33:18 +0900 Subject: [PATCH 4/5] refactor(test): improve Dockerfile for MySQL Shell --- .gitignore | 1 + test/.envrc | 1 - test/mysql-shell/Dockerfile | 8 ++------ test/mysql-shell/run.sh | 1 + 4 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 test/.envrc diff --git a/.gitignore b/.gitignore index 75fc1e4..95ff871 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .env .envrc +test/.envrc \ No newline at end of file diff --git a/test/.envrc b/test/.envrc deleted file mode 100644 index e8d1177..0000000 --- a/test/.envrc +++ /dev/null @@ -1 +0,0 @@ -export DOCKER_CONTEXT=remote diff --git a/test/mysql-shell/Dockerfile b/test/mysql-shell/Dockerfile index bdbd27f..95a44b4 100644 --- a/test/mysql-shell/Dockerfile +++ b/test/mysql-shell/Dockerfile @@ -1,17 +1,13 @@ -# docker buildx build --platform linux/amd64 -t mysqlshell:8.0.29 . --load - FROM oraclelinux:7-slim -ARG KEY=https://repo.mysql.com/RPM-GPG-KEY-mysql -ARG MYSQL_SHELL_PACKAGE_URL="https://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm" +ARG MYSQL_SHELL_PACKAGER_URL="https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-8.1.0-1.el7.x86_64.rpm" COPY run.sh /run.sh RUN chmod +x /run.sh COPY setupCluster.js /setupCluster.js -RUN rpmkeys --import $KEY \ - && yum install -y $MYSQL_SHELL_PACKAGE_URL \ +RUN yum install -y $MYSQL_SHELL_PACKAGER_URL \ && yum clean all ENTRYPOINT ["/run.sh"] diff --git a/test/mysql-shell/run.sh b/test/mysql-shell/run.sh index dc72c39..3d8b877 100644 --- a/test/mysql-shell/run.sh +++ b/test/mysql-shell/run.sh @@ -2,6 +2,7 @@ set -e if [ "$1" = 'mysqlsh' ]; then + mysqlsh --version if [[ -z $MYSQL_HOST || -z $MYSQL_PORT || -z $MYSQL_USER || -z $MYSQL_PASSWORD ]]; then echo "We require all of" From 2548e6bb7a9f45080436ecaf5458b44d330a23f5 Mon Sep 17 00:00:00 2001 From: rluisr Date: Sun, 23 Jul 2023 23:26:29 +0900 Subject: [PATCH 5/5] refactor: Clean up and update test files --- test/.env | 2 +- test/Makefile | 4 +- test/README.md | 2 +- test/docker-compose.yml | 61 ++++++++++++++++++++---------- test/mysql-router.env | 5 --- test/mysql-router/Dockerfile_http | 6 ++- test/mysql-router/Dockerfile_https | 6 ++- test/mysql-router/run_http.sh | 3 ++ test/mysql-server.env | 2 - test/mysql-shell.env | 5 --- test/mysql-shell/Dockerfile | 2 +- 11 files changed, 57 insertions(+), 41 deletions(-) delete mode 100644 test/mysql-router.env delete mode 100644 test/mysql-server.env delete mode 100644 test/mysql-shell.env diff --git a/test/.env b/test/.env index cf41101..7066f7d 100644 --- a/test/.env +++ b/test/.env @@ -1 +1 @@ -VERSION=8.1 \ No newline at end of file +VERSION=8.1.0 \ No newline at end of file diff --git a/test/Makefile b/test/Makefile index 07dbaf5..3c8e71a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,8 +2,8 @@ test: docker compose up --build --force-recreate --always-recreate-deps --renew-anon-volumes -d docker exec test-mysqlrouter-go-test-1 sh -c "bash /go/src/mysqlrouter-go/entrypoint.sh" -down: +clean: docker compose down docker compose rm -f -local: test down \ No newline at end of file +local: test clean \ No newline at end of file diff --git a/test/README.md b/test/README.md index 445a823..7bf7c96 100644 --- a/test/README.md +++ b/test/README.md @@ -1 +1 @@ -docker compose up && docker compose rm -fsv \ No newline at end of file +See [Makefile](Makefile) \ No newline at end of file diff --git a/test/docker-compose.yml b/test/docker-compose.yml index c955cd9..e3f6c40 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -17,24 +17,27 @@ services: # why using `latest` tag? # Oracle does not pin the version of mysql-server of linux/amd64 ^^ mysql-server-1: - env_file: - - mysql-server.env + environment: + MYSQL_ROOT_PASSWORD: "mysql" + MYSQL_ROOT_HOST: "%" image: container-registry.oracle.com/mysql/community-server:latest command: [ "mysqld","--server_id=1", "--binlog-transaction-dependency-tracking=WRITESET", "--binlog_checksum=NONE","--gtid_mode=ON","--enforce_gtid_consistency=ON","--log_bin","--log_slave_updates=ON","--master_info_repository=TABLE","--relay_log_info_repository=TABLE","--transaction_write_set_extraction=XXHASH64","--user=mysql","--skip-host-cache","--skip-name-resolve", "--default_authentication_plugin=mysql_native_password" ] ports: - "3301:3306" mysql-server-2: - env_file: - - mysql-server.env + environment: + MYSQL_ROOT_PASSWORD: "mysql" + MYSQL_ROOT_HOST: "%" image: container-registry.oracle.com/mysql/community-server:latest command: [ "mysqld","--server_id=2","--binlog-transaction-dependency-tracking=WRITESET", "--binlog_checksum=NONE","--gtid_mode=ON","--enforce_gtid_consistency=ON","--log_bin","--log_slave_updates=ON","--master_info_repository=TABLE","--relay_log_info_repository=TABLE","--transaction_write_set_extraction=XXHASH64","--user=mysql","--skip-host-cache","--skip-name-resolve", "--default_authentication_plugin=mysql_native_password" ] ports: - "3302:3306" mysql-server-3: - env_file: - - mysql-server.env + environment: + MYSQL_ROOT_PASSWORD: "mysql" + MYSQL_ROOT_HOST: "%" image: container-registry.oracle.com/mysql/community-server:latest command: [ "mysqld","--server_id=3","--binlog-transaction-dependency-tracking=WRITESET", "--binlog_checksum=NONE","--gtid_mode=ON","--enforce_gtid_consistency=ON","--log_bin","--log_slave_updates=ON","--master_info_repository=TABLE","--relay_log_info_repository=TABLE","--transaction_write_set_extraction=XXHASH64","--user=mysql","--skip-host-cache","--skip-name-resolve", "--default_authentication_plugin=mysql_native_password" ] ports: @@ -44,26 +47,38 @@ services: platform: linux/amd64 build: context: ./mysql-shell + args: + MYSQL_SHELL_PACKAGER_URL: "https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-8.1.0-1.el7.x86_64.rpm" dockerfile: Dockerfile - env_file: - - mysql-shell.env + environment: + MYSQL_USER: "root" + MYSQL_HOST: "mysql-server-1" + MYSQL_PORT: "3306" + MYSQL_PASSWORD: "mysql" + MYSQLSH_SCRIPT: "/setupCluster.js" image: mysqlshell:${VERSION} depends_on: - mysql-server-1 - mysql-server-2 - mysql-server-3 -# -# DO NOT CHANGE APP NAME -# WE WILL HAVE TO CHANGE CERTIFICATES. -# + # + # DO NOT CHANGE APP NAME + # WE WILL HAVE TO CHANGE CERTIFICATES. + # mysql-router-http: platform: linux/amd64 build: context: ./mysql-router + args: + MYSQL_YUM_REPO_URL: https://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm dockerfile: Dockerfile_http - env_file: - - mysql-router.env + environment: + MYSQL_USER: "root" + MYSQL_HOST: "mysql-server-1" + MYSQL_PORT: "3306" + MYSQL_PASSWORD: mysql + MYSQL_INNODB_NUM_MEMBERS: 3 image: mysqlrouter-http:${VERSION} ports: - "8080:8080" @@ -73,17 +88,23 @@ services: - mysql-server-3 restart: on-failure -# -# DO NOT CHANGE APP NAME -# WE WILL HAVE TO CHANGE CERTIFICATES. -# + # + # DO NOT CHANGE APP NAME + # WE WILL HAVE TO CHANGE CERTIFICATES. + # mysql-router-https: platform: linux/amd64 build: context: ./mysql-router + args: + MYSQL_YUM_REPO_URL: https://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm dockerfile: Dockerfile_https - env_file: - - mysql-router.env + environment: + MYSQL_USER: "root" + MYSQL_HOST: "mysql-server-1" + MYSQL_PORT: "3306" + MYSQL_PASSWORD: mysql + MYSQL_INNODB_NUM_MEMBERS: 3 image: mysqlrouter-https:${VERSION} ports: - "8443:8443" diff --git a/test/mysql-router.env b/test/mysql-router.env deleted file mode 100644 index 5dbffb4..0000000 --- a/test/mysql-router.env +++ /dev/null @@ -1,5 +0,0 @@ -MYSQL_USER=root -MYSQL_HOST=mysql-server-1 -MYSQL_PORT=3306 -MYSQL_PASSWORD=mysql -MYSQL_INNODB_NUM_MEMBERS=3 \ No newline at end of file diff --git a/test/mysql-router/Dockerfile_http b/test/mysql-router/Dockerfile_http index b81c5d4..329253e 100644 --- a/test/mysql-router/Dockerfile_http +++ b/test/mysql-router/Dockerfile_http @@ -1,7 +1,9 @@ FROM oraclelinux:7-slim -RUN rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 \ - && yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm \ +ARG MYSQL_YUM_REPO_URL + +RUN yum install -y $MYSQL_YUM_REPO_URL \ + && yum-config-manager --enable mysql-innovation-community \ && yum install -y mysql-community-client mysql-router-community libpwquality \ && yum clean all diff --git a/test/mysql-router/Dockerfile_https b/test/mysql-router/Dockerfile_https index 122a6c6..d4be737 100644 --- a/test/mysql-router/Dockerfile_https +++ b/test/mysql-router/Dockerfile_https @@ -1,7 +1,9 @@ FROM oraclelinux:7-slim -RUN rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 \ - && yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm \ +ARG MYSQL_YUM_REPO_URL + +RUN yum install -y $MYSQL_YUM_REPO_URL \ + && yum-config-manager --enable mysql-innovation-community \ && yum install -y mysql-community-client mysql-router-community libpwquality \ && yum clean all diff --git a/test/mysql-router/run_http.sh b/test/mysql-router/run_http.sh index 610c636..de90676 100644 --- a/test/mysql-router/run_http.sh +++ b/test/mysql-router/run_http.sh @@ -2,6 +2,9 @@ set -e if [ "$1" = 'mysqlrouter' ]; then + + mysqlrouter --version + if [[ -z $MYSQL_HOST || -z $MYSQL_PORT || -z $MYSQL_USER || -z $MYSQL_PASSWORD ]]; then echo "We require all of" echo " MYSQL_HOST" diff --git a/test/mysql-server.env b/test/mysql-server.env deleted file mode 100644 index a3691cd..0000000 --- a/test/mysql-server.env +++ /dev/null @@ -1,2 +0,0 @@ -MYSQL_ROOT_PASSWORD=mysql -MYSQL_ROOT_HOST=% \ No newline at end of file diff --git a/test/mysql-shell.env b/test/mysql-shell.env deleted file mode 100644 index 614b8cc..0000000 --- a/test/mysql-shell.env +++ /dev/null @@ -1,5 +0,0 @@ -MYSQL_USER=root -MYSQL_HOST=mysql-server-1 -MYSQL_PORT=3306 -MYSQL_PASSWORD=mysql -MYSQLSH_SCRIPT=/setupCluster.js \ No newline at end of file diff --git a/test/mysql-shell/Dockerfile b/test/mysql-shell/Dockerfile index 95a44b4..dc12498 100644 --- a/test/mysql-shell/Dockerfile +++ b/test/mysql-shell/Dockerfile @@ -1,6 +1,6 @@ FROM oraclelinux:7-slim -ARG MYSQL_SHELL_PACKAGER_URL="https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-8.1.0-1.el7.x86_64.rpm" +ARG MYSQL_SHELL_PACKAGER_URL COPY run.sh /run.sh RUN chmod +x /run.sh