You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/04/06 15:34:14 UTC

[shardingsphere] branch master updated: Docker compose file improve (#9953)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 141582e  Docker compose file improve (#9953)
141582e is described below

commit 141582e1273e20ac8c988b6fa545b9b7ddbb16bb
Author: 孙念君 Sun Nianjun <ka...@outlook.com>
AuthorDate: Tue Apr 6 23:33:38 2021 +0800

    Docker compose file improve (#9953)
    
    * Refactor: refactor the container name and comment in docker compose file for shardingsphere example
    
    * Refactor: update the comment and default proxy port
    
    Co-authored-by: 孙念君 <su...@bizseer.com>
---
 examples/docker/docker-compose-zh.md               | 20 ++++++++---------
 .../sharding-jdbc/sharding/docker-compose.yml      | 20 ++++++++---------
 .../sharding-proxy/governance/docker-compose.yml   |  4 ++--
 .../sharding/conf/config-sharding.yaml             |  4 ++--
 .../sharding-proxy/sharding/docker-compose.yml     | 26 +++++++++++-----------
 5 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/examples/docker/docker-compose-zh.md b/examples/docker/docker-compose-zh.md
index 18e2a04..6b89cfd 100644
--- a/examples/docker/docker-compose-zh.md
+++ b/examples/docker/docker-compose-zh.md
@@ -4,18 +4,18 @@
 
 #### ShardingSphere-JDBC
 
-1. 运行'cd docker/shardingsphere-jdbc/sharding',进入docker文件夹
-2. 运行'docker-compose up -d',启动docker compose环境
-3. 根据需要,开启mysql/etcd/zookeeper
-4. 如果有端口冲突,在docker-compose.yml中修改相应的端口,然后再次使用'docker-compose up -d'启动docker compose
-5. 如果需要关闭程序,请使用命令'docker-compose down'
+1. 运行 'cd docker/shardingsphere-jdbc/sharding',进入 docker 文件夹
+2. 运行 'docker-compose up -d',启动 docker compose 环境
+3. 根据需要,开启 mysql/etcd/zookeeper
+4. 如果有端口冲突,在 docker-compose.yml 中修改相应的端口,然后再次使用 'docker-compose up -d' 启动 docker compose
+5. 如果需要关闭程序,请使用命令 'docker-compose down'
 
 #### ShardingSphere-Proxy
 
-1. 运行'cd docker/shardingsphere-proxy/sharding',进入docker文件夹
-2. 运行'docker-compose up -d',启动docker compose环境
+1. 运行 'cd docker/shardingsphere-proxy/sharding',进入 docker 文件夹
+2. 运行 'docker-compose up -d',启动 docker compose 环境
 3. 运行 `mysql -h127.0.0.1 -P13308 -proot -uroot` 登录代理
-4. 如果有端口冲突,在docker-compose.yml中修改相应的端口,然后再次使用'docker-compose up -d'启动docker compose
-5. 如果需要关闭程序,请使用命令'docker-compose down'
+4. 如果有端口冲突,在docker-compose.yml中修改相应的端口,然后再次使用 'docker-compose up -d'启动docker compose
+5. 如果需要关闭程序,请使用命令 'docker-compose down'
 
-需要注意,请谨慎使用docker删除指令`docker ps -a -q`去删除docker容器。
+需要注意,请谨慎使用 docker 删除指令`docker ps -a -q`去删除docker容器。
diff --git a/examples/docker/sharding-jdbc/sharding/docker-compose.yml b/examples/docker/sharding-jdbc/sharding/docker-compose.yml
index e6b34b0..1e7b7f6 100644
--- a/examples/docker/sharding-jdbc/sharding/docker-compose.yml
+++ b/examples/docker/sharding-jdbc/sharding/docker-compose.yml
@@ -18,19 +18,19 @@
 version: '3'
 services:
   mysql:
-    ## mysql version, you could get more tags at here : https://hub.docker.com/_/mysql?tab=tags
+    ## for different MySQL version, you could get more at here : https://hub.docker.com/_/mysql?tab=tags
     image: "mysql:5.7"
-    ## default port is 3306, you could change to 33060 or any other port doesn't conflict MySQL on your OS
+    ## port binding to 3306, you could change to 13306:3306 or any other available port you want
     ports:
       - "3306:3306"
-    container_name: sharding-sphere-mysql
-    ## launch mysql without password
-    ## you could access the mysql in container by following command :
-    ## docker exec -it sharding-sphere-mysql mysql -uroot
+    container_name: shardingsphere-example-mysql
+    ## launch MySQL without password
+    ## you could access MySQL like `mysql -h127.0.0.1 -P3306 -uroot`
+    ## if you insist to access MySQL with password, remove `MYSQL_ALLOW_EMPTY_PASSWORD=yes` and then use MYSQL_ROOT_PASSWORD argument
+    #  - MYSQL_ROOT_PASSWORD=root
     environment:
       - MYSQL_ALLOW_EMPTY_PASSWORD=yes
-    ## if you insist to use password in mysql, remove MYSQL_ALLOW_EMPTY_PASSWORD=yes and uncomment following args
-    #  - MYSQL_ROOT_PASSWORD=root
+    ## copy the manual_schema.sql to /docker-entrypoint-initdb.d/ . this will init the sql file when the MySQL in container start up
     volumes:
       - ../../../src/resources/manual_schema.sql:/docker-entrypoint-initdb.d/manual_schema.sql
 
@@ -39,7 +39,7 @@ services:
     image: "zookeeper:3.4"
     ports: 
       - "2181:2181"
-    container_name: sharding-sphere-zookeeper
+    container_name: shardingsphere-example-zookeeper
 
   etcd:
     ## get more versions of etcd here  : https://quay.io/repository/coreos/etcd?tag=latest&tab=tags
@@ -48,7 +48,7 @@ services:
       - "2379:2379"
       - "2380:2380"
       - "4001:4001"
-    container_name: sharding-sphere-etcd
+    container_name: shardingsphere-example-etcd
     entrypoint: /usr/local/bin/etcd
     command:
       - '--advertise-client-urls=http://0.0.0.0:2379'
diff --git a/examples/docker/sharding-proxy/governance/docker-compose.yml b/examples/docker/sharding-proxy/governance/docker-compose.yml
index f636e60..7acfd46 100644
--- a/examples/docker/sharding-proxy/governance/docker-compose.yml
+++ b/examples/docker/sharding-proxy/governance/docker-compose.yml
@@ -22,7 +22,7 @@ services:
     image: "zookeeper:3.4"
     ports:
       - "2181:2181"
-    container_name: sharding-sphere-zookeeper
+    container_name: shardingsphere-example-zookeeper
 
   etcd:
     ## get more versions of etcd here  : https://quay.io/repository/coreos/etcd?tag=latest&tab=tags
@@ -31,7 +31,7 @@ services:
       - "2379:2379"
       - "2380:2380"
       - "4001:4001"
-    container_name: sharding-sphere-etcd
+    container_name: shardingsphere-example-etcd
     entrypoint: /usr/local/bin/etcd
     command:
       - '--advertise-client-urls=http://0.0.0.0:2379'
diff --git a/examples/docker/sharding-proxy/sharding/conf/config-sharding.yaml b/examples/docker/sharding-proxy/sharding/conf/config-sharding.yaml
index 5095ef2..fab3f67 100644
--- a/examples/docker/sharding-proxy/sharding/conf/config-sharding.yaml
+++ b/examples/docker/sharding-proxy/sharding/conf/config-sharding.yaml
@@ -26,7 +26,7 @@ schemaName: sharding_db
 
 dataSources:
   ds_0:
-    url: jdbc:mysql://sharding-sphere-mysql:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
+    url: jdbc:mysql://shardingsphere-example-mysql:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
     username: root
     password:
     connectionTimeoutMilliseconds: 30000
@@ -34,7 +34,7 @@ dataSources:
     maxLifetimeMilliseconds: 1800000
     maxPoolSize: 50
   ds_1:
-    url: jdbc:mysql://sharding-sphere-mysql:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
+    url: jdbc:mysql://shardingsphere-example-mysql:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
     username: root
     password:
     connectionTimeoutMilliseconds: 30000
diff --git a/examples/docker/sharding-proxy/sharding/docker-compose.yml b/examples/docker/sharding-proxy/sharding/docker-compose.yml
index 0f855e3..472e76e 100644
--- a/examples/docker/sharding-proxy/sharding/docker-compose.yml
+++ b/examples/docker/sharding-proxy/sharding/docker-compose.yml
@@ -18,35 +18,35 @@
 version: '3'
 services:
   mysql:
-    ## mysql version, you could get more tags at here : https://hub.docker.com/_/mysql?tab=tags
+    ## for different MySQL version, you could get more at here : https://hub.docker.com/_/mysql?tab=tags
     image: "mysql:5.7"
-    ## default port is 3306, you could change to 33060 or any other port doesn't conflict MySQL on your OS
+    ## port binding to 3306, you could change to 13306:3306 or any other available port you want
     ports:
-     - "33060:3306"
-    container_name: sharding-sphere-mysql
-    ## launch mysql without password
-    ## you could access the mysql in container by following command :
-    ## docker exec -it sharding-sphere-mysql mysql -uroot
+      - "3306:3306"
+    container_name: shardingsphere-example-mysql
+    ## launch MySQL without password
+    ## you could access MySQL like `mysql -h127.0.0.1 -P3306 -uroot`
+    ## if you insist to access MySQL with password, remove `MYSQL_ALLOW_EMPTY_PASSWORD=yes` and then use MYSQL_ROOT_PASSWORD argument
+    #  - MYSQL_ROOT_PASSWORD=root
     environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
-    ## if you insist to use password in mysql, remove MYSQL_ALLOW_EMPTY_PASSWORD=yes and uncomment following args
-    #  - MYSQL_ROOT_PASSWORD=root
+    ## copy the manual_schema.sql to /docker-entrypoint-initdb.d/ . this will init the sql file when the MySQL in container start up
     volumes:
       - ../../../src/resources/manual_schema.sql:/docker-entrypoint-initdb.d/manual_schema.sql
 
   proxy:
     ## get more versions of proxy here : https://hub.docker.com/r/apache/sharding-proxy/tags
     image: "apache/sharding-proxy:4.1.1"
-    container_name: sharding-sphere-proxy
+    container_name: shardingsphere-example-proxy
     depends_on:
      - mysql
-    ## wait-for-it.sh will make proxy entry point wait until mysql container 3306 port open
+    ## wait-for-it.sh will make proxy entry point wait until MySQL container 3306 port open
     entrypoint: >
-     /bin/sh -c "/opt/wait-for-it.sh sharding-sphere-mysql:3306 --timeout=20 --strict --
+     /bin/sh -c "/opt/wait-for-it.sh shardingsphere-example-mysql:3306 --timeout=20 --strict --
      && /opt/sharding-proxy/bin/start.sh 3308 
      && tail -f /opt/sharding-proxy/logs/stdout.log"
     ports: 
-     - "13308:3308"
+     - "3308:3308"
     links:
      - "mysql:mysql"
     volumes: