Help with setting up Caddy plugin DigitalOcean DNS

1. Caddy version (caddy version): v2.5.2 (installed through Install — Caddy Documentation)

2. How I run Caddy:

a. System environment:

Ubuntu 22.04, Docker, Docker-Compose

b. Command:

systemctl restart caddy

c. Service/unit/compose file:

Not needed

d. My complete Caddyfile or JSON config:

write.cx {
        reverse_proxy localhost:8000
}

*.write.cx {
        reverse_proxy localhost:8000
}

3. The problem I’m having:

I’m not having a problem, I am wondering how to install the DigitalOcean DNS plugin to successfully create and renew SSL certificates for the wildcard domain since every user gets their own subdomain. The end result would look something like the Caddyfile below but I’m wondering how to actually download the plugin and use it to generate the certificates.

write.cx, *.write.cx {
  reverse_proxy localhost:8000
  tls {
    dns digitalocean YOURTOKEN
  }
}

6. Links to relevant resources:

There’s no such thing. The latest version of Caddy is v2.5.2

Please fill out the help topic template, as per the forum rules. If you missed it, you’ll find it when you click New Topic and choose the “Help” category. Please copy the template and fill it out as a reply to this topic.

Sorry, I mixed it up with the PostgreSQL version. I’ll update it now.

@francislavoie So sorry about that - I’ve now edited it with all applicable information in the format. :slight_smile:

So the question is how to get a build of Caddy with the DNS plugin you need?

You can either download the binary from Download Caddy (choose the plugin you want, then click Download), or build it with xcaddy (download xcaddy, download Go and add it to your PATH, then run xcaddy build --with github.com/caddy-dns/digitalocean).

Then, since you’re running it as a systemd service, follow these instructions to replace which one is being used at runtime:

2 Likes

Thanks so much! I installed the Binary version and I’ve done everything up to the ‘version’ check so I have a few questions:

How do I proceed from Keep Caddy Running — Caddy Documentation with Caddy running as a service (just like it would from apt install) with a Caddyfile? I’m very new and I’d highly appreciate commands or direct objectives since I’m new to everything overall. I just would like a Caddyfile which can reverse proxy with Digitalocean DNS (I’ve installed that now) and for it to run even when closed.

Thank you!

If you installed with the apt package, the systemd service is already set up for you. The manual installation is only if you didn’t use the apt package and want to set it up yourself, manually. The relevant part for you is just the “Using the Service” part.

Hi there,

Thanks so much. So could you just guide me through this because I’m not understanding:

  1. Do I normally install Caddy through apt manager?
  1. Where do I download the Binary to and how do I set that up?

  2. How do I make it so the Binary works with the DigitalOcean thing and Caddyfile just like Caddy would alone?

Thank you!

Install using these instructions, if you haven’t already (I assumed you had done this from your post):

At the link I gave you above. From the Download Caddy page.

What do you mean by “DigitalOcean thing”?

I don’t understand the question. But the answer is probably “there’s no difference”?

Sorry!

I meant where do I download the Binary to - so like where should the Binary file be? And how do I make it work so like it usually works but with the Binary file with the DigitalOcean DNS so I can have SSL certificates for wildcart domains.

I just basically need Caddy, like normal, but with the DigitalOcean DNS plugin and I’m unsure on how to achieve that, where do I download the binary to would the be first step of success?

Thank you so much for your time and help!

That’s exactly what this page in the docs explains. You run mv to move the custom Caddy build to /usr/bin/caddy.custom

And then you just use Caddy as normal, except it’ll use your custom build instead of the one that ships with the apt package.

Oh right! And is there any way to use Porkbun’s automatic regenerating SSL certificates for wildcarts or do I have to be forced to use DigitalOcean’s or Cloudflare’s DNS?

What’s Porkbun? I don’t understand.

Also FYI, SSL is a deprecated term. It was renamed in 1999 to TLS.

If you want automated wildcard certificates, then you must use a DNS plugin. That’s a requirement of the ACME protocol, because the HTTP or TLS-ALPN challenges are not sufficient to prove that you control the entire domain, it can only prove that you control a particular leaf domain or subdomain.

Don’t worry about anything like that anymore.
I installed the Cloudflare DNS plugin with Caddy and installed it correctly, edited the Caddyfile with this:

write.cx, *.write.cx {
  reverse_proxy localhost:8000
  tls {
    dns cloudflare THETOKEN
  }
}

However, I am only met with this for the site:

How do I resolve this? If any more information is needed, I can provide it.

What’s in Caddy’s logs?

I see you sent me a private message with your logs. I don’t give private help by policy. I volunteer to give help publicly because it may help others who search to solve the same problem.

But I noticed that your logs were truncated (notice the > at the end of each line, where your terminal cuts it off). Please use the command found in the docs to see your logs without truncation:

1 Like

Hi there,

Sorry. I sent you a private message in case anything was shown that shouldn’t be public. I’ve messaged you with my logs once again. We can continue it here just I chose to make it private in case any of my public tokens were showing.

1 Like