dub 502 bad gateway

Sebastiaan Koppe mail at skoppe.eu
Tue Nov 19 13:27:31 UTC 2019


After having had another day where my CI can't build because of 
gateway errors, this morning I had enough. (I setup an uptime 
robot so we can see how bad it actually is [1], it checks every 5 
min and I just started it.)

I know, I can setup my CI to cache dub packages. But that is just 
an optimisation.

Things ought to just work.

So this morning I started on a quick fix. I took a look at the 
source and concluded that for dub packages hosted on gitlab and 
github you can simply redirect to gitlab's and github's 
respective archives. That is what the dub registry does anyway.

To that end I setup that logic in a cloudflare worker [2]. So for 
metadata it redirects to the api endpoint on code.dlang.org 
(which is pretty stable), and for to actual packages directly to 
gitlab or github.

Use it like so:

`dub build --registry=https://dub.bytecraft.nl`

Of course, this is a bandaid solution. Probably dub can be made 
to do this as well. And likely should. If it were up to me I 
would go serverless.

[1] https://stats.uptimerobot.com/6mQX4Crw2L
[2] https://github.com/skoppe/dub-registry-mirror


More information about the Digitalmars-d-announce mailing list