Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenjohnson committed Nov 7, 2024
1 parent 2e419f1 commit e64b389
Show file tree
Hide file tree
Showing 69 changed files with 2,831 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ARG ELASTICSEARCH_IMAGE_URL

# ###########################################################################
# hadolint ignore=DL3006
FROM ${ELASTICSEARCH_IMAGE_URL}
LABEL org.opencontainers.image.source="https://github.com/wmde/wikibase-release-pipeline"
ARG ELASTICSEARCH_PLUGIN_WIKIMEDIA_EXTRA
ARG ELASTICSEARCH_PLUGIN_WIKIMEDIA_HIGHLIGHTER

RUN \
./bin/elasticsearch-plugin install \
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
133 changes: 133 additions & 0 deletions build/elasticsearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Wikibase Suite Elasticsearch Image

[Elasticsearch](https://en.wikipedia.org/wiki/Elasticsearch) is a search engine based on the Lucene library.

This image contains the Elasticsearch server with the
[org.wikimedia.search/extra](https://central.sonatype.com/artifact/org.wikimedia.search/extra)
and
[org.wikimedia.search.highlighter/experimental-highlighter-elasticsearch-plugin](https://central.sonatype.com/artifact/org.wikimedia.search.highlighter/experimental-highlighter-elasticsearch-plugin)
plugins for [Wikibase](https://wikiba.se).

> 💡 This image is part of Wikibase Suite (WBS). [WBS Deploy](https://github.com/wmde/wikibase-release-pipeline/deploy/README.md) provides everything you need to self-host a Wikibase instance out of the box.
## Requirements

In order to run Wikibase Elasticsearch, you need:

- MediaWiki/Wikibase instance

### MediaWiki/Wikibase instance

We suggest using the [WBS Wikibase Image](https://hub.docker.com/r/wikibase/wikibase) because this is the image we
run all our tests against. Follow the setup instructions over there to get it up and running.

Be sure to add the `ELASTICSEARCH_HOST` environment variable to your Wikibase container.

## Example

You can use the following example Docker Compose configuration to setup and run the image. Your Wikibase will be available on [http://localhost](http://localhost).

```yml
services:
wikibase:
image: wikibase/wikibase
ports:
- 80:80
volumes:
- ./config:/config
- wikibase-image-data:/var/www/html/images
environment:
MW_ADMIN_NAME: "admin"
MW_ADMIN_PASS: "change-this-password"
MW_ADMIN_EMAIL: "[email protected]"
MW_WG_SERVER: http://localhost
DB_SERVER: mysql:3306
DB_NAME: "my_wiki"
DB_USER: "mariadb-user"
DB_PASS: "change-this-password"
ELASTICSEARCH_HOST: elasticsearch
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
depends_on:
wikibase:
condition: service_healthy
restart: always
environment:
IS_JOBRUNNER: true

mysql:
image: mariadb:10.11
volumes:
- mysql-data:/var/lib/mysql
environment:
MYSQL_DATABASE: "my_wiki"
MYSQL_USER: "mariadb-user"
MYSQL_PASSWORD: "change-this-password"
MYSQL_RANDOM_ROOT_PASSWORD: yes
healthcheck:
test: healthcheck.sh --connect --innodb_initialized
start_period: 1m
interval: 20s
timeout: 5s
restart: unless-stopped

elasticsearch:
image: wikibase/elasticsearch
restart: unless-stopped
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
environment:
discovery.type: single-node
ES_JAVA_OPTS: -Xms512m -Xmx512m -Dlog4j2.formatMsgNoLookups=true
healthcheck:
test: /healthcheck.sh
interval: 10s
start_period: 2m

volumes:
wikibase-image-data:
mysql-data:
elasticsearch-data:
```
## Releases
Official releases of this image can be found on [Docker Hub wikibase/elasticsearch](https://hub.docker.com/r/wikibase/elasticsearch).
## Tags and Versioning
This Elasticsearch image is using [semantic versioning](https://semver.org/spec/v2.0.0.html).
We provide several tags that relate to the versioning semantics.
| Tag | Example | Description |
| ----------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| _MAJOR_ | 3 | Tags the latest image with this major version. Gets overwritten whenever a new version is released with this major version. This will include new builds triggered by base image changes, patch version updates and minor version updates. |
| _MAJOR_._MINOR_ | 3.1 | Tags the latest image with this major and minor version. Gets overwritten whenever a new version is released with this major and minor version. This will include new builds triggered by base image changes and patch version updates. |
| _MAJOR_._MINOR_._PATCH_ | 3.1.7 | Tags the latest image with this major, minor and patch version. Gets overwritten whenever a new version is released with this major, minor and patch version. This only happens for new builds triggered by base image changes. |
| _MAJOR_._MINOR_._PATCH_\_es*ES-VERSION* | 3.1.7_es7.20.2 | Same as above, but also mentioning the current Elasticsearch version. |
| _MAJOR_._MINOR_._PATCH_\_build*BUILD-TIMESTAMP* | 3.1.7_build20240530103941 | Tag that never gets overwritten. Every image will have this tag with a unique build timestamp. Can be used to reference images explicitly for reproducibility. |
## Source
This image is built from this [Dockerfile](https://github.com/wmde/wikibase-release-pipeline/blob/main/build/Elasticsearch/Dockerfile).
## Authors & Contact
This image is maintained by the Wikibase Suite Team at [Wikimedia Germany (WMDE)](https://wikimedia.de).
If you have questions not listed above or need help, use this [bug report
form](https://phabricator.wikimedia.org/maniphest/task/edit/form/129/) to start
a conversation with the engineering team.
2 changes: 2 additions & 0 deletions build/elasticsearch/default.jvm.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# T297674
-Dlog4j2.formatMsgNoLookups=true
21 changes: 21 additions & 0 deletions build/elasticsearch/dockerhub.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Wikibase Suite Elasticsearch Image

Wikibase Suite (WBS) eases self-hosting [Wikibase](https://wikiba.se) in production, allowing you to maintain a knowledge graph similar to [Wikidata](https://www.wikidata.org/wiki/Wikidata:Main_Page).

If you want to host your own WBS instance, head over to the [WBS Deploy documentation](https://github.com/wmde/wikibase-release-pipeline/blob/main/deploy/README.md).

# Documentation

Version specific documentation for this image is hosted in our [git repository](https://github.com/wmde/wikibase-release-pipeline/).

## Currently supported versions

- July 2024 [3.x.x](https://github.com/wmde/wikibase-release-pipeline/blob/deploy-3/build/Elasticsearch/README.md)
- July 2024 [2.x.x](https://github.com/wmde/wikibase-release-pipeline/blob/deploy-2/build/Elasticsearch/README.md)
- July 2024 [1.x.x](https://github.com/wmde/wikibase-release-pipeline/blob/deploy-1/build/Elasticsearch/README.md)

## Legacy versions

- 17 April 2024 [7.10.2-wmde.20](https://github.com/wmde/wikibase-release-pipeline/blob/wmde.20/build/Elasticsearch/README.md)
- 17 April 2024 [7.10.2-wmde.19](https://github.com/wmde/wikibase-release-pipeline/blob/wmde.19/build/Elasticsearch/README.md)
- 29 April 2024 [7.10.2-wmde.18](https://github.com/wmde/wikibase-release-pipeline/blob/wmde.18/build/Elasticsearch/README.md)
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
58 changes: 58 additions & 0 deletions build/quickstatements/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
ARG COMPOSER_IMAGE_URL
ARG PHP_IMAGE_URL

# ###########################################################################
# hadolint ignore=DL3006
FROM ${COMPOSER_IMAGE_URL} as composer
ARG QUICKSTATEMENTS_COMMIT
ARG MAGNUSTOOLS_COMMIT

RUN \
git clone https://github.com/magnusmanske/quickstatements /tmp/quickstatements && \
git -C /tmp/quickstatements checkout ${QUICKSTATEMENTS_COMMIT} && \
git -C /tmp/quickstatements submodule update --init --recursive && \
\
git clone https://bitbucket.org/magnusmanske/magnustools.git /tmp/magnustools && \
git -C /tmp/magnustools checkout ${MAGNUSTOOLS_COMMIT}

WORKDIR /tmp/quickstatements
RUN composer install --no-dev

# ###########################################################################
# hadolint ignore=DL3006
FROM ${PHP_IMAGE_URL}
LABEL org.opencontainers.image.source="https://github.com/wmde/wikibase-release-pipeline"

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends gettext-base jq libicu-dev && \
rm -rf /var/lib/apt/lists/* && \
\
docker-php-ext-configure intl && \
docker-php-ext-install intl

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
COPY php.ini /templates/php.ini

ENV APACHE_DOCUMENT_ROOT /var/www/html/quickstatements/public_html
RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf && \
sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

ENV SITENAME=wikibase \
LANGUAGE_CODE=en \
PHP_TIMEZONE=UTC \
WB_ITEM_NAMESPACE=120 \
WB_PROPERTY_NAMESPACE=122 \
WB_ITEM_PREFIX="Item:" \
WB_PROPERTY_PREFIX="Property:"

RUN install -d -owww-data /var/log/quickstatements

ENTRYPOINT ["/bin/bash"]
CMD ["/entrypoint.sh"]
Loading

0 comments on commit e64b389

Please sign in to comment.