Browse Source

merge main to alpha

pull/52/head
yedf2 4 years ago
parent
commit
a7f2349d77
  1. 6
      README-cn.md
  2. 14
      README.md
  3. 7
      docker-compose.yml
  4. 10
      helper/compose.cloud.yml
  5. 11
      helper/compose.dev.yml
  6. 5
      helper/compose.mysql.yml
  7. 3
      helper/compose.postgres.yml
  8. 32
      helper/compose.qs.yml

6
README-cn.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`
`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`
## 开始使用

14
README.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`
## 开始使用

7
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:
@ -16,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'

10
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'

11
helper/docker-compose.dev.yml → helper/compose.dev.yml

@ -2,11 +2,17 @@ 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'
ports:
- '8080:8080'
- '8082:8082'
- '58080:58080'
volumes:
- ..:/app/work
@ -14,14 +20,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'

5
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'

3
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

32
helper/compose.qs.yml

@ -0,0 +1,32 @@
version: '3.3'
services:
api:
image: 'yedf/dtm'
environment:
IS_DOCKER: '1'
ports:
- '8080:8080'
- '8082:8082'
- '58080:58080'
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:
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'
Loading…
Cancel
Save