I’d like to self-host my own Lemmy instance. My environment is comprised of a Fedora VM on a separate VLAN running in Proxmox. That VM runs docker, and exposes all my services to Cloudflare using a treafik reverse proxy.

I have found some posts in my googlings of folks that were able to get Lemmy to work inside Traefik. I have tried their docker-compose files, and ultimately came up short.

My question, has anyone been able to get this working? If so, how?

Matt The Horwood
link
fedilink
English
21Y

This is my swarm file - https://github.com/mhzawadi/docker-stash/blob/master/swarm/stack-lemmy.yml - should be what you need

I tried using Traefik in big corporation, 20+ different load balancer and reverse proxy (all with TLS termination) rules.

Caddy not just worked, but also worked faster and was WAY simplier to setup (using Caddyfile and reverse_proxy directives) than Traefik.

@daFRAKKINpope@lemmy.world
creator
link
fedilink
English
11Y

I’m reading about Caddy and playing around with it. It seems pretty straightforward. I’ll have to see if I can’t implement it.

Here is the example docker-compose.yml:

services:
  caddy:
    image: caddy
    container_name: caddy
    volumes:
      - ./caddy/data:/data
      - ./caddy/config:/config
      - ./caddy/Caddyfile:/etc/caddy/Caddyfile
    ports:
      - 80:80/tcp
      - 443:443/tcp
      - 443:443/udp
    restart: always

  lemmy:
    image: lemmy
    container_name: lemmy
    ...

Before executing, create a new directory caddy i working directory, then create new file Caddyfile in it (lemmy is a container name):

mydomain.com {
    reverse_proxy lemmy:<lemmy_container_http_port>
    encode zstd gzip
}

Then fix your UDP Buffer size, so it’s compatible with QUIC: https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes

And that’s it. tcp80, tcp443 and udp443 should be reachable from anywhere, as Caddy out of the box uses ACME to retrieve TLS certificates for your domain.

Give it a try. Honestly Traefik is shit for a simple load balancer. It’s more suited for large enterprises and kubernetes services, but it also has numerous issues, such as basic auth performance issues, lack of headers customization as well as in overall somewhat difficult configuration. Caddy makes it straightforward & simple, which is perfect for simple users who love to self-host.

Maybe it’ll be easier if you share the exact issue you’re having.
“came up short” doesn’t tell us anything on what to help you with.

I’ve installed it with docker compose, but I use caddy in a dedicated debian VPS, so our setup is different but if your problem is with docker compose itslef maybe I could help you.

@daFRAKKINpope@lemmy.world
creator
link
fedilink
English
11Y

This is valuable feedback. In retrospect I didn’t explain my problem at all. I’m really good at reading instructions, pretty poor at asking for help.

I’m going to take another crack at this, after I read up on and learn all about Caddy. At first glance it looks like it takes away a lot of my pain points from Traefik.

raphael
link
fedilink
51Y

It is pretty straight forward if you use the provided docker-compose file with the nginx internal proxy in it. Just add traefik as per usual to the internal port 8536 of the proxy container.

redcalcium
link
fedilink
4
edit-2
1Y

This seems to be the easiest solution. Use the provided docker-compose file, then configure traefik to route requests to your lemmy domain to port 8536. How to do that depends on how you currently run traefik as there are multiple ways to configure it. Could be as simple as adding a label to the service named proxy in lemmy’s docker-compose file.

This is my ingressroute for lemmy:


apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: lemmy
spec:
  entryPoints:
    - web
  routes:
    - kind: Rule
      match: Host(`threads.ruin.io`) && PathPrefix(`/api/`)
      services:
        - kind: Service
          name: lemmy
          passHostHeader: true
          port: 80
    - kind: Rule
      match: Host(`threads.ruin.io`) && PathPrefix(`/pictrs/`)
      services:
        - kind: Service
          name: lemmy
          passHostHeader: true
          port: 80
    - kind: Rule
      match: Host(`threads.ruin.io`) && PathPrefix(`/feeds/`)
      services:
        - kind: Service
          name: lemmy
          passHostHeader: true
          port: 80
    - kind: Rule
      match: Host(`threads.ruin.io`) && PathPrefix(`/nodeinfo/`)
      services:
        - kind: Service
          name: lemmy
          passHostHeader: true
          port: 80
    - kind: Rule
      match: Host(`threads.ruin.io`) && PathPrefix(`/.well-known/`)
      services:
        - kind: Service
          name: lemmy
          passHostHeader: true
          port: 80
    - kind: Rule
      match: Host(`threads.ruin.io`) && Method(`POST`, `PUT`, `DELETE`, `PATCH`, `CONNECT`)
      services:
        - kind: Service
          name: lemmy
          passHostHeader: true
          port: 80
    - kind: Rule
      match: Host(`threads.ruin.io`) && HeadersRegexp(`Accept`, `application\/(?:activity|ld)\+json`)
      services:
        - kind: Service
          name: lemmy
          passHostHeader: true
          port: 80
    - kind: Rule
      match: Host(`threads.ruin.io`)
      services:
        - kind: Service
          name: lemmy-ui
          passHostHeader: true
          port: 80

It seems to work correctly. Given that you’re not using kubernetes, you’ll need to do some translation work.

Domi
link
fedilink
English
11Y

Can you federate with kbin instances? The communities get stuck at subscribe pending for me.

That’s the only thing not working and I assume I’m missing a proxy rule.

It does appear to work for me.

BlackEco
link
fedilink
English
01Y

I had the same issue, upgrading to 0.18.1 and using the revised nginx.conf from lemmy-ansible fixed the issue.

Domi
link
fedilink
English
11Y

Figured it out. I also had to add the PUT, DELETE, PATCH and CONNECT rules, only POST doesn’t work for kbin apparently.

chiisana
link
fedilink
English
41Y

I’ve got mine running and shares my notes here: https://lemmy.chiisana.net/post/264

What are you coming up short with?

Create a post

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!

  • 1 user online
  • 126 users / day
  • 421 users / week
  • 1.16K users / month
  • 3.85K users / 6 months
  • 1 subscriber
  • 3.68K Posts
  • 74.2K Comments
  • Modlog