UseCase "Easy System Cloning (DSESC) Backup"

From SMW CindyKate - Main
Component 947746
Jump to: navigation, search


HasGitHubRepository DSESC Backup IsRelevantFor UseCase "Develop a MediaWiki extension"


For background and reasoning see and for a conceptual overview see Concept "Easy System Cloning (DSESC)".

  • You can run multiple backup configurations which use different sources, destinations, options and encryptions keys.
  • For each backup configuration you have to choose a BACKUP_CONFIGURATION_NAME.
  • A specific BACKUP_CONFIGURATION_NAME backs up ONE specific source to ONE specific destination.


The server running a MediaWiki instance will need the following components installed:

About configurative data and data locations the following information must be obtained or decisions made:

  • <username>, <user_gnupg_key_passphrase> and <user_gnupg_key_id>
  • <mediawiki_instance_root_urn>
  • <duplicity_target_data_location> (Depending on your choice of data location, you might need to install necessary packages providing interfaces, e.g. for Amazon Web Services S3 python-boto.)
  • <duplicity_policies>, see Duplicity options
  • <duplicity_log_file>
  • mediawiki_instance_database_ro_credentials
  • <docker_container>

Based on this data the following script is run ad-hoc or scheduled (e.g.


mysqldump \
--password=mariadb_user_password \
--user=mariadb_user_username \
--host=mariadb_host \
--complete-insert \
--add-drop-database \
--add-drop-table \
--compact \
--create-options \
--no-create-db \
--result-file=<mediawiki_instance_root_urn>/dump.sql \

docker run \
  --rm \
  --user=`id -u <username>` \
  -e PASSPHRASE='<user_gnupg_key_passphrase>' \
  -v $PWD/.cache:/home/duplicity/.cache/duplicity \
  -v $PWD/.gnupg:/home/duplicity/.gnupg \
  -v <mediawiki_instance_root_urn>:/source/ \
  -v <duplicity_target_data_location>:/target/:rw \
  <docker_container> \
  duplicity \
  --allow-source-mismatch \
  --verbosity 9 \
  <duplicity_policies> \
  --encrypt-key <user_gnupg_key_id> \
  /source/ file:///target/ \
  >> <duplicity_log_file>