Docker image hosting a wiki family using Mediawiki and MySql
Sponsored by FFA Private Bank
- Copy
docker-compose.yml
todocker-compose.override.yml
and override theenvironment
andvolumes
wiki
serviceenvironment
:NGINX_HOST
variable: external hostname seen by the wiki usersNGINX_PORT
: external port number seen by the wiki users- The nginx port number is hardcoded to be 80
- This variable should be the same as in the
ports
section of the docker-compose file
SMTP_*
: configuration to use for SMTP emails from the wikisMYSQL_ROOT_PASSWORD
: should be the same as thedb
serviceMW_SECRET
: this is mediawiki's $wgSecretKey. Set to a secret random string. Check the documentation for more info
db
andinitdb
environment variableMYSQL_ROOT_PASSWORD
: should be the same. Check documentation of the mysql docker pagedb
volumes: folder to store database data permanently. Also check documentation of the mysql docker page
docker-compose up
- Wait a minute (or monitor the logs) while the database boots up
- Browse to
http://hostname:port
- emails via smtp/swiftmailer
- user
Shadi Akiki
is created by default, with email[email protected]
bash tests.sh
and travis
Instructions below exemplified in commit fdfe8f60
- Add images folder
cd /data/docker-wiki-family/images/
sudo mkdir ffa_pb_kyc
sudo chown www-data:www-data ffa_pb_kyc -R
- append to
initdb
service
cd build && echo 'create_db wiki_ffa_pb_kyc' >> initdb/entry.sh
- add to
initdb/docker-healthcheck
DBNAMES variable:wiki_ffa_pb_kyc
-
add in
wiki
service -
an entry to wiki/wiki-family-entrance-index.html
-
cp wiki/LocalSettings_ffa_pb_pnp.php wiki/LocalSettings_ffa_pb_kyc.php
-
Edit
wiki/LocalSettings_ffa_pb_kyc.php
-
Add to wiki/Dockerfile: -
cp LocalSettings_ffa_pb_kyc.php /usr/share/nginx/html/
- logo if different:cp logo-ffa-pb.gif /usr/share/nginx/html/resources/assets/
-
Add to wiki/LocalSettings.php section about
LocalSettings_ffa_pb_kyc.php
-
Add to wiki/nginx-default.conf section for location of
ffa_pb_kyc
- Note two embeded locations there -
Re-build services
./docker-compose.sh build initdb wiki
./docker-compose.sh up -d initdb
./docker-compose.sh up -d wiki
- When done, run
bash tests.sh 8001
For a wiki without any images, it's easy to just use the
Import XML dump
method.Otherwise, use the Import db dump
method.
EDIT:
While migrating from mediawiki 1.21 to 1.28, I used the xml dump method, copied the images folder, and didn't see any images in the wiki.
So I resorted to the mysql db dump method.
However, I now realize that my problem was simply that I should have run php wikifolder/maintenance/importImages.php wikifolder_backup/images --wiki wiki_ffa_pb_pnp
after copying the images files.
Anyway, keeping the import with the db dump import since it also imports the users with their passwords.
CONTAINERID=`docker ps|grep wikifamily_wiki|awk '{print $1}'`
docker cp file.xml $CONTAINERID:/home/
./docker-compose.sh exec wiki bash
cd /usr/share/nginx/html/maintenance
php importDump.php --dbpass password --dbuser user --wiki wiki_ffa_pb_pmo /home/file.xml
If the wiki database name does not start with wiki_
, check the note in LocalSettings.php
about "simulating calling url"
Even though rebuildrecentchanges.php
does not take --wiki wiki_dbname
, add it so that the command can tell which wiki family member to use.
- Otherwise, an error will be generated:
DBConnectionError from line 748 of /usr/share/nginx/html/includes/libs/rdbms/database/Database.php: Cannot access the database: Unknown database 'my_wiki' (db)
php rebuildrecentchanges.php --wiki wiki_ffa_pb_pmo
Open the wiki Main Page
, go to history, and revert the most recent edit to see the most recent Main Page
from the imported wiki
Follow instructions in docs
until update.php
, which should be run as php wikifolder/maintenance/update.php --wiki wiki_ffa_pn_pnp
so that the proper wiki family member is selected.
Use Extension:Restrict access by category and group
The docker images that already do this
- nickbreen/docker-mysql-backup-cron
- only does s3 backups
- CANDY-LINE/docker-mysql-backup-cron
- this is fork of nickbreen's repo
- does s3 as well as local and other options
- fradelg/docker-mysql-cron-backup
- does local backups only
- this seems to be the simplest of all, with 11 commits, so I will go with this
- also has travis CI testing
- docker image based on alpine
To use the mediawiki changePassword.php
script, use as follows
docker-compose exec wiki bash
pwd
# /usr/share/nginx/html/
cd maintenance
php changePassword.php --user "Shadi Akiki" --password "pizza" --wiki "wiki_ffa_pb_pmo"