this post was submitted on 15 Jul 2023
9 points (71.4% liked)

Selfhosted

39435 readers
4 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
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 1 year ago

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.