This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 0664c4f
Showing
12 changed files
with
7,975 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,2 @@ | ||
**/node_modules/* | ||
**/bower_components/* |
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 @@ | ||
env: | ||
es6: true | ||
node: true | ||
jest: true | ||
extends: 'eslint:recommended' | ||
parserOptions: | ||
sourceType: module | ||
rules: | ||
indent: | ||
- error | ||
- 4 | ||
linebreak-style: | ||
- error | ||
- unix | ||
quotes: | ||
- error | ||
- single | ||
semi: | ||
- error | ||
- always | ||
no-console: 0 |
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 @@ | ||
node_modules | ||
.idea |
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 @@ | ||
language: node_js | ||
node_js: | ||
- "7" |
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,86 @@ | ||
# USDocker for MySQL | ||
|
||
This script creates a MySQL applicantion from a docker image. | ||
You can persist your mysql and customize your mysql without expertise in Docker. | ||
|
||
## Installing | ||
|
||
```bash | ||
npm install -g usdocker-mysql | ||
``` | ||
|
||
## Start the mysql service | ||
|
||
``` | ||
usdocker mysql up | ||
``` | ||
|
||
## Stop the mysql service | ||
|
||
``` | ||
usdocker mysql down | ||
``` | ||
|
||
## Run the mysql-client command line interface | ||
|
||
``` | ||
usdocker mysql client | ||
``` | ||
|
||
## Connect to the mysql bash interface | ||
|
||
``` | ||
usdocker mysql connect | ||
``` | ||
|
||
## Dump the database and save it to the /tmp/dump folder. | ||
|
||
``` | ||
usdocker mysql dump [database] | ||
``` | ||
|
||
## Analyse the database service and get insights for tuning it | ||
|
||
``` | ||
usdocker mysql analyse | ||
``` | ||
|
||
## Customize your Service | ||
|
||
You can setup the variables by using: | ||
|
||
```bash | ||
usdocker mysql --set variable=value | ||
``` | ||
|
||
Default values | ||
|
||
- image: "mysql:5.7", | ||
- folder: "$HOME/.usdocker/data/mysql", | ||
- port: 3306, | ||
- rootPassword: "password" (note: only will work at the first time) | ||
|
||
|
||
## Customize the "$HOME/.usdocker/setup/mysql/conf.d/custom.cnf" | ||
|
||
Use your own setup for mysql changing this file. | ||
|
||
``` | ||
[mysqld] | ||
bind-address = 0.0.0.0 | ||
[mysqldump] | ||
quick | ||
quote-names | ||
max_allowed_packet = 16M | ||
``` | ||
|
||
## Customize the "$HOME/.usdocker/setup/mysql/home/" | ||
|
||
This folder exists for setup the database dump. You have only edit the file .my.cnf with the following setup: | ||
|
||
``` | ||
[mysqldump] | ||
user=backup | ||
password=PasSWord | ||
``` |
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,9 @@ | ||
# Custom MySQL.ini | ||
|
||
[mysqld] | ||
bind-address = 0.0.0.0 | ||
|
||
[mysqldump] | ||
quick | ||
quote-names | ||
max_allowed_packet = 16M |
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 @@ | ||
[mysqldump] | ||
user=backup | ||
password=PasSWord |
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,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
#USERNAME=" -u backup " # see $HOME/.my.cnf | ||
|
||
mkdir -p /tmp/dump | ||
|
||
if [ -z "$1" ] | ||
then | ||
databases=`/usr/bin/mysql --execute='show databases' --skip-column-names --batch` | ||
else | ||
databases="$1" | ||
fi | ||
|
||
COMMAND="/usr/bin/mysqldump --routines --triggers --events --comments --hex-blob " | ||
|
||
for db in $databases | ||
do | ||
|
||
echo Doing $db... | ||
$COMMAND $db > /tmp/dump/$db.sql | ||
|
||
sed -i -e 's:\/\*!50017 DEFINER=.* \*\/::g' /tmp/dump/$db.sql | ||
sed -i '/^\/\*\!50013/d' /tmp/dump/$db.sql | ||
|
||
done | ||
|
Oops, something went wrong.