This guide assumes you have intermediate understanding of docker concepts and basic usage.
- Download these docker source files.
- Stand in the parent directory of the directory containing
docker-compose.yml
- Apply the configuration changes listed below.
- Issue the following command:
docker-compose up -d
As part of the docker-compose up
command, several types of mutable data will be
mounted for you to the running container:
LocalSettings.php
php.ini
images
folder withwww-data:www-data
ownership- Logo file
- gc2 sync configuration file
gc2smw.cfg
- Various conf files for unixodbc so the wiki can query a SQL Server
These files are expected to be in the location /srv/semawi/
. You can find usable
versions of these files in the mutables
folder distributed with the source.
Please make sure you review the provided configuration files to adapt the system to your needs. Notably, you will want to secure the following settings:
$wgSecretKey
$wgUpgradeKey
$wgServer
In the docker host, you should be able to access the SeMaWi container
now through your browser, with an address like
http://semawi.example.com
. Please note that you must have
entered a correct address for $wgServer$
in the earlier section;
otherwise, all wiki pages appear empty. A default user SeMaWi
(member of groups SysOp and Bureaucrat) has been created for you
with the case-sensitive password SeMaWiSeMaWi
. You should change
this password as your first action in the running system.
The current setup is geared towards using Let's Encrypt as CA and obtaining the certificates with certbot
. A volume is created specifically for the certificates, as certbot
is run on the host machine. The certificates should be placed in that volume under /srv/semawi/certs/
. The apache configuration file 001-semawi.conf
expects the certificate and the private to be named fullchain.pem
and privkey.pem
respectively. The server configuration expects these values, and will not work without them. The procedure is as follows:
- Install
certbot
on the host machine. Instructions can be found at the certbot website. - Stop any running instances of SeMaWi or other processes binding to port 80.
- Run
certbot certonly --standalone
and enter the domain name when prompted. - Copy the obtained certificate and key-files into
/srv/semawi/certs
. - Start SeMaWi.
Automatic renewal of the SSL-certificate can be achieved by creating a cronjob that runs the script cert-renew.sh
. The script will take care of the entire renewal process.
- Place
cert-renew.sh
into/srv/semawi/
- It may be necessary to run
chmod +xr /srv/semawi/cert-renew.sh
- Run
sudo crontab -e
and add0 4 1 * * sh /srv/semawi/cert-renew.sh
to run the script at 4 on the first of every month. The timing can be modified if desired.
To use SeMaWi without SSL, change the apache configuration file 001-semawi.conf
such that the VirtualHost on port 80 no longer redirects to SSL, and disable the VirtualHost on port 443.
Set $wgServer
to the external address of the container like so:
$wgServer="//semawi.example.com";
You must edit the $wgSMTP
in LocalSettings.php
to reflect where the SMTP server is which SeMaWi can use.
$wgSMTP = array(
'host' => "mail.example.com", // Where the SMTP server is located. Could also be an IP-address
'IDHost' => "example.com", // Generally this will be the domain name
'port' => 465, // Port to use when connecting to the SMTP server
'auth' => true, // Should we use SMTP authentication (true or false)
'username' => "my_user_name", // Username to use for SMTP authentication (if being used)
'password' => "my_password" // Password to use for SMTP authentication (if being used)
);
The exact settings required depends on your setup. See the SMTP-manual for more details.
The use of email/SMTP depends on the pear
packages Mail
and Net_SMTP
. These should be automatically installed by the script entrypoint.sh
.
If you're running SeMaWi in production, you will need to edit the line in LocalSettings.php
which looks like enableSemantics( 'localhost' );
, replacing localhost with the domain name you are using.
First make sure you have followed the instructions for configuring the GC2 sync in SeMaWi. That is documented in this file in the section "GeoCloud2 Import Cronjob".
The image has a script /opt/syncgc2.sh
which needs to be called in order to initiate a pull from GC2. You will want the docker host to have a cron job for this purpose. An example of such a command could be:
0 5 * * * docker exec your-container-name /opt/syncgc2.sh
0 6 * * * docker exec your-container-name /usr/bin/php /var/www/wiki/maintenance/runJobs.php
Keep in mind, the cronjob will need sufficient privileges to execute docker commands.
This section describes the process for migrating content from a SeMaWi to a newly established docker container.
When migrating content to a newly deployed docker build, we are essentially moving the wiki. Therefore, we follow the instructions for backing up and updating the wiki, then we re-deploy the SeMaWi XML dump.
- Back up the old wiki; instructions here.
- Deploy the SeMaWi docker according to the instructions on this page.
- Execute an upgrade; instructions here.
- Re-read the structure.xml manually from SeMaWi's github in Speciel:Importere (Special:Import)
- Execute
maintenance/rebuildall.php
andmaintenance/runJobs.php
- Remember to
chown -R www-data:www-data /var/www/wiki/images/
in the docker image (with docker exec) after moving the image directory contents.
- From the old wiki, use Special:Export to obtain XML dumps of all the pages in the categories we want transferred
- Deploy the SeMaWi docker according to the instructions on this page.
- Import the XML dumps in the newly deployed SeMaWi container using Speciel:Importere (Special:Import)
You will likely want to change your logo. Follow the guidelines here to incorporate your logo.
I recommend you examine the list of Forms to identify which parts of the SeMaWi functionality is required in your case. You can link to the Categories created by these Forms in MediaWiki:Sidebar.
This dockerized version of SeMaWi ships with the Chameleon skin. To activate it, find the line in LocalSettings.php
which says:
$wgDefaultSkin = "vector";
and change it to
$wgDefaultSkin = "chameleon";
It is possible to Export and Import templates, forms, properties.
If backup of the Wiki is needed following steps vil setup a cronjob, which dumps MySQL data from the container to the host every night.
- Place
backup.sh
fromscripts/
in/srv/semawi/
chmod +x /srv/semawi/backup.sh
if needed- Create folder for backup
mkdir /srv/semawi/backup
- Add
0 0 * * * sh /srv/semawi/backup.sh
to the root crontab to backup every midtnight
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
After restore you might execute:
docker exec -i semawi-mediawiki php /var/www/wiki/maintenance/rebuildall.php
docker exec -i semawi-mediawiki php /var/www/wiki/maintenance/runJobs.php
If you want to delete old backups you can setup following in the crontab.
@daily find /srv/semawi/backup/* -mtime +15 -exec rm {} \;
This deletes all backups older than 15 days.
There are four settings you need to modify to activate the Mapcentia GeoCloud2 geodata table import into SeMaWi. SeMawi exposes the GC2 sync config in a volume, find it with docker inspect your-container-name
. In this volume you will fine the cfg file, and the following settings need to be set correctly:
- username: a valid SeMaWi login. The default docker build establishes a login Sitebot for this purpose
- password: the password for the above bot account; usually SitebotSitebot
- site: the URL to the SeMaWi container. Unless you know what you are doing, leave it as-is
- gc2_url: The URL to the GC2 API
When you have done this, you must exec into the container to install the GC2 sync environment:
docker exec -ti name-of-your-running-container /bin/bash
cd /opt/
./installgc2daemon.sh
Having set the integration up, you must instruct the docker host to call the script from the host's cronjob. Refer to the section "Pulling geodata from a GeoCloud2 instance" in this document to see how to do this.
It is strongly recommended you coordinate the time at which the import runs with Mapcentia.
docker exec -i semawi-mediawiki php /var/www/wiki/maintenance/changePassword.php --user=UserName --password=NewPW