this post was submitted on 19 Oct 2023
2 points (100.0% liked)

Self-Hosted Main

502 readers
1 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

For Example

We welcome posts that include suggestions for good self-hosted alternatives to popular online services, how they are better, or how they give back control of your data. Also include hints and tips for less technical readers.

Useful Lists

founded 1 year ago
MODERATORS
 

Does anyone know of a tool similar to https://github.com/tiredofit/docker-traefik-cloudflare-companion to automatically register CNAME entries in Cloudflare but for Caddy Server?

top 9 comments
sorted by: hot top controversial new old
[–] dazchad@alien.top 1 points 11 months ago (2 children)

I suppose wildcard DNS would not work for you?

I have a *.svr.domain.tld on Google Domains (need to transfer somewhere else), and then on Caddyfile I can register individual foo.svr.domain.tld without touching DNS

[–] Mr-Mars-Machine@alien.top 1 points 11 months ago (1 children)

That's a very good one! I hadn't thought about it that way. Anyway, if there was some similar tool for Caddy it would be great. Thanks for your comment.

[–] Wreid23@alien.top 1 points 11 months ago (1 children)

Put your request in caddy forums and tag mholt he is very responsive . You could also sign up for open ai (chat gpt) feed it the compose.yml file in that github and ask it "what does this yml do" let it answer then ask "what modifications would be needed to make a similar script or yml that uses caddy in stead of traffik" when it gives you a working output (try it ) and go back to forums and say I want to make somethng like this and get feedback . Rinse and repeat and it may already exist as a combo of adding caddy packages + you just need the right caddyfile or json + addons to work with what may already exist as a feature with some docker tweaks

[–] Mr-Mars-Machine@alien.top 1 points 11 months ago

Put your request in caddy forums and tag mholt he is very responsive . You could also sign up for open ai (chat gpt) feed it the compose.yml file in that github and ask it "what does this yml do" let it answer then ask "what modifications would be needed to make a similar script or yml that uses caddy instead of traffik" when it gives you a working output (try it ) and go back to forums and say I want to make somethng like this and get feedback . Rinse and repeat and it may already exist as a combo of adding caddy packages + you just need the right caddyfile or json + addons to work with what may already exist as a feature with some docker tweaks. I fixed a few scripts / yml configs like this that I prob wouldnt havent gotten close to working without hours of headbanging / trial and error.

I will make sure to post this question in the Caddy forum. I just wanted to know the opinions and experiences of other people who also had this need, that's why I opened this Reddit thread.
Thanks!

[–] -eschguy-@alien.top 1 points 11 months ago

This is what I do

[–] AnApexBread@alien.top 1 points 11 months ago

Why not just use the Cloudflare Tunnels command line binary?

It can automatically create the CNAMEs

[–] funfungo0dg0od@alien.top 1 points 11 months ago (1 children)

Interesting question actually.

From what I know, there is very few solutions for this purpose. I haven't found a direct way to update DNS records from docker containers, without a lot of crafting.

I toyed with registrator but it's not updated since a long time (https://github.com/gliderlabs/registrator). The idea is to plug container to another backend, etc/consul. For internal traffic, it's good but if you want to publicly expose the zone, probably need to setup a real DNS server as proxy. Well a lots of setup, especially if you want internet exposition .

This guy tried an interesting thing, still involving Consul, but it look like what I could publicly expose on internet: https://ilhicas.com/2023/01/25/Creating-a-core-dns-with-consul-docker-image.html

I've also seen that: https://github.com/rlipscombe/dockerns , wich is interesting for service discovery, but probably not more.

This is good also: https://github.com/phensley/docker-dns

On my side, I started a little python project that watch docker events, scan container labels, and send a nsupdate add/del records to another DNS server that accept dnsupdate. The smartest approach on my side, but it relies on a quick and dirty script I wrote. If I take time to rewrite it, I guess it could be a good solution for every one. Ho and it also solve the dual-dns issue, as you can forward different records to different servers.

If you feel I interested, I can publish my python project :)

[–] Mr-Mars-Machine@alien.top 1 points 11 months ago

Thank you for sharing your experience in such a detailed way. I will take a look at all these repositories you mention ☺️
About what you say about your project, of course. I would be very happy to try it. If you can publish it it would be great!

Thanks again!

[–] PaddyStar@alien.top 1 points 11 months ago

Create at your dns domain provider a cname record *.cloud.domain.com to your caddy ip and in caddy use always services.cloud.domain.com, service2.cloud.domain.com,..

Use it this way so I don’t need to add to every service a new cname record.

And caddy creates for every service a own cert.. no wildcard ..