Wikibase/Maintaining

Maintaining a Wikibase instance
On this page you'll find some resources for gaining some insight into your Wikibase instance and to help keep it healthy and up to date.

Architecture overview
First, take a look at our table and diagram:



Docker tooling
The best tools for managing your Docker install are the ones you used to get it going in the first place: docker and docker compose. This manual can’t possibly replace a grounding in Docker, so check out Docker’s own command references for [ https://docs.docker.com/compose/reference/ docker compose] and the [ https://docs.docker.com/engine/reference/commandline/docker/ docker engine].

That said, here are some starter commands that might come in handy.

Before you begin

 * Container names created using begin with the basename of the directory in which they were created with the first  invocation.  The example container names below begin with  because the examples were run in a directory named.
 * As of 2023, (with hyphen) as a separate command has been deprecated in favor of  (without hyphen), an argument to the main  command.
 * The commands below omit the explicit mention of and presume that you used the minimal install method.  If you used the extended install method, you will need to specify every config file to be included, adding  to any invocations of.

Get a command shell on a container
You won’t need it for typical Wikibase activity, but for Docker beginners here’s one very useful command that connects to a running container:

docker exec -it &lt;container name&gt; bash

Copy a file to your local directory
docker cp wbdocker_wikibase_1:/var/www/html/LocalSettings.php LocalSettings.php

This also works in the other direction, and the combination is useful for, say, grabbing your LocalSettings.php, editing it and putting it right back.

docker cp LocalSettings.php wbdocker_wikibase_1:/var/www/html/LocalSettings.php

Read [ https://addshore.com/2018/06/customizing-wikibase-config-in-the-docker-compose-example/ Adam Shorland’s excellent blog post] for more detail on modifying files on containers.

Stop the Docker containers
This command stops the Docker containers, leaving the machines (and of course all data) intact:

As you might imagine, you can use to start them again.

Delete the containers while preserving data
This command removes the containers but preserves all data in MySQL, MediaWiki and the query service in Docker volumes.

Logs
Each application in the Wikibase cluster has its own log output. Consult each service’s own documentation to learn how to read its logs.

In the directory where you placed your file, run the  command and the name of the service (check the table above) to see its logs. For example:

user@host:~/docker$ docker compose logs -f --tail=100 mysql mysql_1 | 2019-12-31 10:00:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server started. mysql_1 | 2019-12-31 10:00:00+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' ...

Backup and restore
The data in your Wikibase instance is valuable. What would happen if your datacenter burnt down? How long would it take to rebuild? Regular backups and tested restores of data are vital.

Generally, there are two bodies of data you’ll need to back up: the MediaWiki/Wikibase filesystem and, more importantly, the MySQL database. First and foremost, we recommend reading the Wikibase Docker install doc to get the lay of the land.

Docker level
Since this is a Docker install, backup using Docker tools is recommended.

Docker-level backup is explained in some detail [ https://gist.github.com/datn/a4a466bb713eba8c18ba7558aa848efd here]. It involves backing up the Docker [ https://docs.docker.com/storage/volumes/ volumes] and dumping out the database with [ https://mariadb.com/kb/en/making-backups-with-mysqldump/ mysqldump].

For a helpful overview of Docker data backup and restore, including the use of the and  commands, read this excellent [ https://stackoverflow.com/questions/26331651/how-can-i-backup-a-docker-container-with-its-data-volumes#26339848 StackOverflow post]. It’s been updated several times since its original posting in 2014 and constitutes a great tour and jumping-off point for the docker command-line reference linked above.

On-container level
Backup on the container level is not an easy proposition; we cover it here mainly to present a more complete picture of MediaWiki and Wikibase under the hood.

To that end, read the documentation on, bearing in mind that the work needs to be done from within the containers (cf. Docker tooling above) and the data extracted and placed somewhere safe outside of Docker.

Wiki tools
Wikibase is an extension of MediaWiki. Much of the functionality you’ll be working with is actually that of MediaWiki, so consult the and the. Of particular note:


 * - User guide
 * - User rights management
 * - Wiki admin guide

Updating
Keeping software up to date is the only way to obtain new features, not to mention how important it is to apply bug and security fixes.

To update Wikibase on Docker, read [ https://github.com/wmde/wikibase-release-pipeline/blob/main/docs/topics/upgrading.md our upgrade documentation].

Updating a manual install of the Wikibase suite isn't as straightforward: it involves upgrading MediaWiki itself (see the MediaWiki update documentation) and then the individual software components.