-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: backup all db #133
base: master
Are you sure you want to change the base?
feat: backup all db #133
Changes from all commits
b1a64ad
f82421b
e126668
b181044
a7b6a2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,13 +112,13 @@ service_export() { | |
local SERVICE="$1" | ||
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE" | ||
local SERVICE_NAME="$(get_service_name "$SERVICE")" | ||
local DATABASE_NAME="$(get_database_name "$SERVICE")" | ||
local PASSWORD="$(service_password "$SERVICE")" | ||
local ROOTPASSWORD="$(service_root_password "$SERVICE")" | ||
|
||
[[ -n $SSH_TTY ]] && stty -opost | ||
docker exec "$SERVICE_NAME" bash -c "printf '[client]\ndefault-character-set=utf8mb4\npassword=$PASSWORD\n' > /root/credentials.cnf" | ||
docker exec "$SERVICE_NAME" mysqldump --defaults-extra-file=/root/credentials.cnf --user=mysql --single-transaction --quick "$DATABASE_NAME" | ||
docker exec "$SERVICE_NAME" rm /root/credentials.cnf | ||
docker exec "$SERVICE_NAME" bash -c "printf '[client]\nuser=root\npassword=$ROOTPASSWORD\n' > /root/credentials.cnf" | ||
docker exec "$SERVICE_NAME" bash -c "printf 'show databases;' | mysql --defaults-extra-file=/root/credentials.cnf | grep -wvE 'Database|mysql|sys|information_schema|performance_schema' > databases_to_backup" | ||
docker exec "$SERVICE_NAME" bash -c "cat databases_to_backup | xargs mysqldump --defaults-extra-file=/root/credentials.cnf --single-transaction --quick --databases" | ||
docker exec "$SERVICE_NAME" rm /root/credentials.cnf databases_to_backup | ||
status=$? | ||
[[ -n $SSH_TTY ]] && stty opost | ||
exit $status | ||
|
@@ -135,7 +135,10 @@ service_import() { | |
if [[ -t 0 ]]; then | ||
dokku_log_fail "No data provided on stdin." | ||
fi | ||
docker exec -i "$SERVICE_NAME" mysql --user=root --password="$ROOTPASSWORD" "$DATABASE_NAME" | ||
|
||
docker exec "$SERVICE_NAME" bash -c "printf '[client]\nuser=root\npassword=$ROOTPASSWORD\n' > /root/credentials.cnf" | ||
docker exec -i "$SERVICE_NAME" mysql --defaults-extra-file=/root/credentials.cnf "$DATABASE_NAME" | ||
docker exec "$SERVICE_NAME" rm /root/credentials.cnf | ||
Comment on lines
-138
to
+141
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this particular change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is introduced to surpress warnings from mysql
|
||
} | ||
|
||
service_start() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we dropped the character set here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I probably left it out by accident