Skip to content

Commit

Permalink
Merge pull request #156 from rafsaf/add-mysql-8.1-maria-11
Browse files Browse the repository at this point in the history
Add mysql 8.1 maria 11.1
  • Loading branch information
rafsaf authored Oct 10, 2023
2 parents 3ee6d8d + c69f1eb commit 2efc61b
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ POSTGRESQL_DB_PG_14=host=localhost port=10014 password=password-_-12!@#%^&*()/;>
POSTGRESQL_DB_PG_13=host=localhost port=10013 password=password-_-12!@#%^&*()/;><.,]}{[ user=user-_-12!@#%^&*()/;><.,]}{[ db=database-_-12!@#%^&*()/;><.,]}{[ cron_rule=* * * * *
MYSQL_DB_TEST_57=host=localhost port=10057 password=password-_-12!@#%^&*()/;><.,]}{[ user=user-_-12!@#%^&*()/;><.,]}{[ db=database-_-12!@#%^&*()/;><.,]}{[ cron_rule=* * * * *
MYSQL_DB_TEST_80=host=localhost port=10080 password=password-_-12!@#%^&*()/;><.,]}{[ user=user-_-12!@#%^&*()/;><.,]}{[ db=database-_-12!@#%^&*()/;><.,]}{[ cron_rule=* * * * *
MYSQL_DB_TEST_81=host=localhost port=10081 password=password-_-12!@#%^&*()/;><.,]}{[ user=user-_-12!@#%^&*()/;><.,]}{[ db=database-_-12!@#%^&*()/;><.,]}{[ cron_rule=* * * * *
MARIADB_DB_TEST_1101=host=localhost port=11101 password=password-_-12!@#%^&*()/;><.,]}{[ user=user-_-12!@#%^&*()/;><.,]}{[ db=database-_-12!@#%^&*()/;><.,]}{[ cron_rule=* * * * *
MARIADB_DB_TEST_1011=host=localhost port=11011 password=password-_-12!@#%^&*()/;><.,]}{[ user=user-_-12!@#%^&*()/;><.,]}{[ db=database-_-12!@#%^&*()/;><.,]}{[ cron_rule=* * * * *
MARIADB_DB_TEST_1006=host=localhost port=11006 password=password-_-12!@#%^&*()/;><.,]}{[ user=user-_-12!@#%^&*()/;><.,]}{[ db=database-_-12!@#%^&*()/;><.,]}{[ cron_rule=* * * * *
#SINGLEFILE_MY_TEST_FILE=abs_path=/home/somefolder/somefile cron_rule=* * * * *
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: touch .env

- name: Download and start db containers
run: docker compose up -d postgres_16 postgres_15 postgres_14 postgres_13 postgres_12 postgres_11 mysql_57 mysql_80 mariadb_1011 mariadb_1006 mariadb_1005 mariadb_1004
run: docker compose up -d postgres_16 postgres_15 postgres_14 postgres_13 postgres_12 postgres_11 mysql_57 mysql_80 mysql_81 mariadb_1101 mariadb_1011 mariadb_1006 mariadb_1005 mariadb_1004

- name: Build image and run tests in container
run: docker compose run --rm --build backuper_tests_${{ matrix.arch }}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Both upload providers and backup targets were created with possibility to easly

5. Setup databases

`docker compose up -d postgres_16 postgres_15 postgres_14 postgres_13 postgres_12 postgres_11 mysql_57 mysql_80 mariadb_1011 mariadb_1006 mariadb_1005 mariadb_1004`
`docker compose up -d postgres_16 postgres_15 postgres_14 postgres_13 postgres_12 postgres_11 mysql_57 mysql_80 mysql_81 mariadb_1011 mariadb_1006 mariadb_1005 mariadb_1004`

6. You can run backuper (`--single` here to make all backups immediatly and then exit):

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Backups are in `zip` format using [7-zip](https://www.7-zip.org/), with strong A
## Supported backup targets

- PostgreSQL (tested on 16, 15, 14, 13, 12, 11)
- MySQL (tested on 8.0, 5.7)
- MariaDB (tested on 10.11, 10.6, 10.5, 10.4)
- MySQL (tested on 8.1, 8.0, 5.7)
- MariaDB (tested on 11.1, 10.11, 10.6, 10.5, 10.4)
- Single file
- Directory

Expand Down
2 changes: 1 addition & 1 deletion backuper/backup_targets/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _backup(self) -> Path:

db = shlex.quote(self.db)
shell_mysqldump_db = (
f"mysqldump --defaults-file={self.option_file} "
f"mariadb-dump --defaults-file={self.option_file} "
f"--result-file={out_file} --verbose {db}"
)
log.debug("start mysqldump in subprocess: %s", shell_mysqldump_db)
Expand Down
36 changes: 34 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# also used in GH workflows
# set up dbs
# docker compose up -d postgres_16 postgres_15 postgres_14 postgres_13 postgres_12 postgres_11 mysql_57 mysql_80 mariadb_1011 mariadb_1006 mariadb_1005 mariadb_1004
# docker compose up -d postgres_16 postgres_15 postgres_14 postgres_13 postgres_12 postgres_11 mysql_57 mysql_80 mysql_81 mariadb_1101 mariadb_1011 mariadb_1006 mariadb_1005 mariadb_1004
# run tests amd64
# docker compose run --rm --build backuper_tests_amd64
# run tests arm64 see https://docs.docker.com/build/building/multi-platform/
Expand Down Expand Up @@ -83,7 +83,7 @@ services:

mysql_80:
restart: "no"
image: mysql:8.0.33
image: mysql:8.0.34
environment:
- MYSQL_ROOT_PASSWORD=root-password-_-12!@#%^&*()/;><.,]}{[
- MYSQL_DATABASE=database-_-12!@#%^&*()/;><.,]}{[
Expand All @@ -92,6 +92,28 @@ services:
ports:
- 10080:3306

mysql_81:
restart: "no"
image: mysql:8.1.0
environment:
- MYSQL_ROOT_PASSWORD=root-password-_-12!@#%^&*()/;><.,]}{[
- MYSQL_DATABASE=database-_-12!@#%^&*()/;><.,]}{[
- MYSQL_USER=user-_-12!@#%^&*()/;><.,]}{[
- MYSQL_PASSWORD=password-_-12!@#%^&*()/;><.,]}{[
ports:
- 10081:3306

mariadb_1101:
restart: "no"
image: mariadb:11.1.2
environment:
- MARIADB_ROOT_PASSWORD=root-password-_-12!@#%^&*()/;><.,]}{[
- MARIADB_DATABASE=database-_-12!@#%^&*()/;><.,]}{[
- MARIADB_USER=user-_-12!@#%^&*()/;><.,]}{[
- MARIADB_PASSWORD=password-_-12!@#%^&*()/;><.,]}{[
ports:
- 11101:3306

mariadb_1011:
restart: "no"
image: mariadb:10.11.2
Expand Down Expand Up @@ -148,6 +170,8 @@ services:
- postgres_11
- mysql_57
- mysql_80
- mysql_81
- mariadb_1101
- mariadb_1011
- mariadb_1006
- mariadb_1005
Expand All @@ -172,6 +196,8 @@ services:
- postgres_11
- mysql_57
- mysql_80
- mysql_81
- mariadb_1101
- mariadb_1011
- mariadb_1006
- mariadb_1005
Expand All @@ -196,6 +222,8 @@ services:
- postgres_11
- mysql_57
- mysql_80
- mysql_81
- mariadb_1101
- mariadb_1011
- mariadb_1006
- mariadb_1005
Expand All @@ -221,6 +249,8 @@ services:
- postgres_11
- mysql_57
- mysql_80
- mysql_81
- mariadb_1101
- mariadb_1011
- mariadb_1006
- mariadb_1005
Expand All @@ -246,6 +276,8 @@ services:
- postgres_11
- mysql_57
- mysql_80
- mysql_81
- mariadb_1101
- mariadb_1011
- mariadb_1006
- mariadb_1005
Expand Down
2 changes: 1 addition & 1 deletion docs/backup_targets/mariadb.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MARIADB_SOME_STRING="host=... password=... cron_rule=..."
```

!!! note
_Any environment variable that starts with "**MARIADB_**" will be handled as MariaDB._ There can be multiple files paths definition for one backuper instance, for example `MARIADB_FOO_MY_DB1` and `MARIADB_BAR_MY_DB2`. Supported versions are: 10.11, 10.6, 10.5, 10.4. Params must be included in value, splited by single space for example `"value1=1 value2=foo"`.
_Any environment variable that starts with "**MARIADB_**" will be handled as MariaDB._ There can be multiple files paths definition for one backuper instance, for example `MARIADB_FOO_MY_DB1` and `MARIADB_BAR_MY_DB2`. Supported versions are: 11.1, 10.11, 10.6, 10.5, 10.4. Params must be included in value, splited by single space for example `"value1=1 value2=foo"`.

## Params

Expand Down
2 changes: 1 addition & 1 deletion docs/backup_targets/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MYSQL_SOME_STRING="host=... password=... cron_rule=..."
```

!!! note
_Any environment variable that starts with "**MYSQL_**" will be handled as MySQL._ There can be multiple files paths definition for one backuper instance, for example `MYSQL_FOO_MY_DB1` and `MYSQL_BAR_MY_DB2`. Supported versions are: 8.0, 5.7. Params must be included in value, splited by single space for example `"value1=1 value2=foo"`.
_Any environment variable that starts with "**MYSQL_**" will be handled as MySQL._ There can be multiple files paths definition for one backuper instance, for example `MYSQL_FOO_MY_DB1` and `MYSQL_BAR_MY_DB2`. Supported versions are: 8.1, 8.0, 5.7. Params must be included in value, splited by single space for example `"value1=1 value2=foo"`.

## Params

Expand Down
24 changes: 23 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@
db="database-_-12!@#%^&*()/;><.,]}{[",
user="user-_-12!@#%^&*()/;><.,]}{[",
)
MYSQL_81 = MySQLTargetModel(
env_name="mysql_db_81",
cron_rule="* * * * *",
host="mysql_81" if DOCKER_TESTS else "localhost",
port=3306 if DOCKER_TESTS else 10081,
password=SecretStr("password-_-12!@#%^&*()/;><.,]}{["),
db="database-_-12!@#%^&*()/;><.,]}{[",
user="user-_-12!@#%^&*()/;><.,]}{[",
)
MARIADB_1101 = MariaDBTargetModel(
env_name="mariadb_1101",
cron_rule="* * * * *",
host="mariadb_1101" if DOCKER_TESTS else "localhost",
port=3306 if DOCKER_TESTS else 11101,
password=SecretStr("password-_-12!@#%^&*()/;><.,]}{["),
db="database-_-12!@#%^&*()/;><.,]}{[",
user="user-_-12!@#%^&*()/;><.,]}{[",
)
MARIADB_1011 = MariaDBTargetModel(
env_name="mariadb_1011",
cron_rule="* * * * *",
Expand Down Expand Up @@ -144,8 +162,10 @@
"postgresql_db_13": "13.12",
"postgresql_db_12": "12.16",
"postgresql_db_11": "11.21",
"mysql_db_80": "8.0.33",
"mysql_db_81": "8.1.0",
"mysql_db_80": "8.0.34",
"mysql_db_57": "5.7.42",
"mariadb_1101": "11.1.2",
"mariadb_1011": "10.11.2",
"mariadb_1006": "10.6.12",
"mariadb_1005": "10.5.19",
Expand All @@ -162,8 +182,10 @@
ALL_MYSQL_DBS_TARGETS: list[MySQLTargetModel] = [
MYSQL_57,
MYSQL_80,
MYSQL_81,
]
ALL_MARIADB_DBS_TARGETS: list[MariaDBTargetModel] = [
MARIADB_1101,
MARIADB_1011,
MARIADB_1006,
MARIADB_1005,
Expand Down

0 comments on commit 2efc61b

Please sign in to comment.