From 0c3cd99f6be8f543d5577f45cddb931a3ef28fe9 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Wed, 11 Sep 2019 15:42:12 +1200 Subject: [PATCH] README: add basic documentation on db backup and restore Make it a bit easier for the user to back up and restore the database. Signed-off-by: Paul Eggleton --- README | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README b/README index 759bbb2..be6cda7 100644 --- a/README +++ b/README @@ -405,6 +405,22 @@ REGISTRATION_OPEN = False +Backup and restore +------------------ + +To back up the database within the docker-based setup, you can run the +following command (no need to substitute ${MYSQL_ROOT_PASSWORD}, it's +already present within the container environment): + +docker-compose exec layersdb /bin/sh -c '/usr/bin/mysqldump -u root --password=${MYSQL_ROOT_PASSWORD} layersdb' | gzip > backup-`date +%Y_%m_%d_%H%M`.sql.gz + +To restore one of these backups you would run the following command (take +care, this will overwrite the data immediately without prompting!): + +zcat backupfile.sql.gz | docker-compose exec -T layersdb /bin/sh -c '/usr/bin/mysql -u root --password=${MYSQL_ROOT_PASSWORD} layersdb' + + + Maintenance ----------- @@ -418,6 +434,7 @@ Contributions are welcome. Please send patches / pull requests to yocto@yoctoproject.org with '[layerindex-web]' in the subject. + License -------