Difference between revisions of "Backup and Restore"
Line 1: | Line 1: | ||
=Introduction= | =Introduction= | ||
To ensure this MediaWiki's content will not be lost, we created a set of script and put it in $wgResourceBase's extensions/BackupAndRestore directory. | To ensure this MediaWiki's content will not be lost, we created a set of script and put it in $wgResourceBase's extensions/BackupAndRestore directory. | ||
The [[backup.sh]] script, convert all SQL database content into an XML file called: [[XLPLATEST.xml]], and put all uploaded files into the [[images/UploadedFiles/]] directory under the specified $wgResourceBase/ directory. | |||
The [[restore.sh]] script, extract the content of [[XLPLATEST.xml]], and reload all files of the [[images/UploadedFiles/]] directory into the currently running MediaWiki. | |||
Overtime, this will be an extension integrated with this page. | Overtime, this will be an extension integrated with this page. |
Revision as of 04:06, 26 March 2021
Introduction
To ensure this MediaWiki's content will not be lost, we created a set of script and put it in $wgResourceBase's extensions/BackupAndRestore directory.
The backup.sh script, convert all SQL database content into an XML file called: XLPLATEST.xml, and put all uploaded files into the images/UploadedFiles/ directory under the specified $wgResourceBase/ directory.
The restore.sh script, extract the content of XLPLATEST.xml, and reload all files of the images/UploadedFiles/ directory into the currently running MediaWiki.
Overtime, this will be an extension integrated with this page.
Importance
To enable proper data security, convenient backup and restore procedure would be the first layer.
This MediaWiki instance already stores all data under mountPoint/images and mountPoint/mariadb, these two directories store all the data relevant to MediaWiki, including its uploaded media files, and textual data stored in the MariaDB database.
Implementation
The default up.sh shell script is a way to allow users to kickoff the program. This process does the following tasks:
- Before shutting down existing instance of docker services, it first asks the existing instance to backup the data.
- Then, use docker-compose down --volumes to shut down all the docker services.
- If the mountPoint/ directory does not exist, yet, decompress InitialDataPackage.tar.gz to the mountPoint/ directory.
- When the mountPoint directory has the initial data content, start docker services, using docker-compose up -d
- The docker-compose program reads docker-compose.yml file to configure docker services.
- When the docker services start running, take the existing data in the directory, if images/UploadedFiles/ directory or XLPLATEST.xml are available, these data elements will be imported to the database.