A Docker image for dumping MySQL that contains MediaWiki data and uploading to AWS S3 periodically. This image is designed for FemiWiki.
# Configuring network is required
# Passing username and password as environment variables
docker run --detach \
--name backupbot \
--restart always \
-e 'DB_USERNAME=xxxxxxxx' \
-e 'DB_PASSWORD=xxxxxxxx' \
femiwiki/backupbot
# Alternatively, you can provide LocalSettings.php instead
docker run --detach \
--name backupbot \
--restart always \
-v $PWD/LocalSettings.php:/a/LocalSettings.php \
femiwiki/backupbotDB_SERVER: The user name passed to access the database. If/a/LocalSettings.phpis exist, this will be ignored. Default tolocalhost.DB_USERNAME: The user name passed to access the database. If/a/LocalSettings.phpis exist, this will be ignored.DB_PASSWORD: The password passed to access the database. If/a/LocalSettings.phpis exist, this will be ignored.LOCAL_SETTINGS: The absolute path to LocalSettings.php that declares$wgDBserver,$wgDBuserand$wgDBpassword. Default to/a/LocalSettings.php.HEALTHCHECK_URL: A Healthchecks.io ping URL. It is pinged once a dump of a plausible size has reached S3, and$HEALTHCHECK_URL/failis pinged when a run ends any other way, so a missed backup is noticed without anyone reading the logs. IfSSM_SECRETSis set, the URL is read from the/mysql/backup/healthcheck-urlparameter instead. Nothing is pinged when neither is given.
# Replace DB_USERNAME and DB_PASSWORD with actual values
mysql -uDB_USERNAME -pDB_PASSWORD < dump_of_wikidb.sqlRun rebuildall.php script. See Restoring a wiki from backup for details.
The source code of backupbot is primarily distributed under the terms of the GNU Affero General Public License v3.0 or any later version. See COPYRIGHT for details.