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.

  • z3bra@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Using your home server as a VM host will put more load onto it. The idea of creating one VM per software (eg. Lemmy, a web server, and IRC bouncer, etc…) is a good idea in terms of “replaceability”, because you can easily upgrade OS, or restore a service to an earlier point in time, or redistribute resources, etc… The main downside is that you’ll add a big overhead to each service resource, as a VM require the full OS to boot. So if you run 5 services in 5 VM, the OS will consume 6 times more RAM, disk and CPU, on idling.

    If you can afford that, then do it ! It makes for a better separation of concerns and is definitely easier to maintain on the long run.

    Otherwise, you have two solutions. The first one is using containers. It’s just like the previous method, except that it won’t boot the full OS, and just start your service, using the already running kernel. Many self hosters use this method, so it’s well documented and very likely that you’ll find a container “package” for any service you might want to run. Note however that it adds another layer of complexity in terms of resource sharing (especially the networking part) that you’ll have to understand in order to secure properly.

    The last method is hosting your services directly on bare metal. This is the simplest method IMO, but it will get tricky when the software you need is not packaged for your distribution, as you’ll need to handle the service script and upgrades manually. This is however the lightest method regarding resource usage, as there is absolutely no overhead to running a service. And depending on the OS you’ll be using (in your case Ubuntu as it seems), you will benefit of a containerization like resource control thanks to systemd and cgroups (other mechanisms exists to control resources but this one’s fine).

    My personal preference goes to the last one (running on bare metal), but that’s also because I run OpenBSD as my main OS, which is definitely well suited for this method. I also do not like the docker ecosystem as I think it trades too mhm security for usability (but that’s a very personal take).

    In any case, happy self hosting my friend !