Jump to content

MediaWiki-Docker/Extension/Citoid

From mediawiki.org

This page instructs you to install Extension:Citoid inside MediaWiki-Docker.

Follow the Quickstart instructions at MediaWiki-Docker page. Once MediaWiki is running and available at http://localhost:8080, then continue with instructions on this page.

All commands should be run in the directory where you installed MediaWiki. All mentioned files are also located there.

Clone the extension and configure

[edit]
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/Citoid" extensions/Citoid

If not already there, add this to the end of LocalSettings.php.

wfLoadExtension( 'Citoid' );

If you do not want to hack on the service, only set-up the extension, you can point to extension towards an external deploy of the service by adding the following to the end of LocalSettings.php.

$wgCitoidFullRestbaseURL = 'https://www.mediawiki.org/api/rest_'; # Configured with restbase

This completes your installation. However if you want to hack on the citoid service and require a local installation, skip this instruction and continue below.

Install and configure citoid service

[edit]

Clone the service

mkdir srv
git clone "https://gerrit.wikimedia.org/r/mediawiki/services/citoid" srv/citoid


Make Dockerfile for citoid

[edit]
cd srv/citoid
touch Dockerfile

Paste in the following:

FROM docker-registry.wikimedia.org/nodejs20-slim

WORKDIR /opt/citoid
COPY . ./

RUN npm install

EXPOSE 1970
CMD [ "npm", "start" ]

docker-compose.override.yml

[edit]
services:

  # Note, adding a citoid service requires changes to LocalSettings.php to work.
  citoid:
    build: "./srv/citoid/" 
    ports:
     - "1970:1970"

Configure

[edit]

Configure the extension to work with the cloned service; these directions are installation without restbase or zotero. Installation with zotero and/or restbase requires further installation/configuration.

$wgCitoidServiceUrl	= 'http://localhost:1970/api'; # Configured without restbase

Install and configure zotero and restbase

[edit]

In prod we run zotero behind citoid, and run citoid behind restbase. Here's a sample docker-compose.override.yml file for such an installation. Note installation and dockerfiles for restbase and zotero are also required, but not provided here.

services:

  # Note, adding a citoid service requires changes to LocalSettings.php to work.
  citoid:
    build: "./srv/citoid/"
    ports:
     - "1970:1970"
  zotero:
    image: docker-registry.wikimedia.org/repos/mediawiki/services/zotero:latest
    ports:
     - "1969:1969"
  restbase:
    image: docker-registry.wikimedia.org/dev/restbase:latest
    ports:
      - "7231:7231"

Cassandra

[edit]

Restbase requires the cassandra database:

docker pull docker-registry.wikimedia.org/releng/cassandra311:0.0.1