this post was submitted on 10 Jun 2023
103 points (98.1% liked)

Lemmy

2172 readers
1 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to [email protected].

founded 4 years ago
MODERATORS
 

I am a software developer by craft and a linux system admin by hobby. I cannot commit to moderating and managing my own instance, but I would be glad to help someone with the technical aspects.

The most common complaint I saw in Reddit and here about switching to Lemmy is the difficulty of setting it up, so I thought I would help bridge this gap.

While I have never hosted my own instance before, I already checked the setup guide and it looks pretty simple to me, so I am confident I can do it. Please feel free to comment or DM.

It would be great if you can comment general questions. I can then respond to you here and maybe others will see it and know how to host their own instances too.

top 41 comments
sorted by: hot top controversial new old
[–] [email protected] 8 points 2 years ago (1 children)

An up to date step by step instruction for docker, ansible, or scratch setup would be a fantastic step in the right direction. I'm not a complete moron, but I feel the current guides are lacking. There's a lot of assumptions on the admins knowledge of the associated systems beforehand. As someone else said, the first to make a turnkey solution... hot dog. Would absolutely blast adoption into space.

[–] [email protected] 2 points 2 years ago (1 children)

What was it you were struggling with? I found the guide to be straightforward, but I also have a tech background similar to OP

[–] [email protected] 2 points 2 years ago* (last edited 2 years ago)

I likewise have a similar background to the OP. I wouldn't say I struggled (thanks to the Matrix chat room), but the docker instructions straight up didn't work a couple of days ago. I and another guys submitted a couple of PRs and I think the instructions should at least work for common setups now, but the edges are very rough.

By far the best way to contribute IMO is submitting PRs. The devs seem very willing to take contributions without making you jump through hoops.

[–] [email protected] 7 points 2 years ago (3 children)

Thanks for offering your knowledge! I successfully set up and instance using their docker installation guide. However I was never able to get the smtp server to work. I first tried to add postfix to the docker-compose file like they have in the ansible installation example on github, but that didn't work. Just trying to add an email address to my account would stall the UI with a spinning animation on the Save button. I then tried to update the hjson config file by adding my sendgrid api credentials and removing postfix from docker compose. That gave me the same result. At that point I kinda gave up and deleted my vps. I don't have access to my error logs anymore, but I can spin up a new vps to try to get the same errors again if needed.

[–] [email protected] 5 points 2 years ago (1 children)

A lot of VPS providers block port 25 (and other email ports) because they don't want people to set up bot spam mail servers on their services. Could that be the issue?

[–] [email protected] 1 points 2 years ago (1 children)

I'm using a VPS with Hetzner. I'll have to look up if it's blocked. Thanks for the info.

[–] [email protected] 4 points 2 years ago

I'm in the same boat and confirm that yes, port 25 is blocked.

[–] [email protected] 3 points 2 years ago* (last edited 2 years ago)

If you have Cloudflare you can set up an email alias for incoming email and then create a secondary Gmail address on top of your existing one for outgoing email. If you go to 'Settings > Accounts and Import > Send mail as' and add another email address (not an alias) with the same email as the one you setup on Cloudflare ([email protected]). You will likely need to create a Gmail app password to sign into the email server if you use 2FA.

Once you've created this email Gmail will send you a confirmation email to confirm it's all working. Then you can just enter Google's SMTP server info for Lemmy along with your email you used to login to the SMTP server when you added a new email in Gmail settings (your actual email, not the CF one), and the app password you created.

If done it this way for a few services beyond Lemmy and it's worked well so far. This way you're also using a Gmail account technically so you can hopefully avoid blacklists and spam filters.

[–] [email protected] 3 points 2 years ago

Amazon has a very generous free tier for outgoing email in SES, and it is pretty easy to set up.

[–] [email protected] 5 points 2 years ago* (last edited 2 years ago) (1 children)

I feel like there's a lot of money on the table for the first person to set up a turnkey hosting platform for Lemmy. Something like MoltenHosting but for Lemmy instead of Foundry.

[–] [email protected] 6 points 2 years ago

There’s similar things for mastodon and a project currently in alpha/beta for multiple platforms, incl Lemmy, called spacehost.

See mastodon post here https://mastodon.social/@atomicpoet/109905703584075719

See their main rep on the fediverse here: https://atomicpoet.org/users/atomicpoet and https://calckey.social/@atomicpoet (@[email protected] @[email protected]).

They also admin calckey.social.

[–] [email protected] 5 points 2 years ago (1 children)

Perhaps write a thread, with step-by-step text and photos/screenshots per platform? And then the next one to do would be a step-by-step video?

Example, I'm not technically minded, but have an Unraid box with a 1Gb connection. There are extra steps there that I'm aware of but have no idea how to do because it's over my head.

[–] [email protected] 2 points 2 years ago (1 children)

A more detailed set up guide would be great! I feel like some details were missing from the Lemmy guide.

[–] [email protected] 2 points 2 years ago (1 children)
[–] [email protected] 1 points 2 years ago

A couple of us have been detailing experience and problems with those instructions:

https://lemmy.ml/post/1165322

https://lemmy.ml/post/1160483

!lemmy_admin is the official place for discussing install and being a server administrator

[–] [email protected] 4 points 2 years ago (1 children)

Something that would help a lot of selfhoster types would be prebuild docker images and a good example docker compose. (something kbin could also use)

[–] [email protected] 4 points 2 years ago (3 children)

Do you think it would be possible to host using a raspberry pi 4?

How much traffic does Lemmy create daily?

[–] [email protected] 6 points 2 years ago

CPU requirements for Lemmy hosting are minimal. Memory is useful - you'd want to use the Pi 4 with either the 4GB or 8GB RAM, anything less than that will work but you'll be running the risk of difficulties if the server gets busy.

You'll also need plenty of storage, especially if people are going to start uploading media to your Lemmy host. Given that a Pi runs off an SD card you might well find yourself running out of storage space - I'd recommend attaching a USB storage device for the reassurance in that respect.

[–] [email protected] 4 points 2 years ago

I think for a small number of users, yes.

[–] [email protected] 4 points 2 years ago

I run lemmy.studio on a VPS with 1GB of ram and 1 VCPU, so a raspi4 should suffice, at least initially. Bandwidth is around 7.5 Mbps.

[–] [email protected] 3 points 2 years ago

I've been playing with my own single-user instance here using Docker. Mostly I just followed the Lemmy docs. It's been nice & responsive and takes barely any resources, so far. I think this system can really benefit from a lot of small instances to spread the load.

[–] [email protected] 3 points 2 years ago

You’re awesome

[–] [email protected] 3 points 2 years ago

Depending on how much Lemmy get's hugged to death I might take you up on this. Thanks!

[–] [email protected] 3 points 2 years ago (1 children)

Hi there - thanks for posting. I’m serving lemmy (ansible install) on nginx from Ubuntu 22.04 and I’m seeing this weird problem sometimes where the submit button is not enabled on the “create post” form. Sometimes it works but then it inexplicably stubbornly refuses to - I am not seeing any apparent error show up in the console, nothing in the lemmy or nginx logs (naturally, because the HTML form isn’t submitting to the server because the submit button's disabled). Happens in different browsers, tried restarting nginx, rebooting, nothing seems to fix it. Now, my addled brain does recall seeing something about Ubuntu 22.04 having some issues with Lemmy and perhaps that’s what I’m seeing - it’s just weird and I’ve never seen a web app do this before - any ideas? The url is quex.cc and you’re welcome to test there if you like, but I'm really just looking for any suggestions for investigation before I start thinking about moving to a different OS.

[–] [email protected] 6 points 2 years ago (1 children)

Open a bug ticket on the lemmy-ui Github. Every issue should be tracked

[–] [email protected] 2 points 2 years ago (1 children)

yes, good suggestion, thank you - although before I do I'm going to spend a bit of time to see if I can isolate the problem - I just tested it from a mobile device and the local PC browser and it's working now. I used the exact same url, text and everything to create the post and I didn't change anything - didn't reboot, didn't even restart the browser. Except for the fact that it's intermittent, it looks like some kind of js or css problem, but I need to replicate it and if I do that, I'll probably be able to figure it out.

[–] [email protected] 1 points 2 years ago

I realize how stupid I'll sound admitting this, but I think the problem was that I wasn't selecting the "community" in the pulldown, so the submit button wasn't enabled.

[–] [email protected] 2 points 2 years ago* (last edited 2 years ago)

Being a highly technical guy, I struggled to get everything running on the server that I am hosting other things on. The biggest hurdle was letsencrypt, but other things weren't working quite right. I ended up just paying for a new ubuntu vps so I can run the ansible playbook (I use arch linux everywhere else). That turned out to be super simple and "just worked".

[–] [email protected] 2 points 2 years ago* (last edited 2 years ago)

The thing I struggled with the most was adapting the provided docker-compose.yml for my Caddy setup.

I am using caddy-docker-proxy, which I absolutely love but their documentation is not the greatest for matchers.

If anyone else wants a super basic Lemmy instance running on Caddy with their domain on Cloudflare here is a docker-compose.yml

Please make sure you update your lemmy.hjson hostname field to match the domain you used in the docker-compose.yml for the caddy labels

If you're not using Cloudflare you can replace build: . (and not use the Dockerfile I provided below) in the caddy service with image: lucaslorentz/caddy-docker-proxy:ci-alpine (and remove the caddy.acme_dns label) and I believe it will fall back to Let'sEncrypt

version: "3.9"

services:
  caddy:
    container_name: caddy
    build: .
    depends_on:
      - lemmy-ui
      - pictrs
    ports:
      - 80:80
      - 443:443
    environment:
      CADDY_INGRESS_NETWORKS: caddy
    networks:
      - caddy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/docker/caddy/data:/data
      - /opt/docker/caddy/config:/config
    labels:
      caddy.log.format: console
      caddy.acme_dns: cloudflare YOUR_CLOUDFLARE_API_TOKEN
    restart: unless-stopped
  lemmy:
    container_name: lemmy
    image: dessalines/lemmy:0.17.3
    depends_on:
      - postgres
      - pictrs
    environment:
      RUST_LOG: "warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
    networks:
      - caddy
    volumes:
      - /opt/docker/lemmy/lemmy.hjson:/config/config.hjson:ro
    labels:
      caddy: "your.domain.com"
      caddy.@lemmy: path_regexp ^/(api|pictrs|feeds|nodeinfo|\.well-known)/.*$
      caddy.@post: method POST
      caddy.@accept: header Accept application/*
      caddy.reverse_proxy_1: "@lemmy {{upstreams 8536}}"
      caddy.reverse_proxy_2: "@post {{upstreams 8536}}"
      caddy.reverse_proxy_3: "@accept {{upstreams 8536}}"
    restart: unless-stopped
  lemmy-ui:
    container_name: lemmy-ui
    image: dessalines/lemmy-ui:0.17.3
    depends_on:
      - lemmy
    environment:
      LEMMY_UI_LEMMY_INTERNAL_HOST: lemmy:8536
      LEMMY_UI_LEMMY_EXTERNAL_HOST: localhost:1234
      LEMMY_HTTPS: true
    networks:
      - caddy
    labels:
      caddy: "your.domain.com"
      caddy.reverse_proxy: "{{upstreams 1234}}"
    restart: unless-stopped
  pictrs:
    container_name: pictrs
    image: asonix/pictrs:0.3.1
    environment:
      PICTRS__API_KEY: API_KEY
    user: 991:991
    volumes:
      - /opt/docker/pictrs:/mnt
    networks:
      - caddy
  postgres:
    container_name: postgres
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: lemmy
      POSTGRES_USER: lemmy
      POSTGRES_PASSWORD: password
    volumes:
      - /opt/docker/postgres:/var/lib/postgresql/data
    networks:
      - caddy
    restart: unless-stopped

networks:
  caddy:
    external: true

Here is the Dockerfile used for the caddy container:

ARG CADDY_VERSION=2.6.4

FROM caddy:${CADDY_VERSION}-builder AS builder

RUN xcaddy build \
    --with github.com/lucaslorentz/caddy-docker-proxy/[email protected] \
    --with github.com/caddy-dns/cloudflare

FROM caddy:${CADDY_VERSION}-alpine

RUN apk add --no-cache tzdata

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

CMD ["caddy", "docker-proxy"]
[–] ChaosAD 1 points 2 years ago

Hi! I am on the process to host a instance for a large subreddit to migrate to lemmy. I already played with hosting with docker before, and the ansible method seem even easier!

What I am concerned is about the storage. I need to have a way to calculate before hand because I am afraid of the costs.

I have an always free tier oracle cloud vps I could use, and buy some extra storage.

[–] [email protected] 1 points 2 years ago (2 children)

I haven't checked but are kbin instances easier to spin up? Kbin is be able to communicate with Lemmy communities without a problem.

[–] [email protected] 2 points 2 years ago

@lixus98
@cyclohexane

It's easy from the docker from what I can tell, the bare metal / vps is a bit more as more manual pieces but nothing too crazy. I just submitted a pull request for the admin guide so that should help a bit for less head bashing... Though my instance doesn't seem to be federating so that's a new problem for tomorrow.

[–] [email protected] 1 points 2 years ago

My two cents, I had a wobbly Lemmy instance setup that couldn't do HTTPS, federation, and stay stable all at once. It was always 1 or 2 of those 3 at best.

Switched my instance to kbin, which took about a half hour of CLI and after that has been a joy. It's just younger and admittedly less feature packed right now.

[–] [email protected] 1 points 2 years ago (1 children)

Anyone know if setting up an instance via a shared Hostgator server is possible? I already pay for a plan for my personal site so wondered if I could add on a new domain plus a partition to it and take advantage to make my own instance for posting and browsing myself.

[–] [email protected] 1 points 2 years ago (1 children)

Not familiar with Hostgator. Can you provide more details?

[–] [email protected] 1 points 2 years ago (2 children)

It's a web hosting service. The plan I have is the baby plan shared hosting on this link.

But from looking more myself, not sure if this would work. I think I'd need a VPS to actually install and build Lemmy on.

[–] ChaosAD 2 points 2 years ago

yes you would need a VPS. The only way to use lemmy with hostgator is if they add lemmy to their services like they do with wordpress for example.

[–] [email protected] 1 points 2 years ago

You'll need to be able to ssh into the server.

[–] dibs 1 points 2 years ago (1 children)

I was playing with the idea of spinning up a VPS through AWS lightsail since the bundled package it provides seems to be cheaper than configuring an EC2 instance/other requisite resources running 24/7.

What has been people's experience regarding:

  • Monthly data upload rates (since most cloud providers charge internet egress per gigabyte)
  • Database/image storage requirements
[–] [email protected] 2 points 2 years ago

Hosting a single user instance, I'm seeing a few GB of network traffic over the past few days and maybe 10Gb at most needed for the disk.

load more comments
view more: next ›