sillygod / cdp-cache

a caddy 2 proxy cache plugin
MIT License
119 stars 17 forks source link

Configuring Problems #54

Closed PythonLinks closed 1 year ago

PythonLinks commented 2 years ago

I like this version, because it looks so much simpler than https://github.com/caddyserver/cache-handler

I built it with: xcaddy build v2.5.2 --with github.com/sillygod/cdp-cache

I can run my web site with it. GreenMaps.US

But I cannot configure caching. I get the following error message.

reload: sending configuration to instance: caddy responded with error: HTTP 400: {"error":"loading config: loading new config: loading http app module: provision http: server srv0: setting up route handlers: route 2: loading handler modules: position 0: loading module 'subroute': provision http.handlers.subroute: setting up subroutes: route 10: loading handler modules: position 0: loading module 'http_cache': unknown module: http.handlers.http_cache"}

Any suggestions?

PythonLinks commented 2 years ago

Even your example configuration file does not work. ( I did remove the second server)

`{ order http_cache before reverse_proxy }

:9991 { reverse_proxy { to localhost:9995 }

http_cache {
cache_type file
path /tmp/cache
match_path /
match_header Content-Type image/jpg image/png "text/plain; charset=utf-\

8" } } `

Here is the error message. reload: sending configuration to instance: caddy responded with error: HTTP 400: {"error": "loading config: loading new config: loading http app module: provision http: server srv0: setting up route handlers: route 0: loading handler modules: position 0: loading module 'http_cache': unknown module: http.handlers.http_cache"}

I think that this caching software has a simpler model than cache-handler, but thinks do not look promising. So sad.

sillygod commented 2 years ago

@PythonLinks hi, can you try to build this module with lower version of caddy ?

xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache

Maybe there are some backward incompatible changes from version 2.4.6 to 2.5.x

PythonLinks commented 2 years ago

Sounds Promising. I really do not want to be using NGINX. Sadly it did not work. "quic-go doesn't build on Go 1.18 yet." (untyped string constant) as int value in variable declaration" FreeBSD 13.0-RELEASE-p5 go version go1.18.5 freebsd/amd64

What is quic-go? "QUIC: A UDP-Based Multiplexed and Secure Transport" https://github.com/lucas-clemente/quic-go "We currently support Go 1.18.x and Go 1.19.x." Make up your minds! Do I need an different version of go, or do I need to pin a version of quic-go? Maybe I should be posting on the quic-go repository. Does xcaddy support pinning versions of libraries?

Here is a longer part of the error message. the full traceback is below.

` 2022/09/04 05:36:42 [INFO] exec (timeout=0s): /usr/local/bin/go build -o /usr/local/etc/caddy/cdp-caddy/caddy -ldflags -w -s -trimpath

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 go build github.com/yuin/goldmark/util: /usr/local/go118/pkg/tool/freebsd_amd64/compile: signal: killed 2022/09/04 05:40:24 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-09-04-0536.3095401287 2022/09/04 05:40:24 [FATAL] exit status 2

`


## Full Traceback. ` xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache 2022/09/04 05:36:14 [INFO] Temporary folder: /tmp/buildenv_2022-09-04-0536.3095401287 2022/09/04 05:36:14 [INFO] Writing main module: /tmp/buildenv_2022-09-04-0536.3095401287/main.go package main import ( caddycmd "github.com/caddyserver/caddy/v2/cmd" // plug in Caddy modules here _ "github.com/caddyserver/caddy/v2/modules/standard" _ "github.com/sillygod/cdp-cache" ) func main() { caddycmd.Main() } 2022/09/04 05:36:14 [INFO] Initializing Go module 2022/09/04 05:36:14 [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/09/04 05:36:14 [INFO] Pinning versions 2022/09/04 05:36:14 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.4.6 go: added github.com/beorn7/perks v1.0.1 go: added github.com/caddyserver/caddy/v2 v2.4.6 go: added github.com/caddyserver/certmagic v0.15.2 go: added github.com/cespare/xxhash/v2 v2.1.1 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.9 go: added github.com/libdns/libdns v0.2.1 go: added github.com/matttproud/golang_protobuf_extensions v1.0.1 go: added github.com/mholt/acmez v1.0.1 go: added github.com/miekg/dns v1.1.43 go: added github.com/prometheus/client_golang v1.11.0 go: added github.com/prometheus/client_model v0.2.0 go: added github.com/prometheus/common v0.26.0 go: added github.com/prometheus/procfs v0.6.0 go: added go.uber.org/atomic v1.7.0 go: added go.uber.org/multierr v1.6.0 go: added go.uber.org/zap v1.19.0 go: added golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 go: added golang.org/x/net v0.0.0-20210913180222-943fd674d43e go: added golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 go: added golang.org/x/term v0.0.0-20210503060354-a79de5458b56 go: added golang.org/x/text v0.3.7 go: added google.golang.org/protobuf v1.27.1 2022/09/04 05:36:26 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v github.com/sillygod/cdp-cache github.com/caddyserver/caddy/v2@v2.4.6 go: downloading github.com/fsnotify/fsnotify v1.4.9 go: upgraded github.com/hashicorp/consul/api v1.3.0 => v1.8.1 go: upgraded github.com/hashicorp/go-hclog v0.9.2 => v0.12.0 go: upgraded github.com/hashicorp/go-rootcerts v1.0.0 => v1.0.2 go: upgraded github.com/hashicorp/serf v0.8.2 => v0.9.5 go: added github.com/mailgun/groupcache/v2 v2.2.1 go: added github.com/pquerna/cachecontrol v0.1.0 go: added github.com/segmentio/fasthash v1.0.3 go: added github.com/sillygod/cdp-cache v0.4.6 2022/09/04 05:36:36 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v 2022/09/04 05:36:39 [INFO] Build environment ready 2022/09/04 05:36:39 [INFO] Building Caddy 2022/09/04 05:36:39 [INFO] exec (timeout=0s): /usr/local/bin/go mod tidy go: downloading go.uber.org/goleak v1.1.10 go: downloading golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 go: downloading github.com/cenkalti/backoff/v4 v4.1.0 go: downloading github.com/hashicorp/go-multierror v1.1.0 go: downloading github.com/hashicorp/go-sockaddr v1.0.0 2022/09/04 05:36:42 [INFO] exec (timeout=0s): /usr/local/bin/go build -o /usr/local/etc/caddy/cdp-caddy/caddy -ldflags -w -s -trimpath # 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 go build github.com/yuin/goldmark/util: /usr/local/go118/pkg/tool/freebsd_amd64/compile: signal: killed 2022/09/04 05:40:24 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-09-04-0536.3095401287 2022/09/04 05:40:24 [FATAL] exit status 2 `
sillygod commented 2 years ago

@PythonLinks , I thought you need to downgrade your golang's version to go1.17.x. I don't think xcaddy can change the version of caddy's dependencies when installing with xcaddy.

PythonLinks commented 2 years ago

So I took a look at the cdp-cache README file. It recommends version 2.4.1 xcaddy build v2.4.1 --with github.com/sillygod/cdp-cache I tried that, then ./caddy to see if it works. Here is the error message.

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

Sigh. Next let me try running multiple versions of go. First attempt failed. I have a conference this week, so it may take me a while to figure it out.

sillygod commented 2 years ago

So I took a look at the cdp-cache README file. It recommends version 2.4.1 xcaddy build v2.4.1 --with github.com/sillygod/cdp-cache I tried that, then ./caddy to see if it works. Here is the error message.

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

Sigh. Next let me try running multiple versions of go. First attempt failed. I have a conference this week, so it may take me a while to figure it out.

Oops, I forgot to revise the readme file and according to the go.mod, run the command below under golang 1.17.x (lower than go 1.18)

xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache

it will works

PythonLinks commented 2 years ago

Okay I installed go 1.17 on FreeBsd.

go version go version go1.17.13 freebsd/amd64

Then I tried

xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache

but sadly it crashed.

go: downloading github.com/klauspost/cpuid v1.2.0 2022/09/04 16:06:16 [INFO] exec (timeout=0s): /usr/local/go117/bin/go build -o /usr/local/etc/caddy/cdp-caddy/caddy -ldflags -w -s -trimpath go build github.com/yuin/goldmark/util: /usr/local/go117/pkg/tool/freebsd_amd64/compile: signal: killed 2022/09/04 16:12:02 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-09-04-1604.2103078159 2022/09/04 16:12:02 [FATAL] exit status 1

So sad.
The full traceback is below.

FYI, I now have NGINX runnign happily on Linux, the certbot also has problems on FreeBSD.


xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache 2022/09/04 16:04:09 [INFO] Temporary folder: /tmp/buildenv_2022-09-04-1604.2103078159 2022/09/04 16:04:09 [INFO] Writing main module: /tmp/buildenv_2022-09-04-1604.2103078159/main.go package main

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

// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/sillygod/cdp-cache"

)

func main() { caddycmd.Main() } 2022/09/04 16:04:09 [INFO] Initializing Go module 2022/09/04 16:04:09 [INFO] exec (timeout=10s): /usr/local/go117/bin/go mod init caddy go: creating new go.mod: module caddy go: to add module requirements and sums: go mod tidy 2022/09/04 16:04:09 [INFO] Pinning versions 2022/09/04 16:04:09 [INFO] exec (timeout=0s): /usr/local/go117/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.4.6 go: downloading github.com/caddyserver/caddy/v2 v2.4.6 go: downloading github.com/caddyserver/certmagic v0.15.2 go: downloading github.com/google/uuid v1.3.0 go: downloading github.com/prometheus/client_golang v1.11.0 go: downloading go.uber.org/zap v1.19.0 go: downloading golang.org/x/term v0.0.0-20210503060354-a79de5458b56 go: downloading github.com/klauspost/cpuid/v2 v2.0.9 go: downloading github.com/libdns/libdns v0.2.1 go: downloading github.com/mholt/acmez v1.0.1 go: downloading github.com/miekg/dns v1.1.43 go: downloading golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 go: downloading golang.org/x/net v0.0.0-20210913180222-943fd674d43e go: downloading github.com/beorn7/perks v1.0.1 go: downloading github.com/cespare/xxhash/v2 v2.1.1 go: downloading github.com/cespare/xxhash v1.1.0 go: downloading github.com/golang/protobuf v1.5.2 go: downloading github.com/prometheus/client_model v0.2.0 go: downloading github.com/prometheus/common v0.26.0 go: downloading github.com/prometheus/procfs v0.6.0 go: downloading golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 go: downloading go.uber.org/atomic v1.7.0 go: downloading go.uber.org/multierr v1.6.0 go: downloading golang.org/x/text v0.3.7 go: downloading google.golang.org/protobuf v1.27.1 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1 go get: added github.com/beorn7/perks v1.0.1 go get: added github.com/caddyserver/caddy/v2 v2.4.6 go get: added github.com/caddyserver/certmagic v0.15.2 go get: added github.com/cespare/xxhash/v2 v2.1.1 go get: added github.com/golang/protobuf v1.5.2 go get: added github.com/google/uuid v1.3.0 go get: added github.com/klauspost/cpuid/v2 v2.0.9 go get: added github.com/libdns/libdns v0.2.1 go get: added github.com/matttproud/golang_protobuf_extensions v1.0.1 go get: added github.com/mholt/acmez v1.0.1 go get: added github.com/miekg/dns v1.1.43 go get: added github.com/prometheus/client_golang v1.11.0 go get: added github.com/prometheus/client_model v0.2.0 go get: added github.com/prometheus/common v0.26.0 go get: added github.com/prometheus/procfs v0.6.0 go get: added go.uber.org/atomic v1.7.0 go get: added go.uber.org/multierr v1.6.0 go get: added go.uber.org/zap v1.19.0 go get: added golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 go get: added golang.org/x/net v0.0.0-20210913180222-943fd674d43e go get: added golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 go get: added golang.org/x/term v0.0.0-20210503060354-a79de5458b56 go get: added golang.org/x/text v0.3.7 go get: added google.golang.org/protobuf v1.27.1 2022/09/04 16:05:03 [INFO] exec (timeout=0s): /usr/local/go117/bin/go get -d -v github.com/sillygod/cdp-cache github.com/caddyserver/caddy/v2@v2.4.6 go: downloading github.com/sillygod/cdp-cache v0.4.6 go: downloading github.com/hashicorp/consul/api v1.8.1 go: downloading github.com/pquerna/cachecontrol v0.1.0 go: downloading github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac go: downloading github.com/google/cel-go v0.7.3 go: downloading github.com/lucas-clemente/quic-go v0.23.0 go: downloading google.golang.org/genproto v0.0.0-20210719143636-1d5a45f8e492 go: downloading github.com/hashicorp/go-cleanhttp v0.5.1 go: downloading github.com/hashicorp/go-hclog v0.12.0 go: downloading github.com/hashicorp/go-rootcerts v1.0.2 go: downloading github.com/hashicorp/serf v0.9.5 go: downloading github.com/mitchellh/mapstructure v1.1.2 go: downloading github.com/go-redis/redis v6.15.9+incompatible go: downloading github.com/mailgun/groupcache/v2 v2.2.1 go: downloading github.com/smallstep/certificates v0.17.5-0.20211008195551-04fe3126bebf go: downloading github.com/smallstep/cli v0.17.6 go: downloading github.com/smallstep/truststore v0.9.6 go: downloading github.com/stoewer/go-strcase v1.2.0 go: downloading github.com/marten-seemann/qpack v0.2.1 go: downloading github.com/fatih/color v1.9.0 go: downloading github.com/mattn/go-colorable v0.1.8 go: downloading github.com/mattn/go-isatty v0.0.13 go: downloading github.com/mitchellh/go-homedir v1.1.0 go: downloading github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da go: downloading github.com/sirupsen/logrus v1.7.0 go: downloading github.com/pkg/errors v0.9.1 go: downloading github.com/smallstep/nosql v0.3.8 go: downloading go.step.sm/cli-utils v0.6.0 go: downloading go.step.sm/crypto v0.11.0 go: downloading go.step.sm/linkedca v0.5.0 go: downloading google.golang.org/grpc v1.39.0 go: downloading gopkg.in/square/go-jose.v2 v2.6.0 go: downloading howett.net/plist v0.0.0-20181124034731-591f970eefbb go: downloading github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f go: downloading github.com/cheekybits/genny v1.0.0 go: downloading github.com/onsi/ginkgo v1.16.4 go: downloading github.com/marten-seemann/qtls-go1-16 v0.1.4 go: downloading github.com/marten-seemann/qtls-go1-17 v0.1.0 go: downloading github.com/hashicorp/go-immutable-radix v1.0.0 go: downloading github.com/segmentio/fasthash v1.0.3 go: downloading github.com/micromdm/scep/v2 v2.1.0 go: downloading go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 go: downloading github.com/Masterminds/sprig/v3 v3.2.2 go: downloading github.com/Masterminds/sprig v2.22.0+incompatible go: downloading github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e go: downloading github.com/manifoldco/promptui v0.8.0 go: downloading github.com/urfave/cli v1.22.5 go: downloading github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 go: downloading github.com/hashicorp/golang-lru v0.5.1 go: downloading github.com/rs/xid v1.2.1 go: downloading github.com/go-kit/kit v0.10.0 go: downloading github.com/Masterminds/goutils v1.1.1 go: downloading github.com/Masterminds/semver/v3 v3.1.1 go: downloading github.com/Masterminds/semver v1.5.0 go: downloading github.com/huandu/xstrings v1.3.2 go: downloading github.com/imdario/mergo v0.3.12 go: downloading github.com/mitchellh/copystructure v1.2.0 go: downloading github.com/shopspring/decimal v1.2.0 go: downloading github.com/spf13/cast v1.4.1 go: downloading github.com/dgraph-io/badger v1.6.2 go: downloading github.com/dgraph-io/badger/v2 v2.2007.4 go: downloading go.etcd.io/bbolt v1.3.6 go: downloading github.com/go-sql-driver/mysql v1.6.0 go: downloading github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0 go: downloading github.com/cpuguy83/go-md2man v1.0.10 go: downloading golang.org/x/tools v0.1.5 go: downloading github.com/go-logfmt/logfmt v0.5.0 go: downloading github.com/mitchellh/reflectwalk v1.0.2 go: downloading github.com/dgraph-io/ristretto v0.0.4-0.20200906165740-41ebdbffecfd go: downloading github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 go: downloading github.com/russross/blackfriday/v2 v2.0.1 go: downloading github.com/russross/blackfriday v1.5.2 go: downloading github.com/samfoo/ansi v0.0.0-20160124022901-b6bd2ded7189 go: downloading github.com/nxadm/tail v1.4.8 go: downloading github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d go: downloading github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 go: downloading github.com/golang/snappy v0.0.3 go: downloading github.com/klauspost/compress v1.13.6 go: downloading github.com/lunixbochs/vtclean v1.0.0 go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0 go: downloading golang.org/x/mod v0.4.2 go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 go: downloading github.com/fsnotify/fsnotify v1.4.9 go get: upgraded github.com/hashicorp/consul/api v1.3.0 => v1.8.1 go get: upgraded github.com/hashicorp/go-hclog v0.9.2 => v0.12.0 go get: upgraded github.com/hashicorp/go-rootcerts v1.0.0 => v1.0.2 go get: upgraded github.com/hashicorp/serf v0.8.2 => v0.9.5 go get: added github.com/mailgun/groupcache/v2 v2.2.1 go get: added github.com/pquerna/cachecontrol v0.1.0 go get: added github.com/segmentio/fasthash v1.0.3 go get: added github.com/sillygod/cdp-cache v0.4.6 2022/09/04 16:05:50 [INFO] exec (timeout=0s): /usr/local/go117/bin/go get -d -v
go: downloading github.com/go-chi/chi v4.1.2+incompatible go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0 go: downloading github.com/alecthomas/chroma v0.9.2 go: downloading github.com/naoina/toml v0.1.1 go: downloading github.com/yuin/goldmark v1.4.1 go: downloading github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01 go: downloading gopkg.in/yaml.v2 v2.4.0 go: downloading github.com/naoina/go-stringutil v0.1.0 go: downloading github.com/dlclark/regexp2 v1.4.0 go: downloading github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 2022/09/04 16:05:56 [INFO] Build environment ready 2022/09/04 16:05:56 [INFO] Building Caddy 2022/09/04 16:05:56 [INFO] exec (timeout=0s): /usr/local/go117/bin/go mod tidy go: downloading github.com/stretchr/testify v1.7.0 go: downloading go.uber.org/goleak v1.1.10 go: downloading github.com/hashicorp/consul/sdk v0.7.0 go: downloading github.com/hashicorp/go-uuid v1.0.1 go: downloading github.com/ory/dockertest/v3 v3.6.5 go: downloading github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b go: downloading github.com/benbjohnson/clock v1.1.0 go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c go: downloading github.com/davecgh/go-spew v1.1.1 go: downloading github.com/pmezard/go-difflib v1.0.0 go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b go: downloading golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 go: downloading github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 go: downloading github.com/BurntSushi/toml v0.3.1 go: downloading github.com/golang/mock v1.6.0 go: downloading github.com/onsi/gomega v1.13.0 go: downloading github.com/google/go-cmp v0.5.6 go: downloading github.com/hashicorp/go-msgpack v0.5.3 go: downloading github.com/hashicorp/memberlist v0.2.2 go: downloading github.com/cenkalti/backoff/v4 v4.1.0 go: downloading github.com/cenkalti/backoff v2.2.1+incompatible go: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 go: downloading github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 go: downloading github.com/kylelemons/godebug v1.1.0 go: downloading github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c go: downloading github.com/mitchellh/go-testing-interface v1.0.0 go: downloading github.com/google/btree v1.0.1 go: downloading github.com/hashicorp/go-multierror v1.1.0 go: downloading github.com/hashicorp/go-sockaddr v1.0.0 go: downloading github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 go: downloading github.com/Microsoft/go-winio v0.4.14 go: downloading github.com/docker/go-units v0.4.0 go: downloading github.com/kr/pretty v0.2.1 go: downloading github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 go: downloading github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 go: downloading github.com/sergi/go-diff v1.2.0 go: downloading github.com/aws/aws-sdk-go v1.37.0 go: downloading cloud.google.com/go v0.83.0 go: downloading github.com/googleapis/gax-go/v2 v2.0.5 go: downloading github.com/googleapis/gax-go v2.0.2+incompatible go: downloading google.golang.org/api v0.48.0 go: downloading github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 go: downloading github.com/hashicorp/errwrap v1.0.0 go: downloading github.com/opencontainers/runc v1.0.0-rc9 go: downloading github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 go: downloading github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 go: downloading github.com/opencontainers/image-spec v1.0.1 go: downloading github.com/docker/go-connections v0.4.0 go: downloading github.com/kr/text v0.2.0 go: downloading golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c go: downloading github.com/go-stack/stack v1.8.0 go: downloading github.com/chzyer/logex v1.1.10 go: downloading github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 go: downloading github.com/opencontainers/go-digest v1.0.0-rc1 go: downloading github.com/jmespath/go-jmespath v0.4.0 go: downloading go.opencensus.io v0.23.0 go: downloading google.golang.org/appengine v1.6.7 go: downloading github.com/OneOfOne/xxhash v1.2.2 go: downloading github.com/spaolacci/murmur3 v1.1.0 go: downloading github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da go: downloading github.com/klauspost/cpuid v1.2.0 2022/09/04 16:06:16 [INFO] exec (timeout=0s): /usr/local/go117/bin/go build -o /usr/local/etc/caddy/cdp-caddy/caddy -ldflags -w -s -trimpath go build github.com/yuin/goldmark/util: /usr/local/go117/pkg/tool/freebsd_amd64/compile: signal: killed 2022/09/04 16:12:02 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-09-04-1604.2103078159 2022/09/04 16:12:02 [FATAL] exit status 1

sillygod commented 2 years ago

Okay I installed go 1.17 on FreeBsd.

go version go version go1.17.13 freebsd/amd64

Then I tried

xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache

but sadly it crashed.

go: downloading github.com/klauspost/cpuid v1.2.0 2022/09/04 16:06:16 [INFO] exec (timeout=0s): /usr/local/go117/bin/go build -o /usr/local/etc/caddy/cdp-caddy/caddy -ldflags -w -s -trimpath go build github.com/yuin/goldmark/util: /usr/local/go117/pkg/tool/freebsd_amd64/compile: signal: killed 2022/09/04 16:12:02 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-09-04-1604.2103078159 2022/09/04 16:12:02 [FATAL] exit status 1

So sad. The full traceback is below.

FYI, I now have NGINX runnign happily on Linux, the certbot also has problems on FreeBSD.

xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache 2022/09/04 16:04:09 [INFO] Temporary folder: /tmp/buildenv_2022-09-04-1604.2103078159 2022/09/04 16:04:09 [INFO] Writing main module: /tmp/buildenv_2022-09-04-1604.2103078159/main.go package main import ( caddycmd "github.com/caddyserver/caddy/v2/cmd"

// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/sillygod/cdp-cache"

)

func main() { caddycmd.Main() } 2022/09/04 16:04:09 [INFO] Initializing Go module 2022/09/04 16:04:09 [INFO] exec (timeout=10s): /usr/local/go117/bin/go mod init caddy go: creating new go.mod: module caddy go: to add module requirements and sums: go mod tidy 2022/09/04 16:04:09 [INFO] Pinning versions 2022/09/04 16:04:09 [INFO] exec (timeout=0s): /usr/local/go117/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.4.6 go: downloading github.com/caddyserver/caddy/v2 v2.4.6 go: downloading github.com/caddyserver/certmagic v0.15.2 go: downloading github.com/google/uuid v1.3.0 go: downloading github.com/prometheus/client_golang v1.11.0 go: downloading go.uber.org/zap v1.19.0 go: downloading golang.org/x/term v0.0.0-20210503060354-a79de5458b56 go: downloading github.com/klauspost/cpuid/v2 v2.0.9 go: downloading github.com/libdns/libdns v0.2.1 go: downloading github.com/mholt/acmez v1.0.1 go: downloading github.com/miekg/dns v1.1.43 go: downloading golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 go: downloading golang.org/x/net v0.0.0-20210913180222-943fd674d43e go: downloading github.com/beorn7/perks v1.0.1 go: downloading github.com/cespare/xxhash/v2 v2.1.1 go: downloading github.com/cespare/xxhash v1.1.0 go: downloading github.com/golang/protobuf v1.5.2 go: downloading github.com/prometheus/client_model v0.2.0 go: downloading github.com/prometheus/common v0.26.0 go: downloading github.com/prometheus/procfs v0.6.0 go: downloading golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 go: downloading go.uber.org/atomic v1.7.0 go: downloading go.uber.org/multierr v1.6.0 go: downloading golang.org/x/text v0.3.7 go: downloading google.golang.org/protobuf v1.27.1 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1 go get: added github.com/beorn7/perks v1.0.1 go get: added github.com/caddyserver/caddy/v2 v2.4.6 go get: added github.com/caddyserver/certmagic v0.15.2 go get: added github.com/cespare/xxhash/v2 v2.1.1 go get: added github.com/golang/protobuf v1.5.2 go get: added github.com/google/uuid v1.3.0 go get: added github.com/klauspost/cpuid/v2 v2.0.9 go get: added github.com/libdns/libdns v0.2.1 go get: added github.com/matttproud/golang_protobuf_extensions v1.0.1 go get: added github.com/mholt/acmez v1.0.1 go get: added github.com/miekg/dns v1.1.43 go get: added github.com/prometheus/client_golang v1.11.0 go get: added github.com/prometheus/client_model v0.2.0 go get: added github.com/prometheus/common v0.26.0 go get: added github.com/prometheus/procfs v0.6.0 go get: added go.uber.org/atomic v1.7.0 go get: added go.uber.org/multierr v1.6.0 go get: added go.uber.org/zap v1.19.0 go get: added golang.org/x/crypto v0.0.0-20210915214749-c084706c2272 go get: added golang.org/x/net v0.0.0-20210913180222-943fd674d43e go get: added golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 go get: added golang.org/x/term v0.0.0-20210503060354-a79de5458b56 go get: added golang.org/x/text v0.3.7 go get: added google.golang.org/protobuf v1.27.1 2022/09/04 16:05:03 [INFO] exec (timeout=0s): /usr/local/go117/bin/go get -d -v github.com/sillygod/cdp-cache github.com/caddyserver/caddy/v2@v2.4.6 go: downloading github.com/sillygod/cdp-cache v0.4.6 go: downloading github.com/hashicorp/consul/api v1.8.1 go: downloading github.com/pquerna/cachecontrol v0.1.0 go: downloading github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac go: downloading github.com/google/cel-go v0.7.3 go: downloading github.com/lucas-clemente/quic-go v0.23.0 go: downloading google.golang.org/genproto v0.0.0-20210719143636-1d5a45f8e492 go: downloading github.com/hashicorp/go-cleanhttp v0.5.1 go: downloading github.com/hashicorp/go-hclog v0.12.0 go: downloading github.com/hashicorp/go-rootcerts v1.0.2 go: downloading github.com/hashicorp/serf v0.9.5 go: downloading github.com/mitchellh/mapstructure v1.1.2 go: downloading github.com/go-redis/redis v6.15.9+incompatible go: downloading github.com/mailgun/groupcache/v2 v2.2.1 go: downloading github.com/smallstep/certificates v0.17.5-0.20211008195551-04fe3126bebf go: downloading github.com/smallstep/cli v0.17.6 go: downloading github.com/smallstep/truststore v0.9.6 go: downloading github.com/stoewer/go-strcase v1.2.0 go: downloading github.com/marten-seemann/qpack v0.2.1 go: downloading github.com/fatih/color v1.9.0 go: downloading github.com/mattn/go-colorable v0.1.8 go: downloading github.com/mattn/go-isatty v0.0.13 go: downloading github.com/mitchellh/go-homedir v1.1.0 go: downloading github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da go: downloading github.com/sirupsen/logrus v1.7.0 go: downloading github.com/pkg/errors v0.9.1 go: downloading github.com/smallstep/nosql v0.3.8 go: downloading go.step.sm/cli-utils v0.6.0 go: downloading go.step.sm/crypto v0.11.0 go: downloading go.step.sm/linkedca v0.5.0 go: downloading google.golang.org/grpc v1.39.0 go: downloading gopkg.in/square/go-jose.v2 v2.6.0 go: downloading howett.net/plist v0.0.0-20181124034731-591f970eefbb go: downloading github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f go: downloading github.com/cheekybits/genny v1.0.0 go: downloading github.com/onsi/ginkgo v1.16.4 go: downloading github.com/marten-seemann/qtls-go1-16 v0.1.4 go: downloading github.com/marten-seemann/qtls-go1-17 v0.1.0 go: downloading github.com/hashicorp/go-immutable-radix v1.0.0 go: downloading github.com/segmentio/fasthash v1.0.3 go: downloading github.com/micromdm/scep/v2 v2.1.0 go: downloading go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 go: downloading github.com/Masterminds/sprig/v3 v3.2.2 go: downloading github.com/Masterminds/sprig v2.22.0+incompatible go: downloading github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e go: downloading github.com/manifoldco/promptui v0.8.0 go: downloading github.com/urfave/cli v1.22.5 go: downloading github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 go: downloading github.com/hashicorp/golang-lru v0.5.1 go: downloading github.com/rs/xid v1.2.1 go: downloading github.com/go-kit/kit v0.10.0 go: downloading github.com/Masterminds/goutils v1.1.1 go: downloading github.com/Masterminds/semver/v3 v3.1.1 go: downloading github.com/Masterminds/semver v1.5.0 go: downloading github.com/huandu/xstrings v1.3.2 go: downloading github.com/imdario/mergo v0.3.12 go: downloading github.com/mitchellh/copystructure v1.2.0 go: downloading github.com/shopspring/decimal v1.2.0 go: downloading github.com/spf13/cast v1.4.1 go: downloading github.com/dgraph-io/badger v1.6.2 go: downloading github.com/dgraph-io/badger/v2 v2.2007.4 go: downloading go.etcd.io/bbolt v1.3.6 go: downloading github.com/go-sql-driver/mysql v1.6.0 go: downloading github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0 go: downloading github.com/cpuguy83/go-md2man v1.0.10 go: downloading golang.org/x/tools v0.1.5 go: downloading github.com/go-logfmt/logfmt v0.5.0 go: downloading github.com/mitchellh/reflectwalk v1.0.2 go: downloading github.com/dgraph-io/ristretto v0.0.4-0.20200906165740-41ebdbffecfd go: downloading github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 go: downloading github.com/russross/blackfriday/v2 v2.0.1 go: downloading github.com/russross/blackfriday v1.5.2 go: downloading github.com/samfoo/ansi v0.0.0-20160124022901-b6bd2ded7189 go: downloading github.com/nxadm/tail v1.4.8 go: downloading github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d go: downloading github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 go: downloading github.com/golang/snappy v0.0.3 go: downloading github.com/klauspost/compress v1.13.6 go: downloading github.com/lunixbochs/vtclean v1.0.0 go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0 go: downloading golang.org/x/mod v0.4.2 go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 go: downloading github.com/fsnotify/fsnotify v1.4.9 go get: upgraded github.com/hashicorp/consul/api v1.3.0 => v1.8.1 go get: upgraded github.com/hashicorp/go-hclog v0.9.2 => v0.12.0 go get: upgraded github.com/hashicorp/go-rootcerts v1.0.0 => v1.0.2 go get: upgraded github.com/hashicorp/serf v0.8.2 => v0.9.5 go get: added github.com/mailgun/groupcache/v2 v2.2.1 go get: added github.com/pquerna/cachecontrol v0.1.0 go get: added github.com/segmentio/fasthash v1.0.3 go get: added github.com/sillygod/cdp-cache v0.4.6 2022/09/04 16:05:50 [INFO] exec (timeout=0s): /usr/local/go117/bin/go get -d -v go: downloading github.com/go-chi/chi v4.1.2+incompatible go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0 go: downloading github.com/alecthomas/chroma v0.9.2 go: downloading github.com/naoina/toml v0.1.1 go: downloading github.com/yuin/goldmark v1.4.1 go: downloading github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01 go: downloading gopkg.in/yaml.v2 v2.4.0 go: downloading github.com/naoina/go-stringutil v0.1.0 go: downloading github.com/dlclark/regexp2 v1.4.0 go: downloading github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 2022/09/04 16:05:56 [INFO] Build environment ready 2022/09/04 16:05:56 [INFO] Building Caddy 2022/09/04 16:05:56 [INFO] exec (timeout=0s): /usr/local/go117/bin/go mod tidy go: downloading github.com/stretchr/testify v1.7.0 go: downloading go.uber.org/goleak v1.1.10 go: downloading github.com/hashicorp/consul/sdk v0.7.0 go: downloading github.com/hashicorp/go-uuid v1.0.1 go: downloading github.com/ory/dockertest/v3 v3.6.5 go: downloading github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b go: downloading github.com/benbjohnson/clock v1.1.0 go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c go: downloading github.com/davecgh/go-spew v1.1.1 go: downloading github.com/pmezard/go-difflib v1.0.0 go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b go: downloading golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 go: downloading github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 go: downloading github.com/BurntSushi/toml v0.3.1 go: downloading github.com/golang/mock v1.6.0 go: downloading github.com/onsi/gomega v1.13.0 go: downloading github.com/google/go-cmp v0.5.6 go: downloading github.com/hashicorp/go-msgpack v0.5.3 go: downloading github.com/hashicorp/memberlist v0.2.2 go: downloading github.com/cenkalti/backoff/v4 v4.1.0 go: downloading github.com/cenkalti/backoff v2.2.1+incompatible go: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 go: downloading github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 go: downloading github.com/kylelemons/godebug v1.1.0 go: downloading github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c go: downloading github.com/mitchellh/go-testing-interface v1.0.0 go: downloading github.com/google/btree v1.0.1 go: downloading github.com/hashicorp/go-multierror v1.1.0 go: downloading github.com/hashicorp/go-sockaddr v1.0.0 go: downloading github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 go: downloading github.com/Microsoft/go-winio v0.4.14 go: downloading github.com/docker/go-units v0.4.0 go: downloading github.com/kr/pretty v0.2.1 go: downloading github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 go: downloading github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 go: downloading github.com/sergi/go-diff v1.2.0 go: downloading github.com/aws/aws-sdk-go v1.37.0 go: downloading cloud.google.com/go v0.83.0 go: downloading github.com/googleapis/gax-go/v2 v2.0.5 go: downloading github.com/googleapis/gax-go v2.0.2+incompatible go: downloading google.golang.org/api v0.48.0 go: downloading github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 go: downloading github.com/hashicorp/errwrap v1.0.0 go: downloading github.com/opencontainers/runc v1.0.0-rc9 go: downloading github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 go: downloading github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 go: downloading github.com/opencontainers/image-spec v1.0.1 go: downloading github.com/docker/go-connections v0.4.0 go: downloading github.com/kr/text v0.2.0 go: downloading golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c go: downloading github.com/go-stack/stack v1.8.0 go: downloading github.com/chzyer/logex v1.1.10 go: downloading github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 go: downloading github.com/opencontainers/go-digest v1.0.0-rc1 go: downloading github.com/jmespath/go-jmespath v0.4.0 go: downloading go.opencensus.io v0.23.0 go: downloading google.golang.org/appengine v1.6.7 go: downloading github.com/OneOfOne/xxhash v1.2.2 go: downloading github.com/spaolacci/murmur3 v1.1.0 go: downloading github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da go: downloading github.com/klauspost/cpuid v1.2.0 2022/09/04 16:06:16 [INFO] exec (timeout=0s): /usr/local/go117/bin/go build -o /usr/local/etc/caddy/cdp-caddy/caddy -ldflags -w -s -trimpath go build github.com/yuin/goldmark/util: /usr/local/go117/pkg/tool/freebsd_amd64/compile: signal: killed 2022/09/04 16:12:02 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-09-04-1604.2103078159 2022/09/04 16:12:02 [FATAL] exit status 1

I am not sure why you got a crash but I saw there is a message -- "compile: signal: killed". I guess the compile process may be killed due to the out of memory.

PythonLinks commented 2 years ago

I am not sure why you got a crash but I saw there is a message -- "compile: signal: killed". I guess the compile process may be killed due to the out of memory.

Thank you. I am about to merge my two freebsd serves, at which point I will have twice as much memory. Hopefully that will be enough. We will get this thing working. The NGINX approach of doing everything repetitively in the configuration files is just nutty.

I am at PyCon Slovakia this weekend, if anyone else here will be there, we can meet.

PythonLinks commented 2 years ago

Okay, so I did a clean install of freebsd. Only used pkg install ... And managed to compile

v2.5.2 could build, could run, but could not cache.

So I tried the command you recommended. xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache

Could not build with go 1.18 Here is the end of the error message.

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 2022/09/16 06:02:29 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-09-16-0559.716943324 2022/09/16 06:02:29 [FATAL] exit status 2

sillygod commented 2 years ago

So I took a look at the cdp-cache README file. It recommends version 2.4.1 xcaddy build v2.4.1 --with github.com/sillygod/cdp-cache I tried that, then ./caddy to see if it works. Here is the error message. 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 Sigh. Next let me try running multiple versions of go. First attempt failed. I have a conference this week, so it may take me a while to figure it out.

Oops, I forgot to revise the readme file and according to the go.mod, run the command below under golang 1.17.x (lower than go 1.18)

xcaddy build v2.4.6 --with github.com/sillygod/cdp-cache

it will works

@PythonLinks hi, as mention previous, it doesn't support go1.18.

PythonLinks commented 2 years ago

Ah yes, but then I have to figure out how to install go 1.17. I made great progress this morning, because I started from scratch and did not mix pkg install with ports.

So I am kind of scared of installing go 1.17.

In any case, NGINX appears to be working. I just have to eliminate jwt cookies from anonymous responses. I may be back.

This is all so painful.