-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDBF-633: Docker compose file example for MySQL 5.7 migration
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
DB_ROOT_PASSWORD='secret' | ||
DB_USER='testuser' | ||
DB_PASSWORD='password' | ||
DB_DATABASE='testdb' | ||
MYSQL_name='mysql-container' | ||
MYSQL_MIGRATE_name='mysql-container-migrated' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: "3" | ||
x-common-variables: &common-variables | ||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} | ||
MYSQL_USER: ${DB_USER} | ||
MYSQL_PASSWORD: ${DB_PASSWORD} | ||
|
||
services: | ||
mariadb-from-mysql57: | ||
environment: | ||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} | ||
MYSQL_USER: ${DB_USER} | ||
MYSQL_PASSWORD: ${DB_PASSWORD} | ||
MARIADB_AUTO_UPGRADE: 1 | ||
container_name: ${MYSQL_MIGRATE_name} | ||
image: mariadb:lts | ||
volumes: | ||
# MySQL data that we want to migrate | ||
- dbdata:/var/lib/mysql | ||
|
||
volumes: | ||
dbdata: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: "3" | ||
|
||
services: | ||
mysql: | ||
environment: | ||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} | ||
MYSQL_USER: ${DB_USER} | ||
MYSQL_PASSWORD: ${DB_PASSWORD} | ||
MYSQL_DATABASE: ${DB_DATABASE} | ||
container_name: ${MYSQL_name} | ||
image: mysql:5.7 | ||
healthcheck: | ||
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"] | ||
interval: 5s | ||
timeout: 3s | ||
retries: 2 | ||
start_period: 0s | ||
volumes: | ||
# Preload files for MySQL data | ||
- ./mysql:/docker-entrypoint-initdb.d:z | ||
# We have to save MySQL volume that will be used in upgrade | ||
- dbdata:/var/lib/mysql | ||
volumes: | ||
dbdata: {} | ||
|
||
networks: | ||
backend: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
DROP TABLE IF EXISTS countries; | ||
CREATE TABLE countries(name char(20)); | ||
INSERT INTO countries values ("Bosnia & Herzegovina"); |