Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN \
org.wikimedia.search:extra:${ELASTICSEARCH_PLUGIN_WIKIMEDIA_EXTRA} && \
./bin/elasticsearch-plugin install \
org.wikimedia.search.highlighter:experimental-highlighter-elasticsearch-plugin:${ELASTICSEARCH_PLUGIN_WIKIMEDIA_HIGHLIGHTER}
COPY healthcheck.sh /healthcheck.sh
Comment thread
rti marked this conversation as resolved.
COPY default.jvm.options /default.jvm.options
RUN cat /default.jvm.options >> /usr/share/elasticsearch/config/jvm.options && \
rm /default.jvm.options
13 changes: 7 additions & 6 deletions build/elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,25 @@ services:
DB_USER: "mariadb-user"
DB_PASS: "change-this-password"
ELASTICSEARCH_HOST: elasticsearch
healthcheck:
test: curl --silent --fail localhost/wiki/Main_Page
interval: 10s
start_period: 5m
depends_on:
mysql:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: /healthcheck.sh
interval: 10s
start_period: 5m

wikibase-jobrunner:
image: wikibase/wikibase
volumes_from:
- wikibase
command: /jobrunner-entrypoint.sh
depends_on:
wikibase:
condition: service_healthy
restart: always
environment:
IS_JOBRUNNER: true

mysql:
image: mariadb:10.11
Expand All @@ -90,7 +91,7 @@ services:
discovery.type: single-node
ES_JAVA_OPTS: -Xms512m -Xmx512m -Dlog4j2.formatMsgNoLookups=true
healthcheck:
test: curl --silent --fail localhost:9200
test: /healthcheck.sh
interval: 10s
start_period: 2m

Expand Down
17 changes: 17 additions & 0 deletions build/elasticsearch/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Ref. https://github.com/docker-library/healthcheck/blob/master/elasticsearch/docker-healthcheck

set -eo pipefail

host="$(hostname --ip-address || echo '127.0.0.1')"

if health="$(curl -fsSL "http://$host:9200/_cat/health?h=status")"; then
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ")
if [ "$health" = 'green' ]; then
exit 0
fi
echo >&2 "unexpected health status: $health"
fi

exit 1
1 change: 1 addition & 0 deletions build/quickstatements/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ COPY --from=composer /tmp/quickstatements /var/www/html/quickstatements
COPY --from=composer /tmp/magnustools /var/www/html/magnustools

COPY entrypoint.sh /entrypoint.sh
COPY healthcheck.sh /healthcheck.sh

COPY config.json /templates/config.json
COPY oauth.ini /templates/oauth.ini
Expand Down
12 changes: 7 additions & 5 deletions build/quickstatements/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,20 @@ services:
DB_PASS: "change-this-password"
QUICKSTATEMENTS_PUBLIC_URL: https://quickstatements.example
healthcheck:
test: curl --silent --fail localhost/wiki/Main_Page
test: /healthcheck.sh
interval: 10s
start_period: 5m

wikibase-jobrunner:
image: wikibase/wikibase
command: /jobrunner-entrypoint.sh
volumes_from:
- wikibase
depends_on:
wikibase:
condition: service_healthy
restart: always
volumes_from:
- wikibase
environment:
IS_JOBRUNNER: true

mysql:
image: mariadb:10.11
Expand Down Expand Up @@ -148,7 +149,7 @@ services:
QUICKSTATEMENTS_PUBLIC_URL: https://quickstatements.example
WIKIBASE_PUBLIC_URL: https://wikibase.example
healthcheck:
test: curl --silent --fail localhost
test: /healthcheck.sh
interval: 10s
start_period: 2m

Expand Down Expand Up @@ -215,6 +216,7 @@ Hooking into the internal filesystem can extend the functionality of this image.

| Directory | Description |
| ------------------------------------------- | ------------------------------ |
| `/healthcheck.sh` | Optional healthcheck script |
| `/var/www/html/quickstatements` | Base QuickStatements directory |
| `/var/www/html/quickstatements/public_html` | The Apache root folder |
| `/var/www/html/magnustools` | Base magnustools directory |
Expand Down
10 changes: 10 additions & 0 deletions build/quickstatements/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# Perform the health check using curl
if curl --silent --fail "http://localhost" > /dev/null; then
echo "Health check passed."
exit 0
else
echo "Health check failed."
exit 1
fi
1 change: 1 addition & 0 deletions build/wdqs-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ COPY --from=builder /tmp/wikidata-query-gui/build /usr/share/nginx/html
RUN echo "" > style.css
COPY logo.svg /usr/share/nginx/html/logo.svg
COPY entrypoint.sh /entrypoint.sh
COPY healthcheck.sh /healthcheck.sh
COPY wdqs-frontend-config.json.template /templates/wdqs-frontend-config.json.template
COPY nginx-default.conf.template /templates/nginx-default.conf.template

Expand Down
9 changes: 5 additions & 4 deletions build/wdqs-frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,20 @@ services:
DB_USER: "mariadb-user"
DB_PASS: "change-this-password"
healthcheck:
test: curl --silent --fail localhost/wiki/Main_Page
test: /healthcheck.sh
interval: 10s
start_period: 5m

wikibase-jobrunner:
image: wikibase/wikibase
command: /jobrunner-entrypoint.sh
depends_on:
wikibase:
condition: service_healthy
restart: always
volumes_from:
- wikibase
environment:
IS_JOBRUNNER: true

mysql:
image: mariadb:10.11
Expand Down Expand Up @@ -125,7 +126,7 @@ services:
volumes:
- wdqs-data:/wdqs/data
healthcheck:
test: curl --silent --fail localhost:9999/bigdata/namespace/wdq/sparql
test: /healthcheck.sh
interval: 10s
start_period: 2m

Expand Down Expand Up @@ -155,7 +156,7 @@ services:
WDQS_PUBLIC_URL: https://query.wikibase.example/sparql
WIKIBASE_PUBLIC_URL: https://wikibase.example/w/api.php
healthcheck:
test: curl --silent --fail localhost
test: /healthcheck.sh
interval: 10s
start_period: 2m

Expand Down
10 changes: 10 additions & 0 deletions build/wdqs-frontend/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Perform the health check using curl
if curl --silent --fail "http://localhost" > /dev/null; then
echo "Health check passed."
exit 0
else
echo "Health check failed."
exit 1
fi
2 changes: 1 addition & 1 deletion build/wdqs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ EXPOSE 9999

WORKDIR /wdqs

COPY --chown=blazegraph:blazegraph wait-for-it.sh entrypoint.sh runBlazegraph.sh runUpdate.sh /
COPY --chown=blazegraph:blazegraph wait-for-it.sh healthcheck.sh entrypoint.sh runBlazegraph.sh runUpdate.sh /
COPY --chown=blazegraph:blazegraph mwservices.json /templates/mwservices.json
COPY --chown=blazegraph:blazegraph RWStore.properties allowlist.txt logback.xml /wdqs/

Expand Down
8 changes: 5 additions & 3 deletions build/wdqs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,20 @@ services:
DB_USER: "mariadb-user"
DB_PASS: "change-this-password"
healthcheck:
test: curl --silent --fail localhost/wiki/Main_Page
test: /healthcheck.sh
interval: 10s
start_period: 5m

wikibase-jobrunner:
image: wikibase/wikibase
command: /jobrunner-entrypoint.sh
depends_on:
wikibase:
condition: service_healthy
restart: always
volumes_from:
- wikibase
environment:
IS_JOBRUNNER: true

mysql:
image: mariadb:10.11
Expand Down Expand Up @@ -127,7 +128,7 @@ services:
volumes:
- wdqs-data:/wdqs/data
healthcheck:
test: curl --silent --fail localhost:9999/bigdata/namespace/wdq/sparql
test: /healthcheck.sh
interval: 10s
start_period: 2m
labels:
Expand Down Expand Up @@ -245,6 +246,7 @@ Hooking into the internal filesystem can extend the functionality of this image.

| File | Description |
| ---------------------------- | ---------------------------------------------------------------------------------------------- |
| `/healthcheck.sh` | Optional healthcheck script |
| `/wdqs/allowlist.txt` | SPARQL endpoints allowed for federation |
| `/wdqs/RWStore.properties` | Properties for the service |
| `/templates/mwservices.json` | Template for MediaWiki services (populated and placed into `/wdqs/mwservices.json` at runtime) |
Expand Down
10 changes: 10 additions & 0 deletions build/wdqs/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# Perform the health check using curl
if curl --silent --fail "http://localhost:9999/bigdata/namespace/wdq/sparql" > /dev/null; then
echo "Health check passed."
exit 0
else
echo "Health check failed."
exit 1
fi
9 changes: 6 additions & 3 deletions build/wikibase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,12 @@ RUN chmod o-w /var/www/html && \
ln -s /var/www/html/ /var/www/html/w && \
chown www-data /var/www/html/images -R

COPY wikibase-php.ini /usr/local/etc/php/conf.d/wikibase-php.ini
COPY entrypoint.sh /entrypoint.sh
COPY callback.sh /callback.sh
COPY mediawiki-entrypoint.sh /mediawiki-entrypoint.sh
COPY jobrunner-entrypoint.sh /jobrunner-entrypoint.sh
COPY callback.sh /callback.sh
COPY healthcheck.sh /healthcheck.sh
COPY wikibase-php.ini /usr/local/etc/php/conf.d/wikibase-php.ini
COPY htaccess /var/www/html/.htaccess
COPY LocalSettings.d LocalSettings.d
COPY default-extra-install.sh /default-extra-install.sh
Expand All @@ -230,7 +232,8 @@ COPY LocalSettings.wbs.php /templates/LocalSettings.wbs.php
ENV DB_NAME=my_wiki \
MW_WG_SITENAME=wikibase \
MW_WG_LANGUAGE_CODE=en \
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_PORT=9200 \
IS_JOBRUNNER=false

ENTRYPOINT ["/bin/bash"]
CMD ["/entrypoint.sh"]
15 changes: 9 additions & 6 deletions build/wikibase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Variables in **bold** are required on first launch without `LocalSettings.php` i

| Variable | Default | Description |
| ---------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`IS_JOBRUNNER`** | false | If set to true the container will only run `maintenance/runJobs.php` instead of MediaWiki |
Comment thread
rti marked this conversation as resolved.
| **`DB_SERVER`** | undefined | Hostname and port for the MySQL server to use for MediaWiki & Wikibase |
| **`DB_USER`** | undefined | Username to use for the MySQL server |
| **`DB_PASS`** | undefined | Password to use for the MySQL server |
Expand Down Expand Up @@ -80,7 +81,7 @@ The same values are also exposed through the Action API metadata endpoint: `/w/a

MediaWiki/Wikibase depends on [jobs being run in the background](https://www.mediawiki.org/wiki/Manual:Job_queue). This can be either done on HTTP request or by a dedicated job runner. The default configuration of this image requires an external job runner like this.

To set up an external job runner, use this image for a second container, overwrite the command to `/jobrunner-entrypoint.sh` and share the same configuration volume with it.
To set up an external job runner, use this image for a second container, set the environment variable `IS_JOBRUNNER` to "true" and share the same configuration volume with it.

## Example

Expand All @@ -104,24 +105,25 @@ services:
DB_NAME: "my_wiki"
DB_USER: "mariadb-user"
DB_PASS: "change-this-password"
healthcheck:
test: curl --silent --fail localhost/wiki/Main_Page
interval: 10s
start_period: 5m
depends_on:
mysql:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: /healthcheck.sh
interval: 10s
start_period: 5m

wikibase-jobrunner:
image: wikibase/wikibase
volumes_from:
- wikibase
command: /jobrunner-entrypoint.sh
depends_on:
wikibase:
condition: service_healthy
restart: always
environment:
IS_JOBRUNNER: true

mysql:
image: mariadb:10.11
Expand Down Expand Up @@ -177,6 +179,7 @@ Hooking into the internal filesystem can extend the functionality of this image.

| File | Description |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/healthcheck.sh` | Optional healthcheck script |
| `/default-extra-install.sh` | Script for automatically creating Elasticsearch indices and creating OAuth consumer for QuickStatements |
| `/extra-install.sh` | Optional script for custom functionality to be ran with MediaWiki install (when generating LocalSettings.php) |
| `/templates/LocalSettings.wbs.php` | Wikibase-specific settings appended to the MediaWiki install generated `LocalSettings.php`. Specifically, this loads the Wikibase repo and client as well as all the other bundled extensions. |
Expand Down
Loading