Skip to content

Commit eaa8f69

Browse files
committed
test: add tidb docker compose
1 parent 9384574 commit eaa8f69

File tree

6 files changed

+109
-0
lines changed

6 files changed

+109
-0
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
pull_request_target:
88
branches:
99
- main
10+
pull_request:
11+
branches:
12+
- main
1013

1114
jobs:
1215
test:
@@ -19,6 +22,13 @@ jobs:
1922
uses: astral-sh/setup-uv@v5
2023
with:
2124
enable-cache: true
25+
- name: Set up TiDB
26+
uses: hoverkraft-tech/[email protected]
27+
with:
28+
compose-file: docker/tidb/docker-compose.yaml
29+
services: |
30+
tidb
31+
tiflash
2232
- name: Install dependencies
2333
run: uv sync --all-extras --dev
2434
- name: Run Lint

docker/tidb/config/pd.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# PD Configuration File reference:
2+
# https://docs.pingcap.com/tidb/stable/pd-configuration-file#pd-configuration-file
3+
[replication]
4+
max-replicas = 1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# TiFlash tiflash-learner.toml Configuration File reference:
2+
# https://docs.pingcap.com/tidb/stable/tiflash-configuration#configure-the-tiflash-learnertoml-file
3+
4+
log-file = "/logs/tiflash_tikv.log"
5+
6+
[server]
7+
engine-addr = "tiflash:4030"
8+
addr = "0.0.0.0:20280"
9+
advertise-addr = "tiflash:20280"
10+
status-addr = "tiflash:20292"
11+
12+
[storage]
13+
data-dir = "/data/flash"

docker/tidb/config/tiflash.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# TiFlash tiflash.toml Configuration File reference:
2+
# https://docs.pingcap.com/tidb/stable/tiflash-configuration#configure-the-tiflashtoml-file
3+
4+
listen_host = "0.0.0.0"
5+
path = "/data"
6+
7+
[flash]
8+
tidb_status_addr = "tidb:10080"
9+
service_addr = "tiflash:4030"
10+
11+
[flash.proxy]
12+
config = "/tiflash-learner.toml"
13+
14+
[logger]
15+
errorlog = "/logs/tiflash_error.log"
16+
log = "/logs/tiflash.log"
17+
18+
[raft]
19+
pd_addr = "pd0:2379"

docker/tidb/docker-compose.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
services:
2+
pd0:
3+
image: pingcap/pd:v8.5.1
4+
ports:
5+
- "2379"
6+
volumes:
7+
- ./config/pd.toml:/pd.toml:ro
8+
- ./volumes/data:/data
9+
- ./volumes/logs:/logs
10+
command:
11+
- --name=pd0
12+
- --client-urls=http://0.0.0.0:2379
13+
- --peer-urls=http://0.0.0.0:2380
14+
- --advertise-client-urls=http://pd0:2379
15+
- --advertise-peer-urls=http://pd0:2380
16+
- --initial-cluster=pd0=http://pd0:2380
17+
- --data-dir=/data/pd
18+
- --config=/pd.toml
19+
- --log-file=/logs/pd.log
20+
restart: on-failure
21+
tikv:
22+
image: pingcap/tikv:v8.5.1
23+
volumes:
24+
- ./volumes/data:/data
25+
- ./volumes/logs:/logs
26+
command:
27+
- --addr=0.0.0.0:20160
28+
- --advertise-addr=tikv:20160
29+
- --status-addr=tikv:20180
30+
- --data-dir=/data/tikv
31+
- --pd=pd0:2379
32+
- --log-file=/logs/tikv.log
33+
depends_on:
34+
- "pd0"
35+
restart: on-failure
36+
tidb:
37+
image: pingcap/tidb:v8.5.1
38+
ports:
39+
- "4000:4000"
40+
volumes:
41+
- ./volumes/logs:/logs
42+
command:
43+
- --advertise-address=tidb
44+
- --store=tikv
45+
- --path=pd0:2379
46+
- --log-file=/logs/tidb.log
47+
depends_on:
48+
- "tikv"
49+
restart: on-failure
50+
tiflash:
51+
image: pingcap/tiflash:v8.5.1
52+
volumes:
53+
- ./config/tiflash.toml:/tiflash.toml:ro
54+
- ./config/tiflash-learner.toml:/tiflash-learner.toml:ro
55+
- ./volumes/data:/data
56+
- ./volumes/logs:/logs
57+
command:
58+
- --config=/tiflash.toml
59+
depends_on:
60+
- "tikv"
61+
- "tidb"
62+
restart: on-failure

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ exclude = [
6666
"/docs",
6767
"/examples",
6868
"/tests",
69+
"/docker",
6970
]
7071

7172
[tool.hatch.metadata]

0 commit comments

Comments
 (0)