User:Dan Shick (WMDE)/Drafts/Docker
Installing Wikibase with Docker
[edit]The Wikibase team is now regularly releasing Docker images with MediaWiki, Wikibase and associated services. With a little customization, you can install exactly the kind of Wikibase instance you need.
Before you start
[edit]- You’ll need to have docker and docker-compose installed on the computer where you want to run your Wikibase instance. (For help with this step, consult the resources list at the bottom of the page.)
- The Wikibase team recommends providing at least 8GiB of RAM for a complete Docker install including all services.
- You can get quick insight into your Docker resource usage with the
docker stats
command; also check out Docker’s documentation on resource constraints.
- You can get quick insight into your Docker resource usage with the
Preparing your environment
[edit]Clone the wikibase-release-pipeline repository.
In the example
directory, copy the template.env
file to a file named .env
and populate the following sections with the secure usernames and passwords of your choice.
Mediawiki Configuration
[edit]- MW_ADMIN_NAME
- MW_ADMIN_PASS
- MW_ADMIN_EMAIL
These values will be deployed into your MediaWiki installation. You'll use this username and password to log into the web interface of your new instance for the first time; the email address you enter here also serves as your password recovery channel.
This secret key should be unique; MediaWiki uses it for several purposes (e.g., session management, fallback cryptographic entropy source). See the link for more information.
Database Configuration
[edit]- DB_NAME
- DB_USER
- DB_PASS
The database name, user and password you specify here will be deployed into your installation.
Wikibase Configuration
[edit]- WIKIBASE_PINGBACK=false
By default, the Wikibase pingback feature is disabled. Please consider enabling this feature (which sends only anonymized data) by changing false
to true
.
Enabling this feature significantly improves Wikimedia Deutschland's insight into how Wikibase is being used and helps us make more informed decisions regarding the development roadmap. For more information, read our pingback documentation topic.
- WIKIBASE_HOST=localhost
- WIKIBASE_PORT=80
If you need MediaWiki to run on a different port or IP on your system, you can change those here.
Files
[edit]Place your modified .env
file in the example
folder, or place it and the complete contents of the example
folder in a folder of your choice.
Minimal install
[edit]At this stage, you have what you need to install MediaWiki (running on port 80) with Wikibase and a MySQL (MariaDB) backing database.
Simply run:
docker-compose up -d
Extended install
[edit]You may also wish to run additional services like the query service (WDQS), QuickStatements (see here for more information) and Elasticsearch.
To do so, you'll need to make some changes to the files provided in the example
directory.
1. In docker-compose.yml
, uncomment two areas:
a. Uncomment the line that calls the extended install script.
b. Uncomment the lines that specify MW_ELASTIC_HOST
and MW_ELASTIC_PORT
.
The code snippet below shows the lines uncommented, with surrounding lines for context.
#
character, leaving the rest indented as it is.docker-compose.yml
:
... volumes: - quickstatements-data:/quickstatements/data - ./extra-install.sh:/extra-install.sh networks: ... - DB_NAME=${DB_NAME} - MW_ELASTIC_HOST=elasticsearch.svc - MW_ELASTIC_PORT=9200 - WIKIBASE_HOST ...
2. Run:
docker-compose -f docker-compose.yml -f docker-compose.extra.yml up -d
Notes
[edit]Both install processes end up launching two Docker containers:
{folder-name}_wikibase_1
{folder-name}_mysql_1
.
The example invocations of docker-compose
use the -d
flag to start the containers in the background. You can omit this flag to run in the foreground, or, if you simply wish to view the continuous output, you can subsequently run docker-compose logs -f
.
After install
[edit]1. Verify that all the services have started: run docker-compose ps
. You should see something like this:
Name Command State Ports ----------------------------------------------------------------------------- example_mysql_1 docker-entrypoint.sh mysqld Up 3306/tcp example_wikibase_1 /bin/bash /entrypoint.sh Up 0.0.0.0:80->80/tcp
2. Log in at [1].
3. You may check the logs for success, further information or errors using this command: sudo docker-compose logs --tail=20 -t
For more detailed information, check out the README in the examples section of the wikibase-release-pipeline repository.
Using your new instance
[edit]Once all the services have started, you can begin the exciting process of filling up, extending and customizing your empty instance of Wikibase. Take a look at our setup resources page to get started.