This repository contains an EXAMPLE docker-compose file that can be used with the wikibase docker images on https://hub.docker.com/r/wikibase Following these instructions, you'll be able to install:
- A stand-alone instance of Wikibase – the collaborative structured data engine behind Wikidata
- A fully functional SPARQL endpoint and query service, complete with a data visualization frontend and query helper (similar to the Wikidata Query Service).
- ElasticSearch, for improved serach
- Quickstatements, a bulk editing tool
RAM Required: This example requires 4GB+ of RAM. If you are running Docker for Windows or Mac and have containers run within a VM (the default) make sure you set your VM memory allocation to 4GB or more. If you don't do this everything will probably fail.
This is the first step and often the hardest, as every operating system has a different way of installing Docker.
Most setups will come with docker-compose. If yours doesn't then you can get it at https://docs.docker.com/compose/install/
- Download and Install Docker Engine-Community using the appropriate instructions for your distro from https://docs.docker.com/install/
- Make sure you read the instructions regarding using sudo/root or creating a group for docker.
- Download and Install - Docker Desktop https://www.docker.com/products/docker-desktop
- Turn on virtualization in BIOS settings (if not already done)
- Open Docker advanced settings and increase the memory limit for the Virtual machine to more than 4GB
- Download and Install- Docker Toolbox https://docs.docker.com/toolbox/toolbox_install_windows/
- Increase your virtual machine memmory allocation
- Note: You may have to use the IP address of your VM machine once setup, not localhost
- Download and Install - Docker Desktop https://www.docker.com/products/docker-desktop
- Open Docker advanced settings and increase the memory limit for the Virtual machine to more than 4GB
This file is only meant as an example, your modification might be needed.
wget https://raw.githubusercontent.com/wmde/wikibase-docker/master/docker-compose.yml
If you don't have wget then just download the file from the web and save it into your working directory with the name docker-compose.yml
Pulling / updating the images
The below command will download the versions of the docker images used in the docker-compose example.
docker-compose pull
Starting the containers
The below command will start several containers but hide the output. If you want to see what is happening see the section on viewing logs below.
docker-compose up -d
Viewing container output
The below command will output a stream of logs from all containers
docker-compose logs -f
The setup will take a short while and includes automatic steps such as:
- Initializing Blazegraph storage
- Initializing MySql storage
- Initializing Elasticsearch storage
- Installing Mediawiki and Wikibase database tables
- Creating oauth details for Quickstatements
You can check to see if all containers are running with the below command:
docker-compose ps
If any appear to not be running then something has likely gone wrong. Take a look at the troubleshooting section at the bottom of this readme.
Once setup has complete you should be able to naviagte to the services.
Note: Docker Toolbox users, you may have to use the IP address of your virtual machine instead of localhost.
Access the following hosts:
- Wikibase @ http://localhost:8181
- Query Service UI @ http://localhost:8282
- Query Service Backend (Behind a proxy) @ http://localhost:8989/bigdata/
- Quickstatements @ http://localhost:9191
If you want to access the balzegraph SPARQL endpoint directly for writing you need to bypass the read only proxy. You will need to make a change similar to this: https://github.com/wmde/wikibase-docker/pull/16/files You will then be able to access the query service on localhost for writing.
Stopping the containers (keeps data and containers)
docker-compose stop
Removing the containers (keeps data, removes containers)
This will keep all data stored by MySQL, Mediawiki and the Query Service in Docker volumes.
docker-compose down
Removing the containers and data
WARNING: this will remove ALL of the data you had added to MediaWiki, Wikibase, the QueryService and ElasticSearch.
docker-compose down --volumes
A default user is created on setup. Username "WikibaseAdmin", Password "WikibaseDockerAdminPass".
This is highly insecure, so if your instance is public please change the password in your docker-compose.yml before setup, or after setting up using MediaWiki.
You can start creating items and properties to start populating your Wikibase instance via these special pages
Once you've created your first items and statements, you'll be able to query them and visualize the results through the Query Service UI.
Get a JSON dump from wikibase:
docker-compose exec wikibase php ./extensions/Wikibase/repo/maintenance/dumpJson.php
Get an RDF dump from wikibase:
docker-compose exec wikibase php ./extensions/Wikibase/repo/maintenance/dumpRdf.php
All data for Wikibase and the Query Service is stored in Docker volumes. You can create compressed copies of these volumes to use as backups or to hand off to other users.
Volume backups will only work if you use the same image when restoring / using the backup data. If you are backing up your mysql data you may also want to just take an SQL dump.
You can see all Docker volumes created by using the following command:
docker volume ls | grep wikibase-docker
You can grab a zip of each volumes by doing the following:
docker run -v wikibase-docker_mediawiki-mysql-data:/volume -v /tmp/wikibase-data:/backup --rm loomchild/volume-backup backup mediawiki-mysql-data
You, or someone else, can then restore the volume by doing the following:
docker run -v wikibase-docker_mediawiki-mysql-data:/volume -v /tmp/wikibase-data:/backup --rm loomchild/volume-backup restore mediawiki-mysql-data
If using volume-backup for the database does not work because of InnoDB tables (check here), you can achieve data backup using mysqldump.
docker exec wikibase-docker_mysql_1 mysqldump -u wikiuser -psqlpass my_wiki > backup.sql
docker exec wikibase-docker_mysql_1 mysql -u wikiuser -psqlpass my_wiki < backup.sql
- I am on linux and I don't want to run docker as root!
- Everything seemed to stop and nothing seems to work
- The docker-compose setup requires more than 4GB of available RAM to start.
- I am using Docker Toolbox and can't access localhost:8181 (or anything else on localhost)
- You probably need to connect to the IP address of the virtual machine