this post was submitted on 16 Jun 2023
17 points (100.0% liked)

Selfhosted

40345 readers
772 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.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Come on and fight me.....

I just tried out caddy for the first time and found it to be fantastic, I have used both Traefik and Nginx Proxy Manager extensively and although they were both great, the simplicity of the Caddfilr is fantastic. With a few snippets configured, I can add a host with a single line that just defines the port and url, it's like magic.

Has anyone got any known traps ( or tips) with caddy to make it useful.

The issues I have had previously with Traefik were the need to have multiplelines to configure it (and configure the host and router separately), and the difference between local docker services ( I do like using labels to configure, but with lots of services it gets a bit fragmented and difficult toanahe) and remote services ( had to use the file config).

With NPM, I find using the GUI to configure the servers difficult ( and challenging to keep consistent ) and I had a time that it forgot something ( can't remember if it was certificates or something else ) and that was the straw that broke the camel's back for me.

Anyway, currently I am happy with caddy and am not planning on replacing it (at least for a month or two :D ). It would be nice if there was a GUI, but no big drama honestly, and the text config is great.

top 30 comments
sorted by: hot top controversial new old
[–] in2erval@kbin.social 8 points 1 year ago

When I saw the title I got confused with Node Package Manager lol

[–] Edo78@feddit.it 4 points 1 year ago (4 children)

It's interesting how different people have different approaches ... I migrate from Caddy to Traefik because I found it magical ... Whenever I need to add another selfhosted service I just adapt a docker-compose like this one

version: '3.8'

services:
  homeassistant:
    container_name: homeassistant
    image: ghcr.io/home-assistant/home-assistant:stable
    #image: homeassistant/raspberrypi4-homeassistant:stable
    volumes:
      - ./media/:/media
      - ./config/:/config
      - /etc/localtime:/etc/localtime:ro
    environment:
      - TZ=${TZ}
    restart: unless-stopped
    networks:
      - t2_proxy
      - backend
    labels:
      - traefik.enable=true
      - traefik.docker.network=t2_proxy
      - traefik.http.routers.homeassistant.rule=Host(`home.mydomain.bla.bla`)
      - traefik.http.routers.homeassistant.entrypoints=websecure
      - traefik.http.routers.homeassistant.tls.certresolver=myresolver
      - traefik.http.services.homeassistant.loadbalancer.server.port=8123

networks:
  backend:
    external: true
  t2_proxy:
    external: true

As you can see I just need to change the host and the port in the labels to have a new domain pointing to the right port ... I wasn't able to find an easier way to add a new service to caddy

[–] mbirth@lemmy.mbirth.uk 3 points 1 year ago

This! I’ve setup Traefik and use traefik-redis and traefik-kop to pull in labels from my other Raspberry Pis so I can spin up my containers on any of the Docker hosts without having to change anything in the proxy config.

[–] qwacko@lemmy.nz 2 points 1 year ago

Yeah, I had lots of service configured like that, and you are correct that it is awesome, however I have other services on other hosts (not on docker swarm either) so I needed to delve into file config quite often, and doing some web dev work, I had services that weren't dockerized, so I ended up creating dummy services (socat containers) to make them easy. It just got a bit frustrating and taking too much headspace, I was able to setup caddy in about 2 hours one evening, so I am pretty happy so far, and I can see all my hosts in a single file which is great ( I ended up with orphaned routes etc.. from containers I forgot about when I was testing things).

As you say, different people come at the same problem and come away with totally different views ( which is pretty great that there are enough option that we can all find something that works for our needs ).

[–] karlthemailman@sh.itjust.works 2 points 1 year ago* (last edited 1 year ago) (2 children)

Completely a personal preference, but this is one reason I prefer caddy. I like to keep the configs separate and not clutter up my compose files.

It means I need to update two things when adding a new service (a compose file plus my caddy file), but I like the separation of concerns.

It also makes my proxy config consistent for all services, regardless of whether that run in docket or elsewhere.

[–] lckdscl@whiskers.bim.boats 1 points 1 year ago

I like to keep the configs separate and not clutter up my compose files.

You can do that with Traefik, I have all my reverse proxy config in a file that hot reloads by Traefik dynamically, so I don't even have to restart Traefik, or even the compose files (that's the problem with Traefik labels), just run compose, add service to said dynamic file, save, and the website is now reachable on the browser.

[–] Edo78@feddit.it 1 points 1 year ago (1 children)

I just use dockerized service and I plan to move to k8s so I don't have (nor plan to) deal with anything besides dockerized services

Yeah, then I can see the appeal of keeping everything in the same configs.

[–] Andreas@feddit.dk 2 points 1 year ago (1 children)

First time I heard of migrating from Caddy to Traefik and not the other way around. The usual complaint about Traefik is that it's too complicated to manage all of the moving parts. I have only used Caddy with Dockerized setups though so I don't know what the others are like.

[–] Edo78@feddit.it 2 points 1 year ago

Well, this way it works great for my needs ... If I don't need a service anymore I just remove its docker-compose and puff it's gone the service and the reverse proxy config all in one single atomic thanos-like snap of fingers I wasn't able to find a way to do the same with Caddy and I don't get what do you mean with "moving parts"

[–] Protegee9850@lemmy.world 4 points 1 year ago (1 children)

You've got those carrots in the wrong direction.

[–] karlthemailman@sh.itjust.works 3 points 1 year ago (1 children)

Any specific reason you think they should be backwards? I have only limited exposure to the alternatives, but caddy was the easiest for me to set up when I was looking for a reverse proxy.

My main issue with caddy was having to compile in any extensions manually, but you don't even need to do that anymore.

[–] Protegee9850@lemmy.world 2 points 1 year ago

Eh, personally I just found NPM super easy to set up and manage, especially when it came to setting up letsencrypt etc. Everything just works. Easy to update, easy to manage, easy to take down and spin back up again. My OP had a bit of snark though, I'm not exactly an expert, I'm sure there are very good reasons why the OP and other smart nerds on this community may disagree

[–] db0@lemmy.dbzer0.com 4 points 1 year ago (1 children)

I'm the weirdo going with haproxy, but that thing is an absolute beast.

[–] r0ckr@lemmy.world 1 points 1 year ago (1 children)

Ha, same here. HAProxy plugin running on my opnSense. I should probably try caddy because HAProxy is complete overkill for my requirements.

[–] db0@lemmy.dbzer0.com 1 points 1 year ago (1 children)

I mean, if you already have it, why change?

[–] qwacko@lemmy.nz 1 points 1 year ago

True, but if someone spends 5 hours changing there proxy ( + 10 hours figuring out what you broke and fixing ), then they might save a few minutes down the line configuring new services. self-hosting maths....

[–] Osayidan@social.vmdk.ca 4 points 1 year ago (1 children)

I'm that weird person who just uses nginx and does the config files in a text editor. Been doing it that way since 2010 or so and I'm too used to it to appreciate proxy manager.

[–] Protegee9850@lemmy.world 3 points 1 year ago

Absolute psychopath.

[–] bdonvr@thelemmy.club 3 points 1 year ago* (last edited 1 year ago) (1 children)

I've been using Traefik, Caddy sounds interesting but I'm definitely not touching my setup until it breaks lmao. Then maybe I'll give it a shot.

[–] lckdscl@whiskers.bim.boats 1 points 1 year ago

Caddy was working fine for me until I scaled my homelab and had around 70 running containers. It constantly gave me 502 upstream errors, I tried all I could to isolate the problem (reducing the number of containers, reducing the number services Caddy handles, reworking Caddyfile), but the timeout still occurs with every service, I searched everywhere and couldn't find a working solution.

Then I tried out Traefik, set up a dynamic file configuration for all my containers, and haven't had a single 502 since. The dynamic configuration is such a nice thing to have Im never leaving Traefik. Plus it seems more in line with UNIX philosophy as it is modular with the middlewares and plugins.

[–] lupec@lemm.ee 3 points 1 year ago

Man, I started with Apache back in the day which is just nightmarish to manage for simple projects imo, then moved to NGINX, which felt a bit better but still not super intuitive, then NPM, which did make it significantly more user friendly.
Then Caddy came along and swept me off my feet, I still can't believe it's as dead simple as it is lol. I tried Traefik for a while because it sounded super interesting and I do love the idea, but it brought a lot of the complexity back with it for admittedly very neat docker integration.
Went right back to Caddy after I moved away from docker as a whole and I couldn't be happier, I just find it so pleasant to use. Just pure KISS goodness!

So I guess my ranking goes Caddy > Traefik > the rest

[–] jjakc@lemthony.com 3 points 1 year ago

I have only used 2 reverse proxies, so I can say with confidence that SWAG > all /s

My setup is running NPM and I can't complain, but I'll look into caddy as I've seen it mentioned a lot.

I saw it mentioned here, I likely won't change on my setup until something breaks though. 😂

[–] yourstruly@dataterm.digital 2 points 1 year ago (1 children)

Caddy is great, I've been using it for all greenfield projects.

P. S. Have you checked out the Caddy API?

[–] qwacko@lemmy.nz 1 points 1 year ago

I am aware of it, haven't needed to use it, but seems pretty powerful.

[–] unwritten@kbin.social 2 points 1 year ago (1 children)

At the first time move to Caddy, I had an issue adding Caddy container to all the current docker networks.
How do you tackle that issue?

[–] Perhyte@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

I use docker-compose, and basically just end all my docker-compose.yaml files with

networks:
  default:
    external:
      name: proxynet

This redefines the default network to a pre-existing proxynet network. All services that do not specify a network configuration automatically get added to that network. Because this refers to the same network in each file, it is shared even with services defined in other yaml files (which is not the default).

The proxynet network was created manually using docker network create proxynet.

Honestly if I had everything in docker I'd use traefic, but I found it horrifically complex to do simple things as soon as you need to branch off of your docker host. I've just started using Caddy and it is so user friendly I can't even believe it.

[–] lp0101@kbin.social 1 points 1 year ago

Traefik configuration is a bit verbose at times, but middlewares are awesome and you can pry them from my cold dead hands

load more comments
view more: next ›