This stack is designed to automate the migration of a MediaWiki database and images to a remote S3 bucket. It includes a cron job that runs daily to create a MySQL dump of the database and uploads it to the S3 bucket The images are also copied to the S3 bucket using rclone
- Clone the stack into
~/docker/migration - Create the
.envfile using the.env.examplefile as a template - Run
docker-compose up -d
WIKI_NETWORK- The exact full docker network name of the MediaWiki stackVOLUMENAME- The exact full name of the volume that contains the MediaWiki imagesDB_BUCKET_NAME- The name of the S3 bucket to upload the database dumps toIMAGES_BUCKET_NAME- The name of the S3 bucket to upload the images toS3_ACCESS_KEY- The access key for the S3 bucketS3_SECRET_KEY- The secret key for the S3 bucketWIKI_MYSQL_HOST- The hostname of the MediaWiki MySQL database container (usuasllydb)WIKI_MYSQL_ROOT_PASSWORD- The root password for the MediaWiki MySQL database containerCOMPOSE_PROFILES- The profiles (comma-separated) to use for docker-compose, defaults isdatabase,rclone-images,rclone-database
database- Dump the databaserclone-images- Upload the images to S3rclone-database- Upload database dumps to S3
0 1 * * * - Dump the databases
0 4 * * * - Upload the images to S3
0 5 * * * - Copy the databases to S3
The stack uses --all-databases to dump the database, thus one instance of the stack is enough to copy over all the wikis databases assuming they are on the same MySQL server. However, there is also a need to copy the images to S3 and this must be done by deploying a limited stack copy to handle just the 2nd wiki images volume:
- Clone & configure the stack copy to run for the first wiki. This first instance of the stack will be responsible
for backing up all the databases and the first wiki images volume with
COMPOSE_PROFILES=database,rclone-images,rclone-databaseconfigured - Clone a second copy of the stack and enable just the
COMPOSE_PROFILES=rclone-imagesprofile. This second instance will be responsible for backing up the second wiki images volume. Optionally configureCRON_UPLOAD_IMAGESto run at a different time. Makes sure to setIMAGES_BUCKET_NAMEto the correct bucket name and theVOLUMENAMEto the correct volume name.
For >1 wiki setup the IMAGES_BUCKET_NAME must contain subdir suffixes, i.e. mywiki-bucket/wiki1 and mywiki-bucket/wiki2