Closed cloudwindy closed 1 year ago
Caddyfile:
http_cache {
cache_type file
path /data/cache
match_path /
match_header Content-Type image/vnd.microsoft.icon text/js text/css image/gif image/jpeg image/png
}
Dockerfile:
FROM caddy:builder AS builder
RUN xcaddy build \
--with github.com/kirsch33/realip \
--with github.com/sillygod/cdp-cache
FROM caddy:latest
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
The problem was that I was building from the latest version of caddy.
Let's keep this open as this won't work with v2.5.1.
Let's keep this open as this won't work with v2.5.1.
Thanks for noting this package is not compatible with the caddy v2.5.1.
However, keeping updated with the latest version of caddy is not in high priority! It may be upgraded someday.
I hit the same issue. Is it realty that much work to update? From a usage point of view it's the difference between being able to just download a caddy binary with the cdp-cache module vs. having to set-up a whole compilation environment...
I made so many failed attempts to compile it. I am not a go developer. Kind of delayed my caching by 9 months Did not have much traffic, so was not a hot issue.
With Bastille containers, I got it compiling really quickly. Created a container, installed some tools, and then downloaded the go executable. It was so easy. When I got it wrong, I just deleted the container and repeated. I could not do that with my regular development environment.
In fact I would be happy to publish my Bastille container, if anyone is interested.
There is a larger problem at work here. You will see that the cache-handler software is under the auspices of /caddy-server. It supports distributed caches.
The cdp-cache is kind of abandoned. Lives on a less famous location. Not updated since April 8th. Requires an old version of Go and an old version of caddy.
Even though it is much simpler, and the docs are much much better.
My take away is that open source goes where the money is. Large companies that need distributed caches. Which is different from the needs of small companies, that just run on a single server.
I see the same issue everywhere. The needs of big and small companies are different. Here is my article about the difference between Docker and bsd. "Docker is for big companies, Bastille BSD is for small companies and developers. "
Just as a heads-up, building caddy is not that easy... To install xcaddy I had to use:
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
And I built caddy:
xcaddy build v2.4.1 --with github.com/sillygod/cdp-cache
But just running the executable to get help:
/h/s/caddy> ./caddy
panic: qtls.CertificateRequestInfo doesn't match
goroutine 1 [running]:
github.com/marten-seemann/qtls-go1-16.init.0()
github.com/marten-seemann/qtls-go1-16@v0.1.3/unsafe.go:17 +0x198
From https://github.com/caddyserver/caddy/issues/4118 I gather I have to use an older version of Go, perhaps...
Yes, you have to use go 1.17 I had huge problems with the builds. Mostly because I am not a go developer. And I did not want to cause trouble in my development environment.
I submitted a read me pull request, and offered to make more edits, but have not heard back about the existing changes I made, so not much point investing a lot more effort into it.
Hopefully eventually they will respond to it.
For now, I managed to build this extension with Go v1.17 (MacOS).
xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache
cdp-cache is upgraded (#67 ) so close this issue