|
1 |
| -# Example docker compose configuration |
| 1 | +# Wikibase Suite (WBS) Docker Compose example configuration |
2 | 2 |
|
3 |
| -The example docker compose configuration consists of two files: |
| 3 | +An example of connecting and using all the WBS provided Docker Images using Docker compose. |
4 | 4 |
|
5 |
| -* `docker-compose.yml` contains two services: wikibase and mysql |
6 |
| -* `docker-compose.extra.yml` contains additional services such as wdqs, wdqs-frontend, elasticsearch and quickstatements |
| 5 | +The core of this example are the following files: |
7 | 6 |
|
8 |
| -**We recommend you go through `docker-compose.extra.yml` and remove any unwanted services.** |
| 7 | +- `docker-compose.yml` Wikibase, Database (MariaDB), WDQS, WDQS Frontend, Elasticsearch, and QuickStatements |
| 8 | +- `template.env` The configuration template |
9 | 9 |
|
10 |
| -**This configuration serves as an example of how the images could be used together and isn't production ready** |
| 10 | +**DISCLAIMER: This configuration serves as an example of how the images could be used together but isn't production ready** |
11 | 11 |
|
12 |
| -## Configure your installation |
| 12 | +## ⚙️ Configure |
13 | 13 |
|
14 |
| -Copy `template.env` to `.env` and replace the passwords and secrets with your own. |
| 14 | +The first step to running WBS is review and update the configuration to reflect the needs of your own production environment. |
15 | 15 |
|
16 |
| -## Running a Wikibase instance |
| 16 | +1. Copy `template.env` to `.env` |
| 17 | +2. Open `.env` in a text editor and create new passwords and a secret according to the guidance. Also read the notes there and review the other highlighted configuration options. |
17 | 18 |
|
18 |
| -To run a Wikibase instance on port 80 run the following command: |
| 19 | +## 🏃🏽♀️ Run |
19 | 20 |
|
20 |
| -``` |
21 |
| -docker compose up |
22 |
| -``` |
| 21 | +After completing the configuration steps above, run the following command to start the full Wikibase Suite set of services: |
23 | 22 |
|
24 |
| -This will start up the services defined in [docker-compose.yml](docker-compose.yml), a Wikibase instance, database and a job runner. |
| 23 | + ```sh |
| 24 | + docker compose up -d --wait |
| 25 | + ``` |
25 | 26 |
|
26 |
| -## Job runner |
| 27 | + Once successfully booted, the front-end services will be available at the following locations: |
27 | 28 |
|
28 |
| -The example docker-compose.yml sets up a dedicated job runner which restarts itself after every job, to ensure that changes to the configuration are picked up as quickly as possible. |
| 29 | + - Wikibase: http://localhost:8880 |
| 30 | + - WDQS: http://localhost:8834 |
| 31 | + - QuickStatements: http://localhost:8840 |
29 | 32 |
|
30 |
| -If you run large batches of edits, this job runner may not be able to keep up with edits. |
31 |
| - |
32 |
| -You can speed it up by increasing the `MAX_JOBS` variable to run more jobs between restarts, if you’re okay with configuration changes not taking effect in the job runner immediately. |
33 |
| -Alternatively, you can run several job runners in parallel by using the `--scale` option. |
| 33 | +Note: QuickStatements will not be able to authorize without configuring both `QS_PUBLIC_SCHEME_HOST_AND_PORT` and `WB_PUBLIC_SCHEME_HOST_AND_PORT` to URLs which are accessible both from within the Docker network and on the host machine running Docker. A reverse-proxy service is used to route subdomain names to the related services ports such that you can access the services simply by a set of designated subdomains. An optional reverse proxy service is included in this example as a means for handling this. This service is optional, and any other reverse proxy service can be used. To use the provided service enable the `nginx-proxy` Docker Compose profile: |
34 | 34 |
|
35 | 35 | ```sh
|
36 |
| -docker compose up --scale wikibase-jobrunner=8 |
| 36 | +docker compose --profile nginx-proxy up -d --wait |
37 | 37 | ```
|
38 | 38 |
|
39 |
| -## Running additional services |
| 39 | +When ran using this provided `nginx-proxy` setup the WBS services can be accessed at the configured host addresses. |
40 | 40 |
|
41 |
| -The Wikibase bundle comes with some additional services that can be enabled. |
| 41 | +If Elasticsearch, WDQS, or QuickStatements are not required they can be removed from the related sections in `docker-compose.yml`. |
42 | 42 |
|
43 |
| -- wdqs |
44 |
| -- wdqs-updater |
45 |
| -- wdqs-frontend |
46 |
| -- quickstatements |
47 |
| -- elasticsearch |
| 43 | +## ⚠️ Updating configuration and resetting data |
48 | 44 |
|
49 |
| -### 1. Run with the extra configuration |
| 45 | +The `.env` file is currently only designed for initial setup. To reflect changes in the `.env` file after initially running the services, the services will need to be stopped and the related docker volumes deleted. DISCLAIMER: THIS IS CURRENTLY IRREVERSIBLE AND REMOVES ANY DATA AND CONFIGURATION: |
50 | 46 |
|
51 | 47 | ```
|
52 |
| -docker compose -f docker-compose.yml -f docker-compose.extra.yml up |
| 48 | +docker compose down --volumes |
53 | 49 | ```
|
54 | 50 |
|
55 |
| -In the volumes section of the wikibase service in [docker-compose.extra.yml](docker-compose.extra.yml), there is one additional script inside the container that automatically sets up the extensions needed for the additional services. |
| 51 | +After this is done the next `docker compose` run will again use the settings in `.env` for initial configuration. |
56 | 52 |
|
57 |
| -```yml |
58 |
| -- ./extra-install.sh:/extra-install.sh |
59 |
| -``` |
| 53 | +## Notes |
| 54 | + |
| 55 | +### Extra install |
60 | 56 |
|
61 |
| -Looking inside extra-install.sh, you see that it executes two scripts which set up an OAuth consumer for quickstatements and creates indices for Elasticsearch. |
| 57 | +Looking inside `extra-install.sh`, you see that it executes two scripts which set up an OAuth consumer for quickstatements and creates indices for Elasticsearch. In the volumes section of the wikibase service in [docker-compose.extra.yml](docker-compose.extra.yml), there is one additional script inside the container that automatically sets up the extensions needed for the additional services: |
62 | 58 |
|
| 59 | + ```yml |
| 60 | + - ./extra-install.sh:/extra-install.sh |
| 61 | + ``` |
63 | 62 |
|
64 |
| -There are also additional environment variables passed into Wikibase to configure the Elasticsearch host and port. |
65 |
| -```yml |
66 |
| - MW_ELASTIC_HOST: ${MW_ELASTIC_HOST} |
67 |
| - MW_ELASTIC_PORT: ${MW_ELASTIC_PORT} |
| 63 | +### Job runner |
| 64 | +
|
| 65 | +The example `docker-compose.yml` sets up a dedicated job runner which restarts itself after every job, to ensure that changes to the configuration are picked up as quickly as possible. |
| 66 | + |
| 67 | +If you run large batches of edits, this job runner may not be able to keep up with edits. |
| 68 | + |
| 69 | +You can speed it up by increasing the `MAX_JOBS` variable to run more jobs between restarts, if you’re okay with configuration changes not taking effect in the job runner immediately. |
| 70 | +Alternatively, you can run several job runners in parallel by using the `--scale` option. |
| 71 | + |
| 72 | +```sh |
| 73 | +docker compose up --scale wikibase-jobrunner=8 |
68 | 74 | ```
|
0 commit comments