Best way to install and maintain Caddy with DNS module?

1. The problem I’m having:

I need “best practice” approach to maintain the following Caddy binary.

I am using a custom Caddy with Duck DNS plugin using https://caddyserver.com/download. Everything is working, I am however wondering what is the best approach to maintain/update this custom Caddy. Right now, as I understand it, I would have to manually build Caddy each time there is an update?

2. Error messages and/or full log output:

I do not have any error. However, here’s my Caddyfile, with my DuckDNS API-key redacted out

my-jellyfin-server.duckdns.org {

        reverse_proxy 127.0.0.1:8096

        # Enable the static file server.
        file_server

        tls {
                dns duckdns MYAPI-KEY
        }
}

3. Caddy version:

caddy version
v2.9.1 h1:OEYiZ7DbCzAWVb6TNEkjRcSCRGHVoZsJinoDR/n9oaY=

4. How I installed and ran Caddy:

Using the custom build image for DuckDNS (https://caddyserver.com/download). This image was then put in /usr/bin. The file caddy.service was created. So, using systemd approach.

a. System environment:

Ubuntu Server LTS

cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.2 LTS"
PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

b. Command:

Caddy is started at launch. Manually, that would be

sudo systemctl start caddy

c. Service/unit/compose file:

/etc/systemd/system/caddy.service file

# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

d. My complete Caddy config:

Caddyfile, with personal info redacted out (server name and DuckDNS API-KEY)

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.

my-jellyfin-server.duckdns.org {
        reverse_proxy 127.0.0.1:8096

        # Enable the static file server.
        file_server

        # TLS DuckDNS
        tls {
                dns duckdns MY-API
        }
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

5. Links to relevant resources:

This is a Jellyfin configuration.

1 Like

Well, I might have found my solution with caddy upgrade which should upgrade with the installed duckdns plug-in.

However, I ran the command and it seems stalled:

user@hostname:/etc/caddy$ sudo caddy upgrade
[sudo] password for user:
2025/04/07 13:25:46.380 INFO    this executable will be replaced        {"path": "/usr/bin/caddy"}
2025/04/07 13:25:46.380 INFO    requesting build        {"os": "linux", "arch": "amd64", "packages": ["github.com/caddy-dns/duckdns@v0.4.0"]}

We’re looking into build server issues lately.

caddy upgrade is just a shortcut for downloading the build from our website and then replacing the binary. In the meantime you can use xcaddy to easily build from source locally :+1:

2 Likes

ok, I’ll take a look at xcaddy and see what I need to do. Reading from the documentation, I would simply need to do something like (when vX.Y.Z is released)

xcaddy build vX.Y.Z --with github.com/caddy-dns/duckdns

or is the process a little bit more complex?

For the caddy upgrade solution, it’s simply a matter of waiting for the build server issues to be resolved or is it a feature that is phasing out because of those issues?

Thanks!

A post was split to a new topic: Hosting Jellyfin with DuckDNS

A post was merged into an existing topic: Hosting Jellyfin with DuckDNS