Chart renderer
A stateless microservice that renders charts as SVGs with Apache eCharts, used by mw:Extension:Chart
Production
Deployments
To deploy: Kubernetes/Deployments using the helmfile.d/services/chart-renderer subtree of deployment-charts repo.
- Find the latest (desired) production image of the chart-renderer in the Wikimedia docker registry [1]
- Update the image in the
helmfile.d/services/chart-rendererfile in the deployment-charts [2] and submit patch to gerrit. - When ready to deploy, merge the deployment-charts patch.
- Shell into production deployment server (ssh deployment.eqiad.wmnet) and go to the chart-renderer service directory (cd /srv/deployment-charts/helmfile.d/services/chart-renderer)
- Check that the deployments-chart update is on the server.
git logorgit status - Deploy to staging
helmfile -e staging -i apply --context 5and validate that things look good (see example request below) - Run this to deploy the update to the Texas datacentre (the change is now live for some users):
helmfile -e codfw -i apply --context 5 - Run this to deploy the update to the Virginia datacentre (the change is now live for all users):
helmfile -e eqiad -i apply --context 5 - Monitor the logs [3] and make sure everything looks good.
see also: Wikifunctions/Runbook (most steps are the same except this is chart-renderer and the curl request checks are different). And then check logstash and grafana after each step of deployment and after.
Check staging deploy
curl https: //chart-renderer.k8s-staging.discovery.wmnet:30443/v1/chart/render -X POST --data '{
"definition": {
"license": {
"code": "CC0-1.0",
"text": "Creative Commons Zero",
"url": "https://creativecommons.org/publicdomain/zero/1.0/"
},
"version": 1,
"type": "area",
"idPrefix": "",
"source": "Data:2022 US Energy Consumption.tab"
},
"data": {
"license": {
"code": "CC0-1.0",
"text": "Creative Commons Zero",
"url": "https://creativecommons.org/publicdomain/zero/1.0/"
},
"description": "2022 US Energy Consumption",
"version": 1,
"schema": {
"fields": [
{
"name": "month",
"type": "string",
"title": "Month"
},
{
"name": "residential",
"type": "number",
"title": "Residential"
},
{
"name": "commercial",
"type": "number",
"title": "Commercial"
},
{
"name": "industrial",
"type": "number",
"title": "Industrial"
}
]
},
"data": [
[
"Jan",
140504,
113605,
83982
],
[
"Feb",
125342,
103063,
76893
],
[
"Mar",
111439,
108603,
83679
],
[
"Apr",
97432,
104566,
82422
],
[
"May",
110071,
113007,
86090
],
[
"Jun",
136310,
121567,
88716
],
[
"Jul",
164277,
133952,
90420
],
[
"Aug",
160271,
135676,
93143
],
[
"Sep",
129241,
124195,
86550
],
[
"Oct",
99792,
111851,
85017
],
[
"Nov",
103152,
106858,
81701
],
[
"Dec",
131402,
113929,
81852
]
]
}
}' --header "Content-type: application/json" -w "\n"
Logging
ECS logs emitted to Logstash: https://logstash.wikimedia.org/goto/4f3d66af7f177fc3ed5330a0e4531af5
Metrics
https://grafana.wikimedia.org/d/f10cba3c-086c-49b2-bb04-65d70b39969a/charts-high-level?orgId=1
and
https://grafana.wikimedia.org/d/a8d73414-80d1-4965-9346-170eecaa04d6/chart-renderer-service?orgId=1
Alerting
Defined in the Puppet service catalog, a simple blackbox probe against /_info:
chart-renderer:
description: Stateless microservice that renders charts as SVGs with Apache eCharts, used by https://www.mediawiki.org/wiki/Extension:Chart
encryption: true
ip: *k8s-ingress-wikikube_ips
page: true
probes:
- type: http
path: /_info
timeout: 10s
Beta
Instance details
- Instance * 2 cores, 4 GB ram
- Security group - allow port 6284
The instance has docker installed with role::beta::docker_services
Instance configuration needs to be done in horizon. Changes are recorded (read-only) in the cloud/instance-puppet gerrit repo:
Access
To access the instance
ssh deployment-docker-charts01.deployment-prep.eqiad1.wikimedia.cloud
Service health
To check health of the service:
curl 'http://0.0.0.0:6284/healthz'
From other instances in deployment-prep:
curl 'http://deployment-docker-charts01.deployment-prep.eqiad1.wikimedia.cloud:6284/healthz'
Check if the container is running:
sudo docker ps
Troubleshooting
sudo journalctl --unit=mediawiki-services-chart-renderer | tail -n 1000
sudo docker run -it --entrypoint /bin/bash docker-registry.wikimedia.org/repos/mediawiki/services/chart-renderer:latest