caddyserver / cache-handler

Distributed HTTP caching module for Caddy
Apache License 2.0
269 stars 22 forks source link

Installation #32

Closed PythonLinks closed 2 years ago

PythonLinks commented 2 years ago

It was not clear to me how to install. I think you used to have instructions for how to compile. Now they disappeared. It would be nice if in the readme, you linked to the compilation instructions over on the main caddy documentation page. https://caddyserver.com/docs/build#xcaddy

I am so glad to see that this package now looks like it is main stream supported.

HURRAH.

PythonLinks commented 2 years ago

Still not able to install.

there are several caddy 2 caching solutions. This one is under https://github.com/caddyserver so it must be the right one to use. Quite confusing. I ended up trying all 3 solutions. But I could not get this one to compile.

Running on Freebsd., First I tried. xcaddy build v2.5.2 --with https://github.com/caddyserver/cache-handler

go: malformed module path "https:/github.com/caddyserver/cache-handler": invalid char ':'

The full transcript is appended.

Then I tried git clone https://github.com/caddyserver/cache-handler cd cache-handler go build go: downloading github.com/darkweak/souin v1.6.6

github.com/lucas-clemente/quic-go/internal/qtls

/root/go/pkg/mod/github.com/lucas-clemente/quic-go@v0.23.0/internal/qtls/go118.go:5:13: cannot use "quic-go doesn't build on Go 1.18 yet." (untyped string constant) as int value in variable declaration

Maybe I should be using an older? newer? version of Go?

No luck. Oh well, I think I will stick with caddy 1 for a while longer.

Here is the full transcript of the first xcaddy attempt.


s/home/lozinski/caddy-install# xcaddy build v2.5.2 --with https://github.com/caddyserver/cache-handler 2022/08/31 16:53:22 [INFO] Temporary folder: /tmp/buildenv_2022-08-31-1653.2332804898 2022/08/31 16:53:22 [INFO] Writing main module: /tmp/buildenv_2022-08-31-1653.2332804898/main.go package main

import ( caddycmd "github.com/caddyserver/caddy/v2/cmd"

// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "https://github.com/caddyserver/cache-handler"

)

func main() { caddycmd.Main() } 2022/08/31 16:53:22 [INFO] Initializing Go module 2022/08/31 16:53:22 [INFO] exec (timeout=10s): /usr/local/bin/go mod init caddy go: creating new go.mod: module caddy go: to add module requirements and sums: go mod tidy 2022/08/31 16:53:22 [INFO] Pinning versions 2022/08/31 16:53:22 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.5.2 go: added github.com/beorn7/perks v1.0.1 go: added github.com/caddyserver/caddy/v2 v2.5.2 go: added github.com/caddyserver/certmagic v0.16.1 go: added github.com/cespare/xxhash/v2 v2.1.2 go: added github.com/cheekybits/genny v1.0.0 go: added github.com/fsnotify/fsnotify v1.5.1 go: added github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 go: added github.com/golang/protobuf v1.5.2 go: added github.com/google/uuid v1.3.0 go: added github.com/klauspost/cpuid/v2 v2.0.13 go: added github.com/libdns/libdns v0.2.1 go: added github.com/lucas-clemente/quic-go v0.28.0 go: added github.com/marten-seemann/qpack v0.2.1 go: added github.com/marten-seemann/qtls-go1-16 v0.1.5 go: added github.com/marten-seemann/qtls-go1-17 v0.1.2 go: added github.com/marten-seemann/qtls-go1-18 v0.1.2 go: added github.com/marten-seemann/qtls-go1-19 v0.1.0-beta.1 go: added github.com/matttproud/golang_protobuf_extensions v1.0.1 go: added github.com/mholt/acmez v1.0.2 go: added github.com/miekg/dns v1.1.46 go: added github.com/nxadm/tail v1.4.8 go: added github.com/onsi/ginkgo v1.16.4 go: added github.com/prometheus/client_golang v1.12.1 go: added github.com/prometheus/client_model v0.2.0 go: added github.com/prometheus/common v0.32.1 go: added github.com/prometheus/procfs v0.7.3 go: added go.uber.org/atomic v1.9.0 go: added go.uber.org/multierr v1.6.0 go: added go.uber.org/zap v1.21.0 go: added golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 go: added golang.org/x/mod v0.4.2 go: added golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e go: added golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a go: added golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 go: added golang.org/x/text v0.3.8-0.20211004125949-5bd84dd9b33b go: added golang.org/x/tools v0.1.7 go: added golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 go: added google.golang.org/protobuf v1.28.0 go: added gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 2022/08/31 16:53:25 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v https://github.com/caddyserver/cache-handler github.com/caddyserver/caddy/v2@v2.5.2 go: malformed module path "https:/github.com/caddyserver/cache-handler": invalid char ':' 2022/08/31 16:53:26 [FATAL] exit status 1

francislavoie commented 2 years ago

I think you got the plugin's module path wrong. Try this:

$ xcaddy build v2.5.2 --with github.com/caddyserver/cache-handler

In particular, a Go module path is not an HTTP URL, you can't have a scheme in there.