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/.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 ------------------------------- diff --git a/test/.env b/test/.env index 0bba8e1..7066f7d 100644 --- a/test/.env +++ b/test/.env @@ -1 +1 @@ -VERSION=8.0.32 \ No newline at end of file +VERSION=8.1.0 \ 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/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 ebd59fc..e3f6c40 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -14,26 +14,31 @@ 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} + 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 - image: mysql/mysql-server:${VERSION} + 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 - image: mysql/mysql-server:${VERSION} + 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: - "3303:3306" @@ -42,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" @@ -71,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 e36c02a..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 yum install http://dev.mysql.com/get/mysql80-community-release-el7-3.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 c34b4e2..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 yum install http://dev.mysql.com/get/mysql80-community-release-el7-3.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 486597b..dc12498 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/Downloads/MySQL-Shell/mysql-shell-8.0.29-1.el7.x86_64.rpm" +ARG MYSQL_SHELL_PACKAGER_URL 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"