I’m trying to set up NextPush on my nextcloud-aio server. I have the nextpush app installed on the server, but I don’t know how to configure the reverse proxy timeout and buffering settings, or the matrix gateway the way they describe in the README.md. They have examples for apache and nginx, and I don’t know how to translate them to Caddy. I can connect the android nextpush app to my server, and it works/sends notifications when I restart the service, but it constantly is disconnecting, likely due to not having my proxy set up with all the options the instructions call for.
You shouldn’t use caddy add-package, you should use xcaddy build.
Minor thing, you can simplify this to just:
my_personal_nextcloud_server.duckdns.org {
Specifying https:// and :443 is redundant.
I don’t know anything about NextPush. You haven’t shown your Caddy logs (enable the debug global option), so I have no evidence of a problem. Can’t help troubleshoot if I can’t see symptoms of the problem.
When I use the xcaddy version of the dockerfile as specified in the build from source page, I get
jerry@server ~> sudo docker-compose up -d --build
[sudo] password for jerry:
Building caddy
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM caddy:latest AS builder
---> 66978cebfbcc
Step 2/4 : RUN xcaddy build --with github.com/caddy-dns/duckdns
---> Running in 1b9c5a851288
/bin/sh: xcaddy: not found
The command '/bin/sh -c xcaddy build --with github.com/caddy-dns/duckdns' returned a non-zero code: 127
ERROR: Service 'caddy' failed to build : Build failed
the add-package version works, what’s wrong with it?
I don’t know anything about NextPush. You haven’t shown your Caddy logs (enable the debug global option), so I have no evidence of a problem. Can’t help troubleshoot if I can’t see symptoms of the problem.
This is wrong too. You need to use the builder image variant, not latest. Review the docs I linked.
It’s downloading a build from Caddy’s build server (i.e. Download Caddy), you’re not actually building Caddy locally. This adds pressure to the build server (especially if automated in CI pipelines etc). And we cannot guarantee uptime of the build server, so it can randomly fail if the build server is down.
Using xcaddy builds from source using Go tooling, which will always work correctly.
Caddy’s proxy has no timeouts by default, so those aren’t relevant.
Again, we need to see logs to see how it’s failing to be able to help you.
jerry@server ~> sudo docker-compose up -d --build
Building caddy
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM caddy:latest-builder AS builder
manifest for caddy:latest-builder not found: manifest unknown: manifest unknown
ERROR: Service 'caddy' failed to build : Build failed
jerry@server ~ [1]> cat Caddy/Dockerfile
FROM caddy:latest-builder AS builder
RUN caddy add-package github.com/caddy-dns/duckdns
FROM caddy:latest
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
Caddy’s proxy has no timeouts by default, so those aren’t relevant
Cool, that’s good to know. What about proxy_buffering off; (Nginx) or <Proxy "fcgi://localhost/" disablereuse=on flushpackets=on max=10></Proxy> (Apache)?
For the matrix gateway, would adding reverse_proxy /_matrix/push/v1/notify localhost:11000/index.php/apps/uppush/gateway/matrix be the correct way to redirect that path? For reference:
Ok, updating the dockerfile to use xcaddy with 2.7.6 worked. Is there a way to have it use the latest version and fill it in, e.g. FROM caddy:${latest}-builer AS builder?
My plain Caddyfile seems to work as expected! So I guess I was overthinking it trying to configure things as directed. Thanks for your help though!
Ah good to know, I didn’t realize “latest” meant something different than I thought. Is there a similar tag like “stable” or something I can use so I don’t have to go and look up what specific version numbers are available?
No, the whole point is that you don’t rely on a moving target. The problem is that if a breaking change happens, your config won’t match. So you should deliberately update the version regularly.