From Wikitech

Citoid is a stateless Node.js service running in Kubernetes. It processes HTTP requests containing a URL, ISBN number or other identifiers/search terms by retrieving citation information from external sources with help from a local nodejs Zotero server. It responds with a JSON structure containing the citation information.


Citoid runs behind service-runner, and should be regularly updated in line with service-template-node

See: mw:Service-template-node/Updating


These are directions for deploying citoid, a nodejs service. More detailed but more general directions for nodejs services are at Migrating_from_scap-helm#Code_deployment/configuration_changes.

Locate build candidate

From gerrit, locate the candidate build. PipelineBot will post a message with the build name, i.e.

Mar 15 9:22 PM

Patch Set 4:

Wikimedia Pipeline
Image Build SUCCESS


 2019-03-15-000-production, 950e3b4468f2f84d3bb23c33ba68d8a26725

'2019-03-15-000-production' is the name of the build.

Add change via gerrit

Pipeline bot

Pipeline bot automatically creates commits to the deployments repo with the subject line "citoid: pipeline bot promote".

  1. Find the commit by going to If there is none labelled "citoid" in the list, then there are no new versions to merge.
  2. +2 the commit to merge it.

Manually (deprecated)

  1. Clone deployment-charts repo.
  2. cd helmfile.d/services/citoid
  3. vi values.yaml
  image: wikimedia/mediawiki-services-citoid
    cpu: 10
    memory: 4Gi
      port: 1970
  port: 1970
    cpu: 200m
    memory: 200Mi
  version: 2019-01-17-114541-candidate-change-me
  1. Make a CR to change the version value in values.yaml and after a successful review, merge it.
  2. After merge, log into a deployment server, there is a cronjob (1 minute) that will update the /srv/deployment-charts directory with the contents from git.

Navigating the server

Ssh into the deploy machine.

 ssh deployment.eqiad.wmnet

citoid runs on two of the available server farms, codfw and eqiad. You can confirm this by doing

Change into the citoid directory.

cd /srv/deployment-charts/helmfile.d/services/citoid

List the files in the directory. This is what you should see.

> ls

helmfile.yaml values-codfw.yaml values-staging.yaml values.yaml



helmfile -e staging -i apply

Apply may take awhile.

>helmfile -e staging status (to check status again)

To confirm the staging cluster works, try a request:

curl -k --header 'Accept: application/json; charset=utf-8' 'https://staging.svc.eqiad.wmnet:4003/api?format=mediawiki&search=979%201029801297'
curl -k --header 'Accept: application/json; charset=utf-8' 'https://staging.svc.eqiad.wmnet:4003/api?format=mediawiki&'

These should successfully retrieve a JSON list of citations.

The following should return an error:

curl -k --header 'Accept: application/json; charset=utf-8' 'https://staging.svc.eqiad.wmnet:4003/api?format=mediawiki&'


codfw cluster:

helmfile -e codfw -i apply
helmfile -e codfw status

Verify citoid is running with a curl request:

curl -k --header 'Accept: application/json; charset=utf-8' 'https://citoid.svc.codfw.wmnet:4003/api?format=mediawiki&search=979%201029801297'
curl -k --header 'Accept: application/json; charset=utf-8' 'https://citoid.svc.codfw.wmnet:4003/api?format=mediawiki&'

Repeat the same process for the eqiad cluster.

helmfile -e eqiad -i apply
helmfile -e eqiad status

Then verify with a curl request:

curl -k --header 'Accept: application/json; charset=utf-8' 'https://citoid.svc.eqiad.wmnet:4003/api?format=mediawiki&search=9791029801297'
curl -k --header 'Accept: application/json; charset=utf-8' 'https://citoid.svc.eqiad.wmnet:4003/api?format=mediawiki&'

curl for all servers:

curl -k --header 'Accept: application/json; charset=utf-8' 'https://citoid.discovery.wmnet:4003/api?format=mediawiki&search=9791029801297'

Testing behind restbase

And finally, you can test the restbase implementation which should give the same results@!/Citation/getCitation

Graphing and Logs

For an overview of how your deploy is doing, you can look at overall stats and logs:



Kibana dashboard:

Use kibana to look at logs. However, if necessary, you can look at the raw logs from the cluster directory,

source .hfenv 
kubectl logs -l app=citoid -c citoid-production


Stats are done currently with both Prometheus and statsd- in progress of converting statsd. Citoid/Prometheus for more.

See also