diff --git a/build/elasticsearch/Dockerfile b/build/elasticsearch/Dockerfile index 842e3c13f..9c35add10 100644 --- a/build/elasticsearch/Dockerfile +++ b/build/elasticsearch/Dockerfile @@ -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 COPY default.jvm.options /default.jvm.options RUN cat /default.jvm.options >> /usr/share/elasticsearch/config/jvm.options && \ rm /default.jvm.options diff --git a/build/elasticsearch/README.md b/build/elasticsearch/README.md index 8a5f87cdd..e1f34c1db 100644 --- a/build/elasticsearch/README.md +++ b/build/elasticsearch/README.md @@ -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 @@ -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 diff --git a/build/elasticsearch/healthcheck.sh b/build/elasticsearch/healthcheck.sh new file mode 100755 index 000000000..0ccbb8d0b --- /dev/null +++ b/build/elasticsearch/healthcheck.sh @@ -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 diff --git a/build/quickstatements/Dockerfile b/build/quickstatements/Dockerfile index c1922beaa..602ff0425 100644 --- a/build/quickstatements/Dockerfile +++ b/build/quickstatements/Dockerfile @@ -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 diff --git a/build/quickstatements/README.md b/build/quickstatements/README.md index 9e45371b2..333295505 100644 --- a/build/quickstatements/README.md +++ b/build/quickstatements/README.md @@ -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 @@ -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 @@ -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 | diff --git a/build/quickstatements/healthcheck.sh b/build/quickstatements/healthcheck.sh new file mode 100755 index 000000000..bedacc59c --- /dev/null +++ b/build/quickstatements/healthcheck.sh @@ -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 diff --git a/build/wdqs-frontend/Dockerfile b/build/wdqs-frontend/Dockerfile index 447cd8330..e1993e9de 100644 --- a/build/wdqs-frontend/Dockerfile +++ b/build/wdqs-frontend/Dockerfile @@ -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 diff --git a/build/wdqs-frontend/README.md b/build/wdqs-frontend/README.md index 7eadd69b1..011e094be 100644 --- a/build/wdqs-frontend/README.md +++ b/build/wdqs-frontend/README.md @@ -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 @@ -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 @@ -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 diff --git a/build/wdqs-frontend/healthcheck.sh b/build/wdqs-frontend/healthcheck.sh new file mode 100755 index 000000000..59ede7276 --- /dev/null +++ b/build/wdqs-frontend/healthcheck.sh @@ -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 diff --git a/build/wdqs/Dockerfile b/build/wdqs/Dockerfile index ee1797e21..c7db219e5 100644 --- a/build/wdqs/Dockerfile +++ b/build/wdqs/Dockerfile @@ -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/ diff --git a/build/wdqs/README.md b/build/wdqs/README.md index 18b784995..8b3900d6b 100644 --- a/build/wdqs/README.md +++ b/build/wdqs/README.md @@ -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 @@ -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: @@ -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) | diff --git a/build/wdqs/healthcheck.sh b/build/wdqs/healthcheck.sh new file mode 100755 index 000000000..8a03aa284 --- /dev/null +++ b/build/wdqs/healthcheck.sh @@ -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 diff --git a/build/wikibase/Dockerfile b/build/wikibase/Dockerfile index 37aab36bf..cd5a32b0d 100644 --- a/build/wikibase/Dockerfile +++ b/build/wikibase/Dockerfile @@ -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 @@ -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"] diff --git a/build/wikibase/README.md b/build/wikibase/README.md index ab8be24dd..ce72743e2 100644 --- a/build/wikibase/README.md +++ b/build/wikibase/README.md @@ -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 | | **`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 | @@ -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 @@ -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 @@ -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. | diff --git a/build/wikibase/entrypoint.sh b/build/wikibase/entrypoint.sh old mode 100644 new mode 100755 index 6f85a8188..969440906 --- a/build/wikibase/entrypoint.sh +++ b/build/wikibase/entrypoint.sh @@ -1,113 +1,9 @@ #!/usr/bin/env bash +set -e -# This file is provided by the wikibase/wikibase docker image. - -# Exit immediately with message if no /config volume is available -if [ ! -d "/config" ]; then - echo "A volume mapped to /config is required." - exit 1 -fi - -# Exit immediate on errors or unset variables from here onwards -set -eu - -if ! [ -v METADATA_CALLBACK ] || [ -z "$METADATA_CALLBACK" ]; then - echo "*** ERROR ***" - echo "METADATA_CALLBACK not configured." - echo "https://github.com/wmde/wikibase-release-pipeline/blob/main/build/wikibase/README.md" - echo "Exiting Wikibase container now." - exit 1 -fi - -bash /callback.sh || true - -# Take wikibase-php.ini from user config if present -if [ -e "/config/wikibase-php.ini" ]; then - cp /config/wikibase-php.ini /usr/local/etc/php/conf.d/wikibase-php.ini - -# Otherwise, make our stock wikibase-php.ini visible to the user for customization +# Check if IS_JOBRUNNER is set to "true" +if [ "$IS_JOBRUNNER" = "true" ]; then + exec /jobrunner-entrypoint.sh "$@" else - cp /usr/local/etc/php/conf.d/wikibase-php.ini /config/wikibase-php.ini + exec /mediawiki-entrypoint.sh "$@" fi - -if [ -e "/config/LocalSettings.php" ]; then - cp /config/LocalSettings.php /var/www/html/LocalSettings.php - # Always run update (this might be the first run off of a new image version on existing config and data) - # TODO: Switch to the new way of running maintenance scripts after dropping 1.39 support end of 2025 - #php /var/www/html/maintenance/run.php update --quick - php /var/www/html/maintenance/update.php --quick -else - echo "/config/LocalSettings.php not found, running MediaWiki install." - - # Check for required env vars - set +u - required_vars=( - DB_SERVER - DB_PASS - DB_USER - DB_NAME - MW_ADMIN_NAME - MW_ADMIN_EMAIL - MW_ADMIN_PASS - MW_WG_SERVER - MW_WG_LANGUAGE_CODE - MW_WG_SITENAME - ) - for var in "${required_vars[@]}"; do - if [ -z "${!var}" ]; then - echo "$var is required but isn't set. You should pass it to Docker. See: https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file" - exit 1 - fi - done - set -u - - # Run MediaWiki install script, and update values - # TODO: Switch to the new way of running maintenance scripts after dropping 1.39 support end of 2025 - #php /var/www/html/maintenance/run.php install \ - php /var/www/html/maintenance/install.php \ - --server "$MW_WG_SERVER" \ - --scriptpath "/w" \ - --dbuser "$DB_USER" \ - --dbpass "$DB_PASS" \ - --dbname "$DB_NAME" \ - --dbserver "$DB_SERVER" \ - --pass "$MW_ADMIN_PASS" \ - --lang "$MW_WG_LANGUAGE_CODE" \ - "$MW_WG_SITENAME" \ - "$MW_ADMIN_NAME" - - # Include WBS customizations to generated LocalSettings.php - { - echo - echo '# Configuration added by Wikibase Suite installer in entrypoint.sh' - echo - if [[ -v ELASTICSEARCH_HOST ]]; then - echo "\$elasticsearchHost = '$ELASTICSEARCH_HOST';" - fi - echo - grep -v "> /var/www/html/LocalSettings.php - - # Replace /config/LocalSettings.php with newly generated LocalSettings.php - cp /var/www/html/LocalSettings.php /config/LocalSettings.php - # Update the MW Admin email address (if this admin user doesn't already exist, a new one will be created) - # TODO: Switch to the new way of running maintenance scripts after dropping 1.39 support end of 2025 - #php /var/www/html/maintenance/run.php resetUserEmail --no-reset-password "$MW_ADMIN_NAME" "$MW_ADMIN_EMAIL" - php /var/www/html/maintenance/resetUserEmail.php --no-reset-password "$MW_ADMIN_NAME" "$MW_ADMIN_EMAIL" - - # TODO: Switch to the new way of running maintenance scripts after dropping 1.39 support end of 2025 - #php /var/www/html/maintenance/run.php update --quick - php /var/www/html/maintenance/update.php --quick - - if [ -f /default-extra-install.sh ]; then - bash /default-extra-install.sh - fi - - if [ -f /extra-install.sh ]; then - bash /extra-install.sh - fi -fi - -# Run the actual entry point -docker-php-entrypoint apache2-foreground diff --git a/build/wikibase/healthcheck.sh b/build/wikibase/healthcheck.sh new file mode 100755 index 000000000..aa108e80a --- /dev/null +++ b/build/wikibase/healthcheck.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +if [ "$IS_JOBRUNNER" = "true" ]; then + # Check if the JobRunner process is running + if pgrep -f "php maintenance/runJobs.php" > /dev/null; then + # Check if showJobs.php executes successfully + if php /path/to/mediawiki/maintenance/showJobs.php > /dev/null 2>&1; then + exit 0 # Healthy + else + exit 1 # Unhealthy: showJobs.php did not execute successfully + fi + else + exit 1 # Unhealthy: JobRunner process not found + fi +else + if curl --silent --fail "http://localhost/wiki/Main_Page" > /dev/null; then + exit 0 # Healthy + else + exit 1 # Unhealthy + fi +fi diff --git a/build/wikibase/jobrunner-entrypoint.sh b/build/wikibase/jobrunner-entrypoint.sh old mode 100644 new mode 100755 diff --git a/build/wikibase/mediawiki-entrypoint.sh b/build/wikibase/mediawiki-entrypoint.sh new file mode 100755 index 000000000..6f85a8188 --- /dev/null +++ b/build/wikibase/mediawiki-entrypoint.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +# This file is provided by the wikibase/wikibase docker image. + +# Exit immediately with message if no /config volume is available +if [ ! -d "/config" ]; then + echo "A volume mapped to /config is required." + exit 1 +fi + +# Exit immediate on errors or unset variables from here onwards +set -eu + +if ! [ -v METADATA_CALLBACK ] || [ -z "$METADATA_CALLBACK" ]; then + echo "*** ERROR ***" + echo "METADATA_CALLBACK not configured." + echo "https://github.com/wmde/wikibase-release-pipeline/blob/main/build/wikibase/README.md" + echo "Exiting Wikibase container now." + exit 1 +fi + +bash /callback.sh || true + +# Take wikibase-php.ini from user config if present +if [ -e "/config/wikibase-php.ini" ]; then + cp /config/wikibase-php.ini /usr/local/etc/php/conf.d/wikibase-php.ini + +# Otherwise, make our stock wikibase-php.ini visible to the user for customization +else + cp /usr/local/etc/php/conf.d/wikibase-php.ini /config/wikibase-php.ini +fi + +if [ -e "/config/LocalSettings.php" ]; then + cp /config/LocalSettings.php /var/www/html/LocalSettings.php + # Always run update (this might be the first run off of a new image version on existing config and data) + # TODO: Switch to the new way of running maintenance scripts after dropping 1.39 support end of 2025 + #php /var/www/html/maintenance/run.php update --quick + php /var/www/html/maintenance/update.php --quick +else + echo "/config/LocalSettings.php not found, running MediaWiki install." + + # Check for required env vars + set +u + required_vars=( + DB_SERVER + DB_PASS + DB_USER + DB_NAME + MW_ADMIN_NAME + MW_ADMIN_EMAIL + MW_ADMIN_PASS + MW_WG_SERVER + MW_WG_LANGUAGE_CODE + MW_WG_SITENAME + ) + for var in "${required_vars[@]}"; do + if [ -z "${!var}" ]; then + echo "$var is required but isn't set. You should pass it to Docker. See: https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file" + exit 1 + fi + done + set -u + + # Run MediaWiki install script, and update values + # TODO: Switch to the new way of running maintenance scripts after dropping 1.39 support end of 2025 + #php /var/www/html/maintenance/run.php install \ + php /var/www/html/maintenance/install.php \ + --server "$MW_WG_SERVER" \ + --scriptpath "/w" \ + --dbuser "$DB_USER" \ + --dbpass "$DB_PASS" \ + --dbname "$DB_NAME" \ + --dbserver "$DB_SERVER" \ + --pass "$MW_ADMIN_PASS" \ + --lang "$MW_WG_LANGUAGE_CODE" \ + "$MW_WG_SITENAME" \ + "$MW_ADMIN_NAME" + + # Include WBS customizations to generated LocalSettings.php + { + echo + echo '# Configuration added by Wikibase Suite installer in entrypoint.sh' + echo + if [[ -v ELASTICSEARCH_HOST ]]; then + echo "\$elasticsearchHost = '$ELASTICSEARCH_HOST';" + fi + echo + grep -v "> /var/www/html/LocalSettings.php + + # Replace /config/LocalSettings.php with newly generated LocalSettings.php + cp /var/www/html/LocalSettings.php /config/LocalSettings.php + # Update the MW Admin email address (if this admin user doesn't already exist, a new one will be created) + # TODO: Switch to the new way of running maintenance scripts after dropping 1.39 support end of 2025 + #php /var/www/html/maintenance/run.php resetUserEmail --no-reset-password "$MW_ADMIN_NAME" "$MW_ADMIN_EMAIL" + php /var/www/html/maintenance/resetUserEmail.php --no-reset-password "$MW_ADMIN_NAME" "$MW_ADMIN_EMAIL" + + # TODO: Switch to the new way of running maintenance scripts after dropping 1.39 support end of 2025 + #php /var/www/html/maintenance/run.php update --quick + php /var/www/html/maintenance/update.php --quick + + if [ -f /default-extra-install.sh ]; then + bash /default-extra-install.sh + fi + + if [ -f /extra-install.sh ]; then + bash /extra-install.sh + fi +fi + +# Run the actual entry point +docker-php-entrypoint apache2-foreground diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 2c29db78a..4cb34b4a1 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -36,7 +36,7 @@ services: WDQS_PUBLIC_ENDPOINT_URL: https://${WDQS_PUBLIC_HOST}/sparql WDQS_PUBLIC_FRONTEND_URL: https://${WDQS_PUBLIC_HOST} healthcheck: - test: curl --silent --fail localhost/wiki/Main_Page + test: /healthcheck.sh interval: 10s start_period: 5m @@ -49,6 +49,8 @@ services: restart: unless-stopped volumes_from: - wikibase + environment: + IS_JOBRUNNER: true mysql: image: mariadb:10.11 @@ -82,7 +84,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 @@ -103,7 +105,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 @@ -133,7 +135,7 @@ services: WDQS_PUBLIC_URL: https://${WDQS_PUBLIC_HOST}/sparql WIKIBASE_PUBLIC_URL: https://${WIKIBASE_PUBLIC_HOST}/w/api.php healthcheck: - test: curl --silent --fail localhost + test: /healthcheck.sh interval: 10s start_period: 2m @@ -149,7 +151,7 @@ services: QUICKSTATEMENTS_PUBLIC_URL: https://${WIKIBASE_PUBLIC_HOST}/tools/quickstatements WIKIBASE_PUBLIC_URL: https://${WIKIBASE_PUBLIC_HOST} healthcheck: - test: curl --silent --fail localhost + test: /healthcheck.sh interval: 10s start_period: 2m diff --git a/test/suites/repo_client/docker-compose.override.yml b/test/suites/repo_client/docker-compose.override.yml index d9fe83e94..4ac7c1034 100644 --- a/test/suites/repo_client/docker-compose.override.yml +++ b/test/suites/repo_client/docker-compose.override.yml @@ -38,7 +38,7 @@ services: DB_NAME: client_wiki METADATA_CALLBACK: false healthcheck: - test: curl --silent --fail http://localhost/wiki/Main_Page + test: /healthcheck.sh interval: 10s start_period: 2m