This repository contains the containerized hosting architecture and maintenance scripts for Semantic MediaWiki instances developed or hosted at the ZPD. The goal of this project is to provide a production-ready, opinionated, but extensible environment for hosting a variety of isolated Semantic MediaWiki instances, while minimizing boilerplate and maintenance work. This is achieved through a hierarchy of Docker images, starting from a bare-bones Semantic MediaWiki environment and extending to an optional, highly customized image. Each image builds upon the previous one, streamlining updates and reducing the workload for maintaining multiple instances.
These instructions will help you set up a Semantic MediaWiki instance on your local machine for development and testing. While the deployment process may vary depending on your infrastructure, the underlying steps remain the same.
- Install Docker and Docker Compose
- Create the scaffolding for your own Semantic MediaWiki instance by using the werft-cli or download a release of the custom image
- In case you choose the latter installation option, keep in mind that you have to manually rename some of the setup files to make things work (the CLI does this automatically for you). The required replacements are
Dockerfile.template
➡️Dockerfile
docker-compose.template.yaml
➡️docker-compose.yaml
template.env
➡️.env
Adapt the Dockerfile to your own likings by adding installation instructions for additional skins or extensions.
Alternatively – and recommended – you can also do this by adding the skins or extensions to the composer.local.json
.
To find out how to do this and how to add custom repositories you can have a look here.
To overwrite the initial PHP configuration or to add additional configurations just add them to the php.ini
file.
Maintenance scripts are running as cron jobs in the main Semantic MediaWiki container.
To configure the intervals just edit the corresponding line in the crontab
file or add additional tasks to it.
These will then be automatically be scheduled at container startup. Make sure to rebuild so that your changes take effect.
The default tasks are:
The provided setup also adds a database backup container by default. To configure the database backup intervals edit the corresponding environment variables.
The setup depends on certain environment variables being set for building the images and running the containers.
Adjust the .env
to match your desired configuration (if you want to use a different filename you have to specify this in the docker-compose call with the --env-file
argument)
SMW_IMAGE_NAME
: Desired name for the custom image (required)SMW_IMAGE_TAG
: Specifies the core image tag that should get used for building (default:1.39.7
)SMW_PORT
: Port through which the MediaWiki should be available (default:8080
)
DB_NAME
: Name of the database that gets used by (Semantic) MediaWiki (required)DB_USER
: Username of the database that gets used by (Semantic) MediaWiki (required)DB_PASSWORD
: Password that's required to access the created database (required)
Tip
The values that are set here are also the ones that should be used during the MediaWiki web setup and/or in your LocalSettings.php
DB_BACKUP_CRON
: cron schedule expression which controls how often a database dump is created (default:00 23 * * *
)
Adjust the volumes in the docker-compose.yaml
to match your local storage locations or add further custom volumes (e. g. for custom layouts when using the chameleon
skin)
If you don't want to start an instance from scratch but from the backup of an existing (Semantic) MediaWiki instance make sure to uncomment the following line in the database
service and point the volume declaration to your backup file
# - ./backup.sql:/docker-entrypoint-initdb.d/datadump.sql
If you have configured everything accordingly run the following commands while inside the custom
directory:
docker-compose build
docker-compose up -d
You should now be able to access the instance through the configured port on your machine.
Important
If you're creating a new (Semantic) MediaWiki instance make sure that you stop the setup with docker-compose down
after setting everything up through the web interface and uncomment the follwing line in the smw
service and point the volume to the created LocalSettings.php
# - ./LocalSettings.php:/var/www/html/LocalSettings.php:ro
Afterwards start everything with docker-compose up -d
again