Page MenuHomePhabricator

apt-staging: add headers to prevent CDN caching
Closed, ResolvedPublic

Description

The HTTP server at https://apt-staging.wikimedia.org/ is fronted by our CDN cache, and that can serve stale content. We should change the Nginx settings in apt-staging2001 to add some HTTP headers that set a maximum cache time.

For example, I added a new package to apt-staging following this wiki page. The package was visible at https://apt-staging.wikimedia.org/wikimedia-staging/pool/main/w/wikireplicas-utils/, but other files like https://apt-staging.wikimedia.org/wikimedia-staging/dists/bookworm-wikimedia/main/binary-amd64/Packages.gz and https://apt-staging.wikimedia.org/wikimedia-staging/dists/bookworm-wikimedia/InRelease were showing a cached old version, not including the new package.

As a consequence, running reprepro checkupdate in apt1002 could not find and import the new package.

Workaround: purging the cache following this guide fixes the issue but must be done for each affected URL.

Details

Event Timeline

Change #1180234 had a related patch set uploaded (by Dzahn; author: Dzahn):

[operations/puppet@production] cache::text: set apt-staging to NOT cache

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

@Dzahn fine with me, but if there's an easy way to keep e.g. a 5-minute cache it could be nice to have. I'll let @Joe have the final word.

@Dzahn fine with me, but if there's an easy way to keep e.g. a 5-minute cache it could be nice to have. I'll let @Joe have the final word.

You can add headers on the applayer to have them served by the CDN and set a preferred caching time (let us know if you need help with that). @Dzahn's patch also works if you want to skip the CDN layer but still get the benefits of it, so that's another way. It depends on what you want and what is acceptable for apt-staging so let's work from there.

@Dzahn fine with me, but if there's an easy way to keep e.g. a 5-minute cache it could be nice to have. I'll let @Joe have the final word.

You can add headers on the applayer to have them served by the CDN and set a preferred caching time (let us know if you need help with that). @Dzahn's patch also works if you want to skip the CDN layer but still get the benefits of it, so that's another way. It depends on what you want and what is acceptable for apt-staging so let's work from there.

Given that apt-staging sees hardly any traffic (by design) from my PoV simply configuring it to "pass" seems best to me.

Change #1180234 merged by Dzahn:

[operations/puppet@production] cache::text: set apt-staging to NOT cache

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

Deployed! And we spot checked it on cp1011. It isn't caching anymore now.

fnegri assigned this task to Dzahn.

Nice, thank you! I will optimistically mark as Resolved.