1. The problem I’m having:
I need to add Let’s Encrypt as fallback for some errors on ZeroSSL.
I’m having issues compiling caddy-storage-redis
with 2.7.6
(please find below the Dockerfile
) .
This configuration previously worked.
I tried to bump to 2.8.4
, it compiles, but it doesn’t find any certificates in redis, triggering all sorts of rate limits on ZeroSSL and Let’s Encrypt.
All other infrastructure configs are the same, including credentials.
2. Error messages and/or full log output:
2024/09/02 14:38:18 [INFO] absolute output file path: /usr/bin/caddy
2024/09/02 14:38:18 [INFO] Temporary folder: /tmp/buildenv_2024-09-02-1438.2771258597
2024/09/02 14:38:18 [INFO] Writing main module: /tmp/buildenv_2024-09-02-1438.2771258597/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/pberkel/caddy-storage-redis"
_ "github.com/caddyserver/transform-encoder"
)
func main() {
caddycmd.Main()
}
2024/09/02 14:38:18 [INFO] Initializing Go module
2024/09/02 14:38:18 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
go mod tidy
2024/09/02 14:38:18 [INFO] Pinning versions
2024/09/02 14:38:18 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.7.6
go: downloading github.com/caddyserver/caddy/v2 v2.7.6
go: downloading github.com/caddyserver/certmagic v0.20.0
go: downloading github.com/google/uuid v1.3.1
go: downloading github.com/prometheus/client_golang v1.15.1
go: downloading github.com/quic-go/quic-go v0.40.0
go: downloading go.uber.org/zap v1.25.0
go: downloading golang.org/x/sys v0.14.0
go: downloading golang.org/x/term v0.13.0
go: downloading github.com/klauspost/cpuid/v2 v2.2.5
go: downloading github.com/libdns/libdns v0.2.1
go: downloading github.com/mholt/acmez v1.2.0
go: downloading github.com/miekg/dns v1.1.55
go: downloading github.com/zeebo/blake3 v0.2.3
go: downloading golang.org/x/crypto v0.14.0
go: downloading golang.org/x/net v0.17.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.2.0
go: downloading github.com/prometheus/client_model v0.4.0
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/prometheus/common v0.42.0
go: downloading github.com/prometheus/procfs v0.9.0
go: downloading google.golang.org/protobuf v1.31.0
go: downloading github.com/onsi/ginkgo/v2 v2.9.5
go: downloading go.uber.org/mock v0.3.0
go: downloading golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0
go: downloading github.com/quic-go/qpack v0.4.0
go: downloading go.uber.org/multierr v1.11.0
go: downloading golang.org/x/tools v0.10.0
go: downloading golang.org/x/text v0.13.0
go: downloading github.com/golang/protobuf v1.5.3
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.4
go: downloading golang.org/x/mod v0.11.0
go: downloading github.com/quic-go/qtls-go1-20 v0.4.1
go: downloading github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
go: downloading github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.7.6
go: added github.com/caddyserver/certmagic v0.20.0
go: added github.com/cespare/xxhash/v2 v2.2.0
go: added github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
go: added github.com/golang/protobuf v1.5.3
go: added github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1
go: added github.com/google/uuid v1.3.1
go: added github.com/klauspost/cpuid/v2 v2.2.5
go: added github.com/libdns/libdns v0.2.1
go: added github.com/matttproud/golang_protobuf_extensions v1.0.4
go: added github.com/mholt/acmez v1.2.0
go: added github.com/miekg/dns v1.1.55
go: added github.com/onsi/ginkgo/v2 v2.9.5
go: added github.com/prometheus/client_golang v1.15.1
go: added github.com/prometheus/client_model v0.4.0
go: added github.com/prometheus/common v0.42.0
go: added github.com/prometheus/procfs v0.9.0
go: added github.com/quic-go/qpack v0.4.0
go: added github.com/quic-go/qtls-go1-20 v0.4.1
go: added github.com/quic-go/quic-go v0.40.0
go: added github.com/zeebo/blake3 v0.2.3
go: added go.uber.org/mock v0.3.0
go: added go.uber.org/multierr v1.11.0
go: added go.uber.org/zap v1.25.0
go: added golang.org/x/crypto v0.14.0
go: added golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0
go: added golang.org/x/mod v0.11.0
go: added golang.org/x/net v0.17.0
go: added golang.org/x/sys v0.14.0
go: added golang.org/x/term v0.13.0
go: added golang.org/x/text v0.13.0
go: added golang.org/x/tools v0.10.0
go: added google.golang.org/protobuf v1.31.0
2024/09/02 14:38:26 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/pberkel/caddy-storage-redis github.com/caddyserver/caddy/v2@v2.7.6
go: downloading github.com/pberkel/caddy-storage-redis v1.3.0
go: accepting indirect upgrade from github.com/quic-go/quic-go@v0.40.0 to v0.42.0
go: accepting indirect upgrade from go.uber.org/mock@v0.3.0 to v0.4.0
go: accepting indirect upgrade from golang.org/x/crypto@v0.14.0 to v0.21.0
go: accepting indirect upgrade from golang.org/x/net@v0.17.0 to v0.23.0
go: accepting indirect upgrade from golang.org/x/sys@v0.14.0 to v0.18.0
go: accepting indirect upgrade from golang.org/x/term@v0.13.0 to v0.18.0
go: accepting indirect upgrade from golang.org/x/text@v0.13.0 to v0.14.0
go: accepting indirect upgrade from google.golang.org/protobuf@v1.31.0 to v1.33.0
go: downloading github.com/quic-go/quic-go v0.42.0
go: downloading golang.org/x/sys v0.18.0
go: downloading golang.org/x/term v0.18.0
go: downloading github.com/bsm/redislock v0.9.4
go: downloading github.com/redis/go-redis/v9 v9.3.0
go: downloading github.com/spf13/cobra v1.7.0
go: downloading golang.org/x/crypto v0.21.0
go: downloading golang.org/x/net v0.23.0
go: downloading google.golang.org/protobuf v1.33.0
go: downloading go.uber.org/mock v0.4.0
go: downloading github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/inconshreveable/mousetrap v1.1.0
go: downloading github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
go: downloading golang.org/x/text v0.14.0
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.2
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: added github.com/bsm/redislock v0.9.4
go: added github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
go: added github.com/pberkel/caddy-storage-redis v1.3.0
go: upgraded github.com/quic-go/quic-go v0.40.0 => v0.42.0
go: added github.com/redis/go-redis/v9 v9.3.0
go: upgraded go.uber.org/mock v0.3.0 => v0.4.0
go: upgraded golang.org/x/crypto v0.14.0 => v0.21.0
go: upgraded golang.org/x/net v0.17.0 => v0.23.0
go: upgraded golang.org/x/sys v0.14.0 => v0.18.0
go: upgraded golang.org/x/term v0.13.0 => v0.18.0
go: upgraded golang.org/x/text v0.13.0 => v0.14.0
go: upgraded google.golang.org/protobuf v1.31.0 => v1.33.0
2024/09/02 14:38:31 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/transform-encoder github.com/caddyserver/caddy/v2@v2.7.6
go: downloading github.com/caddyserver/transform-encoder v0.0.0-20240312163748-f627fc4f7633
go: downloading github.com/buger/jsonparser v1.1.1
go: downloading github.com/dustin/go-humanize v1.0.1
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.2.1
go: downloading github.com/google/cel-go v0.15.1
go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b
go: downloading github.com/smallstep/certificates v0.25.0
go: downloading google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
go: downloading github.com/tailscale/tscert v0.0.0-20230806124524-28a91b69a046
go: downloading github.com/stoewer/go-strcase v1.2.0
go: downloading github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df
go: downloading github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed
go: downloading github.com/smallstep/truststore v0.12.1
go: downloading go.step.sm/crypto v0.35.1
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/slackhq/nebula v1.6.1
go: downloading go.step.sm/cli-utils v0.8.0
go: downloading go.step.sm/linkedca v0.20.1
go: downloading github.com/smallstep/nosql v0.6.0
go: downloading google.golang.org/grpc v1.59.0
go: downloading gopkg.in/square/go-jose.v2 v2.6.0
go: downloading howett.net/plist v1.0.0
go: downloading github.com/Masterminds/sprig/v3 v3.2.3
go: downloading github.com/urfave/cli v1.22.14
go: downloading filippo.io/edwards25519 v1.0.0
go: downloading github.com/Microsoft/go-winio v0.6.0
go: downloading github.com/mitchellh/go-ps v1.0.0
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/chzyer/readline v1.5.1
go: downloading github.com/manifoldco/promptui v0.9.0
go: downloading github.com/Masterminds/goutils v1.1.1
go: downloading github.com/Masterminds/semver/v3 v3.2.0
go: downloading github.com/huandu/xstrings v1.3.3
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 google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b
go: downloading github.com/go-kit/kit v0.10.0
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.7
go: downloading github.com/go-sql-driver/mysql v1.7.1
go: downloading github.com/jackc/pgx/v4 v4.18.2
go: downloading github.com/mitchellh/reflectwalk v1.0.2
go: downloading github.com/go-logfmt/logfmt v0.5.1
go: downloading github.com/dgraph-io/ristretto v0.1.0
go: downloading github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13
go: downloading github.com/jackc/pgconn v1.14.3
go: downloading github.com/jackc/pgio v1.0.0
go: downloading github.com/jackc/pgproto3/v2 v2.3.3
go: downloading github.com/jackc/pgtype v1.14.0
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.4
go: downloading github.com/klauspost/compress v1.17.0
go: downloading github.com/golang/glog v1.1.2
go: downloading github.com/jackc/chunkreader/v2 v2.0.1
go: downloading github.com/jackc/pgpassfile v1.0.0
go: downloading github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: downloading github.com/mattn/go-isatty v0.0.16
go: downloading google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb
go: added github.com/buger/jsonparser v1.1.1
go: added github.com/caddyserver/transform-encoder v0.0.0-20240312163748-f627fc4f7633
go: upgraded github.com/jackc/pgconn v1.14.0 => v1.14.3
go: upgraded github.com/jackc/pgproto3/v2 v2.3.2 => v2.3.3
go: upgraded github.com/jackc/pgx/v4 v4.18.0 => v4.18.2
2024/09/02 14:39:00 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v
go: downloading github.com/go-chi/chi/v5 v5.0.10
go: downloading golang.org/x/sync v0.4.0
go: downloading github.com/mastercactapus/proxyprotocol v0.0.4
go: downloading github.com/BurntSushi/toml v1.3.2
go: downloading go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0
go: downloading go.opentelemetry.io/contrib/propagators/autoprop v0.42.0
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0
go: downloading github.com/alecthomas/chroma/v2 v2.9.1
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0
go: downloading go.opentelemetry.io/otel v1.21.0
go: downloading github.com/yuin/goldmark v1.5.6
go: downloading go.opentelemetry.io/otel/sdk v1.21.0
go: downloading github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
go: downloading go.opentelemetry.io/otel/trace v1.21.0
go: downloading github.com/fxamacker/cbor/v2 v2.5.0
go: downloading github.com/google/go-tpm v0.9.0
go: downloading github.com/smallstep/go-attestation v0.4.4-0.20230627102604-cf579e53cbd2
go: downloading github.com/felixge/httpsnoop v1.0.3
go: downloading go.opentelemetry.io/otel/metric v1.21.0
go: downloading go.opentelemetry.io/contrib/propagators/aws v1.17.0
go: downloading go.opentelemetry.io/contrib/propagators/b3 v1.17.0
go: downloading go.opentelemetry.io/contrib/propagators/jaeger v1.17.0
go: downloading go.opentelemetry.io/contrib/propagators/ot v1.17.0
go: downloading go.opentelemetry.io/proto/otlp v1.0.0
go: downloading github.com/google/go-tspi v0.3.0
go: downloading github.com/rs/xid v1.5.0
go: downloading github.com/sirupsen/logrus v1.9.3
go: downloading github.com/x448/float16 v0.8.4
go: downloading github.com/go-logr/logr v1.3.0
go: downloading github.com/cenkalti/backoff/v4 v4.2.1
go: downloading github.com/cenkalti/backoff v2.2.1+incompatible
go: downloading github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0
go: downloading github.com/grpc-ecosystem/grpc-gateway v1.9.5
go: downloading github.com/dlclark/regexp2 v1.10.0
go: downloading github.com/go-logr/stdr v1.2.2
go: downloading github.com/google/certificate-transparency-go v1.1.6
2024/09/02 14:39:07 [INFO] Build environment ready
2024/09/02 14:39:07 [INFO] Building Caddy
2024/09/02 14:39:07 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy -e
go: downloading github.com/stretchr/testify v1.8.4
go: downloading go.uber.org/goleak v1.3.0
go: downloading github.com/bsm/ginkgo/v2 v2.12.0
go: downloading github.com/bsm/gomega v1.27.10
go: downloading github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262
go: downloading github.com/google/go-cmp v0.6.0
go: downloading github.com/onsi/gomega v1.27.6
go: downloading golang.org/x/time v0.5.0
go: downloading gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
go: downloading github.com/zeebo/assert v1.1.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/benbjohnson/clock v1.3.0
go: downloading github.com/google/go-tpm-tools v0.4.1
go: downloading github.com/peterbourgon/diskv/v3 v3.0.1
go: downloading github.com/schollz/jsonstore v1.1.0
go: downloading github.com/alecthomas/assert/v2 v2.2.1
go: downloading github.com/kr/pretty v0.3.1
go: downloading github.com/chzyer/test v1.0.0
go: downloading github.com/aws/aws-sdk-go v1.45.12
go: downloading cloud.google.com/go/kms v1.15.2
go: downloading cloud.google.com/go v0.110.7
go: downloading github.com/googleapis/gax-go/v2 v2.12.0
go: downloading google.golang.org/api v0.142.0
go: downloading github.com/google/btree v1.1.2
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/alecthomas/repr v0.2.0
go: downloading github.com/cockroachdb/apd v1.1.0
go: downloading github.com/gofrs/uuid v4.0.0+incompatible
go: downloading github.com/hexops/gotextdiff v1.0.3
go: downloading github.com/go-stack/stack v1.8.0
go: downloading github.com/chzyer/logex v1.2.1
go: downloading github.com/kr/text v0.2.0
go: downloading github.com/rogpeppe/go-internal v1.11.0
go: downloading cloud.google.com/go/iam v1.1.2
go: downloading google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a
go: downloading github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65
go: downloading github.com/lib/pq v1.10.9
go: downloading github.com/zeebo/pcg v1.0.1
go: downloading github.com/jmespath/go-jmespath v0.4.0
go: downloading golang.org/x/oauth2 v0.12.0
go: downloading cloud.google.com/go/compute/metadata v0.2.3
go: downloading go.opencensus.io v0.24.0
go: downloading cloud.google.com/go/compute v1.23.0
go: downloading github.com/OneOfOne/xxhash v1.2.2
go: downloading github.com/spaolacci/murmur3 v1.1.0
go: downloading github.com/google/s2a-go v0.1.7
go: downloading google.golang.org/appengine v1.6.7
go: downloading github.com/googleapis/enterprise-certificate-proxy v0.2.5
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
2024/09/02 14:39:19 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath -tags nobadger
# github.com/caddyserver/caddy/v2
/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.6/listeners.go:477:4: unknown field RequireAddressValidation in struct literal of type quic.Config
/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.6/listeners.go:516:4: unknown field RequireAddressValidation in struct literal of type quic.Config
2024/09/02 14:39:46 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2024-09-02-1438.2771258597
2024/09/02 14:39:46 [FATAL] exit status 1
The command '/bin/sh -c xcaddy build --with github.com/pberkel/caddy-storage-redis --with github.com/caddyserver/transform-encoder' returned a non-zero code: 1
3. Caddy version:
v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=
4. How I installed and ran Caddy:
a. System environment:
Docker
b. Command:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
c. Service/unit/compose file:
Dockerfile:
FROM caddy:2.7.6-builder AS builder
RUN xcaddy build --with github.com/pberkel/caddy-storage-redis --with github.com/caddyserver/transform-encoder
FROM caddy:2.7.6
RUN apk update && apk add nss-tools
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
COPY Caddyfile /etc/caddy/Caddyfile
HEALTHCHECK CMD wget -q --spider http://localhost/up || exit 1
d. My complete Caddy config:
{
cert_issuer zerossl {$ZEROSSL_API_KEY}
cert_issuer acme
on_demand_tls {
ask http://{$DNSREDIRECT_NODE_HOST}:{$DNSREDIRECT_NODE_PORT}/ask
}
storage redis {
host {$REDIS_HOST}
port {$REDIS_PORT}
username {$REDIS_USERNAME}
password {$REDIS_PASSWORD}
key_prefix {$REDIS_KEY_PREFIX}
tls_enabled {$REDIS_TLS_ENABLED}
}
servers {
metrics
listener_wrappers {
proxy_protocol {
timeout 2s
allow 0.0.0.0/0
}
tls
}
}
auto_https disable_redirects
admin :2019
}