Skip to content

Commit 94fff95

Browse files
committed
wip
1 parent 64a2cdb commit 94fff95

20 files changed

+244
-64
lines changed

.github/workflows/buildandrun-docker.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ jobs:
1212
uses: actions/checkout@v4
1313

1414
- name: Build and Run Spirit
15-
run: docker compose -f docker/compose.yml -f docker/buildandrun.yml up --abort-on-container-exit
15+
run: docker compose up mysql buildandrun --abort-on-container-exit
16+
working-directory: compose
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: MySQL 8.0.33 (with replicas) /w docker-compose
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Test
15+
run: docker compose -f compose.yml mysql mysql_replica test --abort-on-container-exit
16+
working-directory: compose/replication

.github/workflows/mysql8.0.28-docker.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ jobs:
1212
uses: actions/checkout@v4
1313

1414
- name: Test
15-
run: docker compose -f docker/compose.yml -f docker/8.0.28.yml -f docker/test.yml up --abort-on-container-exit
15+
run: docker compose -f compose.yml -f 8.0.28.yml up mysql test --abort-on-container-exit
16+
working-directory: compose
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: MySQL 8.4 GA /w docker-compose
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Test
15+
run: docker compose -f compose.yml -f 8.4.yml up mysql mysql_replica test --abort-on-container-exit
16+
working-directory: compose/replication

.github/workflows/mysql8_rbr_minimal_docker.yml renamed to .github/workflows/mysql8_rbr_minimal-docker.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ jobs:
1212
uses: actions/checkout@v4
1313

1414
- name: Test
15-
run: docker compose -f docker/compose.yml -f docker/8.0.33-rbr-minimal.yml -f docker/test.yml up --abort-on-container-exit
15+
run: docker compose -f compose.yml -f 8.0.33-rbr-minimal.yml up mysql test --abort-on-container-exit
16+
working-directory: compose
File renamed without changes.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
services:
22
mysql:
3-
ports: [ '8333:3306' ]
3+
image: mysql:8.0.33
4+
ports: [ '8033:3306' ]
45
command: --binlog-row-image=MINIMAL

compose/bootstrap.sql

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use mysql;
2+
3+
create role if not exists R_DO_IT_ALL;
4+
grant all on *.* to R_DO_IT_ALL;
5+
create user if not exists msandbox@'%' identified with caching_sha2_password by 'msandbox';
6+
7+
grant R_DO_IT_ALL to msandbox@'%' ;
8+
set default role R_DO_IT_ALL to msandbox@'%';
9+
10+
11+
create role if not exists R_REPLICATION;
12+
grant REPLICATION SLAVE, REPLICATION CLIENT on *.* to R_REPLICATION;
13+
create role if not exists R_THROTTLER;
14+
grant SELECT on performance_schema.replication_applier_status_by_worker to R_THROTTLER;
15+
grant SELECT on performance_schema.replication_connection_status to R_THROTTLER;
16+
create user if not exists rsandbox@'%' identified with caching_sha2_password by 'rsandbox';
17+
grant R_REPLICATION, R_THROTTLER to rsandbox@'%';
18+
set default role R_REPLICATION, R_THROTTLER to rsandbox@'%';
19+
20+
flush privileges;
21+
22+
create database if not exists test;
23+
24+
use test;
25+
26+
create table t1
27+
(
28+
id int not null primary key auto_increment,
29+
b int not null,
30+
c int not null
31+
);

compose/compose.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
services:
2+
mysql:
3+
image: mysql:8.0.33
4+
ports: [ '8033:3306' ]
5+
# to supress mbind: Operation not permitted in CI
6+
# https://stackoverflow.com/a/55706057
7+
cap_add:
8+
- SYS_NICE
9+
environment:
10+
MYSQL_ROOT_PASSWORD: msandbox
11+
healthcheck:
12+
test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD
13+
start_period: 1s
14+
interval: 1s
15+
timeout: 2s
16+
retries: 60
17+
volumes:
18+
- mysql-standalone-data-dir:/var/lib/mysql
19+
- ./bootstrap.sql:/docker-entrypoint-initdb.d/bootstrap.sql
20+
21+
test:
22+
build:
23+
context: ../
24+
command: go test -race -v ./...
25+
depends_on:
26+
mysql:
27+
condition: service_healthy
28+
environment:
29+
MYSQL_DSN: msandbox:msandbox@tcp(mysql)/test
30+
31+
buildandrun:
32+
build:
33+
context: ../
34+
command: scripts/buildandrun.sh
35+
depends_on:
36+
mysql:
37+
condition: service_healthy
38+
environment:
39+
HOST: mysql:3306
40+
USERNAME: msandbox
41+
PASSWORD: msandbox
42+
DATABASE: test
43+
TABLE: t1
44+
45+
volumes:
46+
mysql-standalone-data-dir:

compose/replication/8.0.28.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
mysql:
3+
image: mysql:8.0.28
4+
platform: linux/amd64
5+
ports: [ '8028:3306' ]
6+
mysql_replica:
7+
image: mysql:8.0.28
8+
platform: linux/amd64
9+
ports: [ '8128:3306' ]

0 commit comments

Comments
 (0)