-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5337280
commit bc0b5e6
Showing
12 changed files
with
54 additions
and
117 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 |
---|---|---|
@@ -1,110 +1,18 @@ | ||
MTK (MySQL Toolkit) | ||
=================== | ||
|
||
A toolkit for exporting, sanitizing and packaging MySQL database. | ||
|
||
## The Goal of this Project | ||
|
||
To provide developers with the tools to share MySQL database dumps in a safe and repeatable manner. | ||
|
||
## Example | ||
|
||
The following example scenario will showcase how developers can use mtk to dump and package a MySQL image database. | ||
|
||
### Dump a Sanitized Database with MTK | ||
|
||
**Configuration File** | ||
|
||
Prior to packaging, developers should assess the data that is stored within the database and determine what data should be sanitized or dropped. | ||
|
||
The following mtk configuration file cover some of common Drupal 7/8 data which should be sanitized or dropped. | ||
|
||
```bash | ||
$ cat mtk.yml | ||
|
||
--- | ||
rewrite: | ||
# Drupal 8. | ||
users_field_data: | ||
mail: concat(uid, "@localhost") | ||
# Quoting here denotes an explicit string rather than mysql expression. | ||
pass: '"password"' | ||
# Drupal 7. | ||
users: | ||
mail: concat(uid, "@localhost") | ||
pass: '"password"' | ||
|
||
nodata: | ||
- cache* | ||
- captcha_sessions | ||
- history | ||
- flood | ||
- batch | ||
- queue | ||
- sessions | ||
- semaphore | ||
- search_api_task | ||
- search_dataset | ||
- search_index | ||
- search_total | ||
|
||
ignore: | ||
- __ACQUIA_MONITORING__ | ||
``` | ||
|
||
**Dump the database** | ||
A tool designed to guide developers in the right direction for identifying and resolving performance issues. | ||
|
||
Now that you have a configuration file, it is time to dump the database. | ||
<img src="/logo/mtk.png" width="100"> | ||
|
||
The following command will dump a MySQL database using the configuration file created in the previous step. | ||
---- | ||
|
||
```bash | ||
$ export MTK_HOSTNAME=127.0.0.1 | ||
$ export MTK_USERNAME=root | ||
$ export MTK_PASSWORD=password | ||
$ export MTK_CONFIG=mtk.yml | ||
|
||
$ mtk-dump test > db.sql | ||
``` | ||
|
||
### Build a Database Image using Docker | ||
|
||
Next we can build a database image using the database dump created by the step prior. | ||
|
||
First, create a Dockerfile which will import the sanitized database dump. | ||
|
||
In this example we are using MySQL images from our [image repository](https://github.com/skpr/image-mysql). | ||
|
||
```dockerfile | ||
FROM docker.io/skpr/mysql:8.x-v3-latest | ||
|
||
ADD db.sql /tmp/db.sql | ||
RUN database-import local local local /tmp/db.sql | ||
``` | ||
|
||
Next, build the image with Docker. | ||
|
||
```bash | ||
docker build -t docker.io/my/database:latest . | ||
``` | ||
|
||
Hooray! You have successfully packaged a sanitized MySQL database image! | ||
|
||
### Integrate | ||
|
||
The database image can then be integrated into local development workflows using Docker Compose (or similar). | ||
|
||
Below is an example of how this can be configured. | ||
A toolkit for exporting, sanitizing and packaging MySQL database. | ||
|
||
```bash | ||
$ cat docker-compose.yml | ||
## The Goal of this Project | ||
|
||
--- | ||
version: "3" | ||
To provide developers with the tools to share MySQL database dumps in a safe and repeatable manner. | ||
|
||
services: | ||
## Getting Started | ||
|
||
# Services used as part of the local development environment. | ||
mysql: | ||
image: docker.io/my/database:latest | ||
``` | ||
See our [documentation site](https://mtk.skpr.io) for a tutorial on how to get started. |
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
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,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
{ | ||
"name": "App", | ||
"icons": [ | ||
{ | ||
"src": "\/android-icon-36x36.png", | ||
"sizes": "36x36", | ||
"type": "image\/png", | ||
"density": "0.75" | ||
}, | ||
{ | ||
"src": "\/android-icon-48x48.png", | ||
"sizes": "48x48", | ||
"type": "image\/png", | ||
"density": "1.0" | ||
}, | ||
{ | ||
"src": "\/android-icon-72x72.png", | ||
"sizes": "72x72", | ||
"type": "image\/png", | ||
"density": "1.5" | ||
}, | ||
{ | ||
"src": "\/android-icon-96x96.png", | ||
"sizes": "96x96", | ||
"type": "image\/png", | ||
"density": "2.0" | ||
}, | ||
{ | ||
"src": "\/android-icon-144x144.png", | ||
"sizes": "144x144", | ||
"type": "image\/png", | ||
"density": "3.0" | ||
}, | ||
{ | ||
"src": "\/android-icon-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image\/png", | ||
"density": "4.0" | ||
} | ||
] | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.