From 19105626db002e2134683e751093e2c75d0a0b34 Mon Sep 17 00:00:00 2001 From: moonfeeling Date: Mon, 1 Nov 2021 17:23:41 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9docker-compose.yml?= =?UTF-8?q?=EF=BC=9A=E4=BD=BF=E5=AE=B9=E5=99=A8=E5=86=85=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=92=8C=E6=97=B6=E5=8C=BA=E8=AE=BE=E7=BD=AE=E4=B8=8E=E5=AE=BF?= =?UTF-8?q?=E4=B8=BB=E6=9C=BA=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 3918e6d..cfe8ed7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,8 @@ services: - '8080:8080' volumes: - .:/app/work + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro command: ['/app/dtm/main', 'dev'] working_dir: /app/work extra_hosts: From 40c1cb59897c1f21a6bcb72d809c3733bc30a51b Mon Sep 17 00:00:00 2001 From: yedf2 <43027375+yedf2@users.noreply.github.com> Date: Mon, 1 Nov 2021 21:42:47 +0800 Subject: [PATCH 2/7] update quick start update quick start --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ea51ca5..78aac58 100644 --- a/README.md +++ b/README.md @@ -66,15 +66,19 @@ DTM是一款golang开发的分布式事务管理器,解决了跨数据库、 ## 快速开始 -### 安装 +### 获取代码 `git clone https://github.com/yedf/dtm` ### dtm依赖于mysql -配置mysql: +安装[docker 20.04+](https://docs.docker.com/get-docker/)之后 -`cp conf.sample.yml conf.yml # 修改conf.yml` +`docker-compose helper/compose.mysql.yml` + +> 您也可以配置使用现有的mysql,需要高级权限,允许dtm创建数据库 +> +> `cp conf.sample.yml conf.yml # 修改conf.yml` ### 启动并运行saga示例 `go run app/main.go saga` From 6bf8ee003c369c13aae0951f3405b280e11ad388 Mon Sep 17 00:00:00 2001 From: yedf2 <43027375+yedf2@users.noreply.github.com> Date: Mon, 1 Nov 2021 21:45:44 +0800 Subject: [PATCH 3/7] update readme update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78aac58..a3aa9d7 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ DTM是一款golang开发的分布式事务管理器,解决了跨数据库、 安装[docker 20.04+](https://docs.docker.com/get-docker/)之后 -`docker-compose helper/compose.mysql.yml` +`docker-compose helper/compose.mysql.yml up` > 您也可以配置使用现有的mysql,需要高级权限,允许dtm创建数据库 > From 84547e8b42601cd2ef5c7ffa519540eded54263d Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Mon, 1 Nov 2021 22:44:54 +0800 Subject: [PATCH 4/7] compose files add timezone --- docker-compose.yml | 5 ++-- helper/compose.cloud.yml | 10 +++++-- ...docker-compose.dev.yml => compose.dev.yml} | 10 +++++-- helper/compose.mysql.yml | 5 ++-- helper/compose.postgres.yml | 3 ++ helper/compose.qs.yml | 28 +++++++++++++++++++ 6 files changed, 53 insertions(+), 8 deletions(-) rename helper/{docker-compose.dev.yml => compose.dev.yml} (69%) create mode 100644 helper/compose.qs.yml diff --git a/docker-compose.yml b/docker-compose.yml index cfe8ed7..85a4429 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,12 +18,13 @@ services: image: 'mysql:5.7' environment: MYSQL_ALLOW_EMPTY_PASSWORD: 1 - TZ: Asia/shanghai + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', - '--default-time-zone=+8:00', ] ports: - '3306:3306' diff --git a/helper/compose.cloud.yml b/helper/compose.cloud.yml index 9d65062..1336052 100644 --- a/helper/compose.cloud.yml +++ b/helper/compose.cloud.yml @@ -2,6 +2,11 @@ version: '3.3' services: api: build: .. + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + extra_hosts: + - 'host.docker.internal:host-gateway' environment: IS_DOCKER: 1 DISABLE_LOCALHOST: 1 @@ -12,14 +17,15 @@ services: - ..:/app/dtm mysql: image: 'mysql:5.7' + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro environment: MYSQL_ALLOW_EMPTY_PASSWORD: 1 - TZ: Asia/shanghai command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', - '--default-time-zone=+8:00', ] ports: - '3306:3306' diff --git a/helper/docker-compose.dev.yml b/helper/compose.dev.yml similarity index 69% rename from helper/docker-compose.dev.yml rename to helper/compose.dev.yml index 77e18a9..a576f88 100644 --- a/helper/docker-compose.dev.yml +++ b/helper/compose.dev.yml @@ -2,6 +2,11 @@ version: '3.3' services: api: image: golang:1.16.6-alpine3.14 + extra_hosts: + - 'host.docker.internal:host-gateway' + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro environment: IS_DOCKER: '1' GOPROXY: 'https://mirrors.aliyun.com/goproxy/,direct' @@ -14,14 +19,15 @@ services: working_dir: /app/work mysql: image: 'mysql:5.7' + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro environment: MYSQL_ALLOW_EMPTY_PASSWORD: 1 - TZ: Asia/shanghai command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', - '--default-time-zone=+8:00', ] ports: - '3306:3306' diff --git a/helper/compose.mysql.yml b/helper/compose.mysql.yml index c640fa0..0c5ec71 100644 --- a/helper/compose.mysql.yml +++ b/helper/compose.mysql.yml @@ -2,14 +2,15 @@ version: '3.3' services: mysql: image: 'mysql:5.7' + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro environment: MYSQL_ALLOW_EMPTY_PASSWORD: 1 - TZ: Asia/shanghai command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', - '--default-time-zone=+8:00', ] ports: - '3306:3306' diff --git a/helper/compose.postgres.yml b/helper/compose.postgres.yml index 11b409e..dc80e61 100644 --- a/helper/compose.postgres.yml +++ b/helper/compose.postgres.yml @@ -3,6 +3,9 @@ services: postgres: image: 'postgres:13' command: postgres --max_prepared_transactions=1000 + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro environment: POSTGRES_PASSWORD: mysecretpassword diff --git a/helper/compose.qs.yml b/helper/compose.qs.yml new file mode 100644 index 0000000..c1a4203 --- /dev/null +++ b/helper/compose.qs.yml @@ -0,0 +1,28 @@ +version: '3.3' +services: + api: + image: 'yedf/dtm' + environment: + IS_DOCKER: '1' + ports: + - '8080:8080' + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + command: ['/app/dtm/main', 'qs'] + extra_hosts: + - 'host.docker.internal:host-gateway' + db: + image: 'mysql:5.7' + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: 1 + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + command: + [ + '--character-set-server=utf8mb4', + '--collation-server=utf8mb4_unicode_ci', + ] + ports: + - '3306:3306' From 97f9b5904e580d73bafc07ec17fc199e9338bf9c Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Mon, 1 Nov 2021 22:48:24 +0800 Subject: [PATCH 5/7] compose qs updated --- helper/compose.qs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helper/compose.qs.yml b/helper/compose.qs.yml index c1a4203..b055f4e 100644 --- a/helper/compose.qs.yml +++ b/helper/compose.qs.yml @@ -7,9 +7,11 @@ services: ports: - '8080:8080' volumes: + - ..:/app/work - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro command: ['/app/dtm/main', 'qs'] + working_dir: /app/work extra_hosts: - 'host.docker.internal:host-gateway' db: From 3cb83f18880055fe6f1bd805ebd141fae5904f87 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Mon, 1 Nov 2021 22:57:27 +0800 Subject: [PATCH 6/7] qs and dev ok --- helper/compose.dev.yml | 1 + helper/compose.qs.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/helper/compose.dev.yml b/helper/compose.dev.yml index a576f88..d904d35 100644 --- a/helper/compose.dev.yml +++ b/helper/compose.dev.yml @@ -12,6 +12,7 @@ services: GOPROXY: 'https://mirrors.aliyun.com/goproxy/,direct' ports: - '8080:8080' + - '8082:8082' - '58080:58080' volumes: - ..:/app/work diff --git a/helper/compose.qs.yml b/helper/compose.qs.yml index b055f4e..2b50a8b 100644 --- a/helper/compose.qs.yml +++ b/helper/compose.qs.yml @@ -6,6 +6,8 @@ services: IS_DOCKER: '1' ports: - '8080:8080' + - '8082:8082' + - '58080:58080' volumes: - ..:/app/work - /etc/localtime:/etc/localtime:ro From 3344eb782c2c24d2f089778ec5df36066499d288 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Mon, 1 Nov 2021 23:09:48 +0800 Subject: [PATCH 7/7] update readme --- README-cn.md | 14 +++++++++----- README.md | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README-cn.md b/README-cn.md index ea51ca5..d1be61c 100644 --- a/README-cn.md +++ b/README-cn.md @@ -66,18 +66,22 @@ DTM是一款golang开发的分布式事务管理器,解决了跨数据库、 ## 快速开始 -### 安装 +### 获取代码 -`git clone https://github.com/yedf/dtm` +`git clone https://github.com/yedf/dtm && cd dtm` ### dtm依赖于mysql -配置mysql: +安装[docker 20.04+](https://docs.docker.com/get-docker/)之后 -`cp conf.sample.yml conf.yml # 修改conf.yml` +`docker-compose -f helper/compose.mysql.yml up` + +> 您也可以配置使用现有的mysql,需要高级权限,允许dtm创建数据库 +> +> `cp conf.sample.yml conf.yml # 修改conf.yml` ### 启动并运行saga示例 -`go run app/main.go saga` +`go run app/main.go qs` ## 开始使用 diff --git a/README.md b/README.md index a3aa9d7..d1be61c 100644 --- a/README.md +++ b/README.md @@ -68,20 +68,20 @@ DTM是一款golang开发的分布式事务管理器,解决了跨数据库、 ### 获取代码 -`git clone https://github.com/yedf/dtm` +`git clone https://github.com/yedf/dtm && cd dtm` ### dtm依赖于mysql 安装[docker 20.04+](https://docs.docker.com/get-docker/)之后 -`docker-compose helper/compose.mysql.yml up` +`docker-compose -f helper/compose.mysql.yml up` > 您也可以配置使用现有的mysql,需要高级权限,允许dtm创建数据库 > > `cp conf.sample.yml conf.yml # 修改conf.yml` ### 启动并运行saga示例 -`go run app/main.go saga` +`go run app/main.go qs` ## 开始使用