this post was submitted on 26 Jun 2023
9 points (100.0% liked)

Selfhosted

40349 readers
550 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
 

Hey all,

Just wondering what the consensus is on hosting directly on a computer versus virtualization? Right now I'm hosting my Lemmy instance on a Hetzner VPS, but I would like to eventually migrate to my Linux box at home. It currently runs as a media PC (Ubuntu) in the living room, but I always intended to self-host other software on the side since it should be more than capable of doing both (Ryzen 5600G, 16gb DDR4).

I'm just torn though - should I host a virtual machine on it for Lemmy, or run it directly on Ubuntu as-is? I plan to do some further self-hosting projects as well later down the line.

top 11 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago

Run everything in docker containers. Much easier to manage than virtual machines and lighter on resources.

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

User accounts are a reasonable isolation mechanism for reasonably trustworthy server software.

[–] [email protected] 1 points 1 year ago

One thing I think about is isolation. Do you want/need to strongly isolate the software and its data from the host operating system?

[–] [email protected] 1 points 1 year ago (1 children)

Personally, I would prefer docker containers as I can move them to a new server or even create backups very easily.

[–] [email protected] 1 points 1 year ago

Backups are easily done with virtual machines as well. Taking, moving and restoring such backups is in fact much easier than moving docker containers between hosts as you don't have to differentiate between volumes and locally mounted directories for example. That being said, depending on the use case, containers can be a nice and lightweight solution to separate applications on a userspace level

[–] [email protected] 1 points 1 year ago

I run everything in docker compose and the two wins I feel like I get out of doing so are:

  • State in well-identified volumes. I've run multiple services on shared bare metal, and multiple services in isolated VMs. In both cases, I was equally terrified of upgrades and migrations because I frequently had no idea where in the filesystem critical data was stored. I would often have some main data dir I knew about, but little confidence that other important data wasn't stored elsewhere. With docker volumes, if I can restart a container without losing data I can migrate to a new host without losing data just by copying my volume dirs. And I restart containers frequently so I always have high confidence in my ability to backup, upgrade, and migrate.
  • Library and os-userspace isolation. This is the thing docker is known for, I never worry that upgrading a lib for app-a is going to break app-b. This is really a secondary benefit for me, though. I rarely had this problem even on shared metal with many apps, and never experienced it in isolated VMs. For me it's a secondary benefit to the nice volume management tools.

Docker is in no way unique in its ability to provide state management, but ephemeral container enforce good state management, and the docker tools for doing it provide a very nice experience, so it is my preference.

[–] [email protected] 0 points 1 year ago (1 children)

I have my Docker stuff in a VM. Much more reliable than bare metal OS

[–] [email protected] 0 points 1 year ago (1 children)

What exactly is reliable about it?

[–] [email protected] 1 points 1 year ago

Backups. Backing up a VM on hypervisor level (and restoring somewhere else) is easier and more reliable than lets say Veeam bare metal backup.

Also, snapshots

[–] [email protected] 0 points 1 year ago* (last edited 1 year ago)

You want so isolate the things you host from one another (security, making updates easier etc). So if you host just one thing you can do so on the host directly. If you host multiple services you may seek some separation method.

VMs is one method, but it wastes a lot of resources, especially RAM. A more elegant way is containers. Both the docker/podman route as well as the LXC way are quite polular.

[–] [email protected] -1 points 1 year ago

If you use a full VM you'll lose plenty of performance and I don't think it'll cope really well with domain names. If you really want to go the "keep everything separated" route use container software, like Docker. It'll use the same kernel as the host, so no weird networking rerouting/bridging etc.. I don't have any experience with containers, since I run all of my "homelab" bare metal on a Pi, and with this approach I never faced any issues. Containers could be useful if you were running something unorthodox like Gentoo and you need to run software that won't work on it, even if compiled to run, but it exist as a package on another distro. Then you can just spin up a container for that distro, install the software et voilà, you're ready to go. AFAIK there shouldn't be a package for lemmy on any distro, so just clone the source code and compile it, it should be fairly distro-agnostic. Maybe you could compile it in a container to keep your host clean of compile dependencies, but other than that, there's no real gain. I like to compile stuff, so having a shitload of dependencies already there is pretty handy for me, but for a production system, it's better to keep it clean.