20
Some setup notes for self-hosting a Lemmy instance
(10291998.xyz)
Hey; I just got a Lemmy instance up and running. I'd like to share some tips and things that helped me along the way.
I used the Ansible installer found here. Just following the instructions is pretty clear if you've ever set up a server before. I did have a couple of hickups though:
- In the
hosts
config file, there's a like that says "myuser@example.com
: replace with the destination you use to connect to your server via ssh."" There's a typo down below where there is nomyuser@example.com
, it actually saysexample.com
instead. Do replace it with your username and domain. - The
customPostgresql.conf
DOES need to be tuned for your server memory and CPU; the default did not work for me - When it says
Configure a DNS A Record to point at your server's IP address.
it means you need an IPv4 address for your server. Unfortunately, this means you can't use the cheapest Vultr tier at $2.5/mo, but you have to use the $3.5/mo instance at least. - I used the $5/mo Vultr instance instead of $3.5 because 512MiB of RAM caused my server to run out of memory and start killing processes. For some reason nginx would be the first to go.
- Speaking of nginx; it was not configured to start on startup for some reason. A quick
sudo systemctl enable nginx
fixed that. - To diagnose the memory issue; I had to go
docker ps | grep postgres
, get the hash/ID for postgres, then dosudo docker logs 5115641fc0b2
to see the logs - To see the server logs, the
/srv/lemmy/<domain name here>
is where the docker-compose.yml file is, so if youcd
into this dir, only then can you rundocker compose logs -f lemmy
ordocker compose logs -f lemmy lemmy-ui pictrs
to see the lemmy logs - Sometimes, pressing a button in the config menu doesn't do anything. Generally, it's a backend issue and not a frontend one, but the front-end does not tell you that anything has gone wrong. If you "Inspect" and open up the console in your browser, you'll see the server request done and you can see the response.
- I was surprised to learn that you can't make a federated AND private Lemmy instance. I guess it makes sense? I kind of want to save on server bandwidth/resourse by being the only user though...
- My ISO of Debain did not have a swap file or partitioned any swap space. Create a swap file and make it permanent through the following commands:
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
and then editsudo nano /etc/fstab
and add the line/swapfile none swap sw 0 0
. Without the swap Lemmy would crash the server.
Anyways, hope these notes help someone! If you've got any tips I'd love to hear.