this post was submitted on 26 Jun 2023
72 points (96.2% liked)

Selfhosted

40716 readers
454 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 2 years ago
MODERATORS
72
Lemmy on a raspberry pi (self.selfhosted)
submitted 2 years ago* (last edited 2 years ago) by blotz to c/selfhosted
 

Does anyone run their own Lemmy instance on a pi? How was the process of setting it up? Were there any pitfalls? How is performance?

[Edit] So a lot of testing around. Compiling from scratch, etc, etc...

So far i have tried

  • installing lemmy using rootless docker (on 0.17.3)
  • compiling the image 0.18 docker image as arm

rootless docker did not work well for me. lots of systemd issues and i gave up after running into a lot of issues. I tried rootless docker for security reasons. minimal permissions, etc.

When trying to compile the latest lemmy image in arm, i ran into issues with muslrust not having an arm version. It might be worth investigating rewriting the docker file from 0.17.3 to work with 0.18.0 but i haven't investigated that fully yet! I tried compiling the latest image because i wanted to be able to use the latest features

At the moment, I'm trying to set lemmy to run under bare metal. Im currently attempting to compile lemmy under arm. If that works, i'll start setting up .service files to start up lemmy and pictrs.

top 31 comments
sorted by: hot top controversial new old
[–] marsara9 13 points 2 years ago (1 children)

I was able to get it setup, main things to watch out for:

  • Don't use the provided docker compose file. Or more precisely don't build from source and lookup the correct image tag on docker hub first.
  • The documentation was a bit confusing. This isn't really specific for the Pi but since I was creating a compose file from scratch some of the steps listed didn't quite explain all of the details.

I only used it for testing purposes, but performance was fine (on a Pi4 4gb). Note I only ever had one user.

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

As I only want to use it for myself as jump-off point (and to mess around a tad) I'm fine with performance on an RPi4 (have the 8 GB version), but I'm struggling to get it next to the rest in my Debian install on it.

Local install fails as I need imagemagick 7 (Debian still had 6.9), and it refuses to compile with imei method. (that script wants to use /usr/local/bin/identify which I think it needs to install itself (part of imagemagick) and the compose file I couldn't get to work with an external (already hosted) postgres.

Any tips? I'm totally new with docker and ansible.

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

So in the official docker-compose.yml lines that define where/how to get the image for that application.

For example:

https://github.com/LemmyNet/lemmy/blob/c9e9ff46faa40e2642343effb117693bfa525c5f/docker/docker-compose.yml#L41-L43

build:
      context: ../
      dockerfile: docker/Dockerfile

This tells docker to look for a file called docker/Dockerfile in the parent directory. This means that when you go to call docker compose up -d it will build an image from source using that Dockerfile. For the Pi we don't want this (at least as of 0.17.x; I haven't tested 0.18.0 yet).

Instead we want to use a pre-built image. To do that we need to go to docker hub, specifically: https://hub.docker.com/r/dessalines/lemmy/tags and find the latest tag that matches the architecture of the system we're building on. I assume you're on a Pi4 running a 64bit so, so that gives us 0.17.3-linux-arm64. After you've got that tag we just need to replace those 3 lines above with:

image: dessalines/lemmy:0.17.3-linux-arm64

Now when we go to call docker compose up -d it will pull down that prebuilt image instead of building for source. Btw, you'll want to do the same for the lemmy-ui service.

P.S. I don't have much experience using Ansible, so I can't help here. I normally just SSH directly into the Pi and do everything there.

[–] TheInsane42 1 points 2 years ago

Oh wait, I forgot, compose .yaml syntax is (almost) the same as Ansible, so no need for Ansible. Thanks for pointing to the docker images. I'll start messing about with those. Still need to pick an fqdn for those instances. Do I want to use lemmy.my.domain or direct my.domain. (as it's by all means mine anyway)

[–] blotz 12 points 2 years ago* (last edited 2 years ago) (3 children)

Im looking at setting up a lemmy instance on a rpi3 with cloudflared tunnel! I'm curious to see if anyone else has done this and how it was.

Edit: I'll give it a whirl and hopefully post an update from my new instance later!

Edit 2: ~~I appear to have lost my micro sd card reader! I cant write a new image hah~~ nevermind found it!

[–] Tolstoy 8 points 2 years ago

Please don't forget to give us updates on your adventure^^

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

I did this this exact setup with rpi4b and worked flawlessly. Just follow the "Docker installation" guides in setup and replace the image with an arm64 one

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

I don't think there should be any problems, lemmy is a fairly lightweight web application, it's compiled so no big overhead of some runtime like ruby in case of mastodon. I haven't tried it on a raspberry Pi, but on my server the load is always just around 0.1

The only bottleneck I could think of was Postgres, but I've been running postgres on raspberry pies without any problems before too.

[–] HowdWeGetHereAnyways 7 points 2 years ago (1 children)

Hey OP, I'm on a similar journey (except I'm using an rpi kubernetes cluster)

I don't have advice but I do want to wish you good luck

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

Here: my daily "simply a nice stranger" award goes to you

[–] HowdWeGetHereAnyways 2 points 2 years ago

Hey thanks, stranger

You seem pretty nice yourself