1. The problem I’m having:
I am trying to set up caddy for the first time as a reverse proxy for various services on my QNAP TS-464 NAS. I have followed primarily Jim’s Garage’s tutorial, but when I run the build, it starts outputting “go: downloading xxxxxxxxxx” with “xxxxxxxx” being various githubs and golang urls. I saw a mention that there is an issue with libgen currently (at least with Porkbun) and I don’t know enough to saw if this output is indicative of that issue or not. I’m hesitant to let it run as I’m not sure quite what it’s downloading and if it’s going through every GitHub page…
2. Error messages and/or full log output:
Sending build context to Docker daemon 22.02kB
Step 1/4 : FROM caddy:builder AS builder
---> bf50d0324495
Step 2/4 : RUN xcaddy build --with github.com/caddy-dns/porkbun
---> Running in 314fb703fa4d
2025/05/06 22:37:41 [INFO] absolute output file path: /usr/bin/caddy
2025/05/06 22:37:41 [INFO] Temporary folder: /tmp/buildenv_2025-05-06-2237.1307473764
2025/05/06 22:37:41 [INFO] Writing main module: /tmp/buildenv_2025-05-06-2237.1307473764/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/caddy-dns/porkbun"
)
func main() {
caddycmd.Main()
}
2025/05/06 22:37:41 [INFO] Initializing Go module
2025/05/06 22:37:41 [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
2025/05/06 22:37:41 [INFO] Pinning versions
2025/05/06 22:37:41 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -v github.com/caddyserver/caddy/v2@v2.10.0
go: downloading github.com/caddyserver/caddy/v2 v2.10.0
go: downloading github.com/caddyserver/certmagic v0.23.0
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/prometheus/client_golang v1.19.1
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/quic-go/quic-go v0.50.1
go: downloading go.uber.org/zap v1.27.0
go: downloading go.uber.org/zap/exp v0.3.0
go: downloading golang.org/x/sys v0.31.0
go: downloading golang.org/x/term v0.30.0
go: downloading golang.org/x/time v0.11.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/prometheus/common v0.48.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading google.golang.org/protobuf v1.35.1
3. Caddy version:
I don’t think this is relevant, but since it’s the latest, that would be 2.10.0.
4. How I installed and ran Caddy:
I followed this video: https://www.youtube.com/watch?v=ZOtUco5EwoI . All the commands are files are listed below.
Docker file:
FROM caddy:builder AS builder
RUN xcaddy build \
--with github.com/caddy-dns/porkbun
FROM caddy:latest
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
a. System environment:
Using Docker that came built in with the WNAP TS-464. I am SSH’d in and running it via terminal. The QNAS is running QuTShero h5.2.4.3079
b. Command:
DOCKER_BUILDKIT=0 docker build /share/ZFS19_DATA/Container/caddy
c. Service/unit/compose file:
services:
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
restart: unless-stopped
security_opt:
- no-new-privileges:true
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /home/blue/containers/portainer/portainer-data:/data
networks:
- caddy
ports:
- 9000:9000
caddy:
build:
context: .
dockerfile: Dockerfile
container_name: caddy
restart: unless-stopped
ports:
#- 2019:2019 # remove if you do not want admin API
- 80:80
- 443:443
volumes:
- /share/ZFS19_DATA/Container/caddy/Caddyfile:/etc/caddy/Caddyfile
- /share/ZFS19_DATA/Container/caddy/site:/srv
- /share/ZFS19_DATA/Container/caddy/caddy_data:/data
- /share/ZFS19_DATA/Container/caddy/caddy_config:/config
networks:
- caddy # add other containers onto this network to use dns name
volumes:
caddy-config:
caddy-data:
# create this first before running the docker-compose - docker network create caddy
networks:
caddy:
external: true
d. My complete Caddy config:
{
admin 0.0.0.0:2019
}
# globally
{
acme_dns porkbun {
api_key {env.PORKBUN_API_KEY}
api_secret_key {env.PORKBUN_API_SECRET_KEY}
}
}
*.{
tls {
dns porkbun {env.PORKBUN_API_KEY}
propagation_delay 2m
resolvers 1.1.1.1
}
@caddy host caddy..com
handle @caddy {
root * /share/ZFS19_DATA/Container/caddy
php_fastcgi localhost:80
file_server
}
@portainer host portainer..com
handle @portainer {
reverse_proxy https://portainer:9000 {
transport http {
tls
tls_insecure_skip_verify
}
}
}
5. Links to relevant resources:
Mohammed90
(Mohammed Al Sahaf)
May 6, 2025, 11:42pm
2
Watch this issue
opened 09:25PM - 18 Apr 25 UTC
Worked fine with v2.9.1
This is using xcaddy. Sorry I don't really know go or … I would take a crack at it.
`xcaddy build v2.10.0 --output caddy-porkbun --with github.com/caddy-dns/porkbun`
```
2025/04/18 16:23:06 [INFO] absolute output file path: /home/jon/go/bin/caddy-porkbun
2025/04/18 16:23:06 [INFO] Temporary folder: /tmp/buildenv_2025-04-18-1623.388882129
2025/04/18 16:23:06 [INFO] Writing main module: /tmp/buildenv_2025-04-18-1623.388882129/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/caddy-dns/porkbun"
)
func main() {
caddycmd.Main()
}
2025/04/18 16:23:06 [INFO] Initializing Go module
2025/04/18 16:23:06 [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
2025/04/18 16:23:07 [INFO] Pinning versions
2025/04/18 16:23:07 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -v github.com/caddyserver/caddy/v2@v2.10.0
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.10.0
go: added github.com/caddyserver/certmagic v0.23.0
go: added github.com/caddyserver/zerossl v0.1.3
go: added github.com/cespare/xxhash/v2 v2.3.0
go: added github.com/francoispqt/gojay v1.2.13
go: added github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
go: added github.com/google/pprof v0.0.0-20231212022811-ec68065c825e
go: added github.com/google/uuid v1.6.0
go: added github.com/klauspost/cpuid/v2 v2.2.10
go: added github.com/libdns/libdns v1.0.0-beta.1
go: added github.com/mholt/acmez/v3 v3.1.2
go: added github.com/miekg/dns v1.1.63
go: added github.com/onsi/ginkgo/v2 v2.13.2
go: added github.com/prometheus/client_golang v1.19.1
go: added github.com/prometheus/client_model v0.5.0
go: added github.com/prometheus/common v0.48.0
go: added github.com/prometheus/procfs v0.12.0
go: added github.com/quic-go/qpack v0.5.1
go: added github.com/quic-go/quic-go v0.50.1
go: added github.com/zeebo/blake3 v0.2.4
go: added go.uber.org/mock v0.5.0
go: added go.uber.org/multierr v1.11.0
go: added go.uber.org/zap v1.27.0
go: added go.uber.org/zap/exp v0.3.0
go: added golang.org/x/crypto v0.36.0
go: added golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
go: added golang.org/x/mod v0.24.0
go: added golang.org/x/net v0.38.0
go: added golang.org/x/sync v0.12.0
go: added golang.org/x/sys v0.31.0
go: added golang.org/x/term v0.30.0
go: added golang.org/x/text v0.23.0
go: added golang.org/x/time v0.11.0
go: added golang.org/x/tools v0.31.0
go: added google.golang.org/protobuf v1.35.1
2025/04/18 16:23:07 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -v github.com/caddy-dns/porkbun github.com/caddyserver/caddy/v2@v2.10.0
go: added github.com/caddy-dns/porkbun v0.2.1
go: added github.com/libdns/porkbun v0.2.0
2025/04/18 16:23:08 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -v
2025/04/18 16:23:09 [INFO] Build environment ready
2025/04/18 16:23:09 [INFO] Building Caddy
2025/04/18 16:23:09 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy -e
2025/04/18 16:23:09 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /home/jon/go/bin/caddy-porkbun -ldflags -w -s -trimpath -tags nobadger,nomysql,nopgx
# github.com/libdns/porkbun
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:59:40: r.Name undefined (type libdns.Record has no field or method Name)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:65:77: r.Type undefined (type libdns.Record has no field or method Type)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:87:13: record.TTL undefined (type libdns.Record has no field or method TTL)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:88:11: record.TTL undefined (type libdns.Record has no field or method TTL)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:90:30: record.TTL undefined (type libdns.Record has no field or method TTL)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:91:46: record.Name undefined (type libdns.Record has no field or method Name)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:97:53: record.Value undefined (type libdns.Record has no field or method Value)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:97:108: record.Type undefined (type libdns.Record has no field or method Type)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/client.go:102:86: record.ID undefined (type libdns.Record has no field or method ID)
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/models.go:48:9: invalid composite literal type libdns.Record
/home/jon/go/pkg/mod/github.com/libdns/porkbun@v0.2.0/models.go:48:9: too many errors
2025/04/18 16:23:09 [INFO] Cleaning up temporary folder: /tmp/buildenv_2025-04-18-1623.388882129
2025/04/18 16:23:09 [FATAL] exit status 1
```
and this PR
main
← wbrawner:main
opened 11:53PM - 30 Apr 25 UTC
Fixes #13
Sorry for the large PR here; I'm not really sure there's a good way… to break it up to be honest. At a high-level, here are the changes I've made:
> * [libdns.Record](https://pkg.go.dev/github.com/libdns/libdns@v1.0.0-beta.1#Record) is now an interface type, not a concrete struct.
> * [libdns.RR](https://pkg.go.dev/github.com/libdns/libdns@v1.0.0-beta.1#RR) is a new struct type that closely resembles the previous Record struct.
In most places, I was able to just use the `libdns.RR` type in place of the `libdns.Record` type. One of the changes here though is that there's no longer an `ID` field on the `libdns.RR` type, which means I had to stop using it for Porkbun's API. Luckily, they offer the ability to modify records with just the record name and type, so I've taken that approach here.
> * There are [many new struct types](https://pkg.go.dev/github.com/libdns/libdns@v1.0.0-beta.1#pkg-index) corresponding to specific DNS RR-types, such as [Address](https://pkg.go.dev/github.com/libdns/libdns@v1.0.0-beta.1#Address) (for A/AAAA), [TXT](https://pkg.go.dev/github.com/libdns/libdns@v1.0.0-beta.1#TXT), [CNAME](https://pkg.go.dev/github.com/libdns/libdns@v1.0.0-beta.1#CNAME), etc. Your methods should return these types instead of RR to make things easier and more reliable for users.
I didn't actually implement _all_ of the record types, just the few I thought might be used by caddy. If you think this is a mistake, I can go back and add support for the remaining record types as well. I think there could be some more tests added, though I had a few thoughts there. Would love to discuss on IRC/mailing list/Matrix/whatever your preferred communication method is.
For now, use Caddy 2.9.4.
This Dockerfile isn’t complete. See the documentation on Docker Hub.
https://hub.docker.com/_/caddy/
1 Like
Thank you, so it is related to that issue, great to have confirmation!
I did try plugging in 2.9.4, but was getting a similar output, but that may be related to the incomplete Dockerfile you mentioned, which is weird as mine looks almost identical to the one referenced in the video.. but thanks for that too, I’ll look that over and give 2.9.4 another go!
update: tbh I’m not sure what’s missing from the Dockerfile? Looking at the documentation and several examples, mine is exactly the same aside from me only installing the pork bun module
Mohammed90
(Mohammed Al Sahaf)
May 7, 2025, 8:52am
4
Ah, sorry, my eye missed the second FROM
line. I’m used to searching for an empty line.
1 Like
no worries, I didn’t realize it was smashed together like that
alright, I’m making progress and learned that what I took as erroneous downloads and errors weren’t. The red text and seemingly unrelated pages being downloaded led me to think it’s an error when they were really just dependencies. I’ve successfully been able to build the image, but running into issues composing it due to zfs and permissions
1 Like
Got it built! For anyone else struggling with this on a QNAP NAS, after you build it using the command in my first post, you’ll actually get errors when trying to compose it. The solution is to go to Container Station > Images and you should see your caddy image(easily to ID if you tagged it when building). Just hit Play/Start and CS will spin it up! I successfully got the welcome page, but still not able to use the address to get to it, but working on pinpointing why
2 Likes
I’m no expert, but I used nmap from outside my network and it’s reporting 80 and 443 are closed, even though they’re open on my router. I’ll have to contact my ISP and see if they have it blocked or something. Anyways, my caddy specific issue has been figured out (so far)!
1 Like