Page MenuHomePhabricator

mw-on-k8s apache config missing cache-control for /static/ files
Closed, ResolvedPublic

Description

Following T302465, I updated wikitech docs for MediaWiki in production, and noticed that the /static files such as https://en.wikipedia.org/static/images/project-logos/enwiki.png are lacking the expected cache control when routed via WikimediaDebug/k8s-experimental

For current production app servers, I believe this is currently configured by puppet: mediawiki/apache/expires.conf.

Event Timeline

The mod_expires configuration is the same in puppet and in the mediawiki-httpd docker image, upon which our production images for mediawiki are based.

Sadly though, it looks like I've forgotten to link the conf file in mods-enabled:

kubectl exec -n mwdebug mediawiki-pinkunicorn-8f96659d-rm6sl -c mediawiki-pinkunicorn-httpd -- ls -la /etc/apache2/mods-enabled/ | grep expires
lrwxrwxrwx 1 root root   30 May 22 06:26 expires.load -> ../mods-available/expires.load

At least, this is an easy fix.

Change 800675 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/docker-images/production-images@master] mediawiki-httpd: correctly link expires.conf

https://gerrit.wikimedia.org/r/800675

Change 800675 merged by Giuseppe Lavagetto:

[operations/docker-images/production-images@master] mediawiki-httpd: correctly link expires.conf

https://gerrit.wikimedia.org/r/800675

I uploaded the new version of mediawiki-httpd to the docker registry. @dancy will the next build of the mediawiki webserver image pick that up automatically?

Yes. The next time the webserver image build is triggered, it will pull in
docker-registry.wikimedia.org/mediawiki-httpd:latest.

Re-opening for now. I closed it on the assumption it woud roll out more or less by itself within a few days, but it hasn't (either that, or the change didn't work).

To test, I'm using WikimediaDebug/k8s and with cache disabled comparing response to https://en.wikipedia.org/static/images/project-logos/enwiki.png with that of mwdebug1001, and no cache-control headers yet.

Change 808299 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[mediawiki/tools/release@master] Use docker-registry.wikimedia.org/mediawiki-httpd:0.1.4 for webserver image

https://gerrit.wikimedia.org/r/808299

Change 808299 merged by jenkins-bot:

[mediawiki/tools/release@master] Use docker-registry.wikimedia.org/mediawiki-httpd:0.1.4 for webserver image

https://gerrit.wikimedia.org/r/808299

Change 808302 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[mediawiki/tools/release@master] Use docker-registry.wikimedia.org/mediawiki-httpd:0.1.4 for webserver image (v2)

https://gerrit.wikimedia.org/r/808302

Change 808302 merged by jenkins-bot:

[mediawiki/tools/release@master] Use docker-registry.wikimedia.org/mediawiki-httpd:0.1.4 for webserver image (v2)

https://gerrit.wikimedia.org/r/808302

Re-opening for now. I closed it on the assumption it woud roll out more or less by itself within a few days, but it hasn't (either that, or the change didn't work).

To test, I'm using WikimediaDebug/k8s and with cache disabled comparing response to https://en.wikipedia.org/static/images/project-logos/enwiki.png with that of mwdebug1001, and no cache-control headers yet.

This should be fixed now. The Dockerfiles that reference the docker-registry.wikimedia.org/mediawiki-httpd image did not supply a tag, so they implicitly used latest. The problem is that latest does not point to the same image that the 0.1.4 tag points to. I updated the Dockerfiles to use 0.1.4 and triggered image rebuild and verified with

$ curl -sSf -H 'X-Wikimedia-Debug: k8s-experimental' https://en.wikipedia.org/static/images/project-logos/enwiki.png -D- -o/dev/null | egrep -i 'cache-control|server:'
server: mediawiki-pinkunicorn-67cc4b9b9-ng9tn
cache-control: max-age=31536000