this post was submitted on 13 Dec 2023
13 points (100.0% liked)

Self Hosted - Self-hosting your services.

14673 readers
7 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

Important

Cross-posting

If you see a rule-breaker please DM the mods!

founded 4 years ago
MODERATORS
 

I would like to have a mechanism to set up a server automagically…

Similarly I would like to set up my user account settings (Tmux plugins, .zshrc and vim settings, etc) that I can replicate in multiple machines via a script (I have a custom script for this but I want a more solid alternative)

Thoughts on what infra-as-code solution would work best? Any similar experiences or use cases with one Thanks!
Cc @selfhost@lemmy.ml @selfhosted@lemmy.world

all 21 comments
sorted by: hot top controversial new old
[–] Atemu@lemmy.ml 14 points 2 years ago

I would like to have a mechanism to set up a server automagically…

NixOS.

Similarly I would like to set up my user account settings

Home-manager.

[–] Voroxpete@sh.itjust.works 12 points 2 years ago* (last edited 2 years ago) (1 children)

"I want to automatically build VMs, networks, and other infra in the cloud using repeatable specifications."

Terraform

"I want to host my own cloud (either by paying for bare metal hosting, or providing my own) that I can deploy those VMs on."

Openstack or Openshift

"I want to automatically configure servers after deployment."

Ansible

"I want to deploy services to those servers in a simple, repeatable fashion."

Docker, Podman, or Kubernetes.

[–] johntash@eviltoast.org 3 points 2 years ago

You're probably looking for some sort of configuration management tool like chef, ansible, saltstack, or puppet. If you're not already familiar with one, ansible is pretty easy to get started with.

If you're also wanting something that can create the server itself, terraform is great and supports most cloud providers and supervisors.

[–] Moonrise2473@feddit.it 2 points 2 years ago (1 children)

If it's because you set new servers very frequently: Ansible

If it's because moving stuff once every two years to a new server is an hassle: everything in custom docker images

[–] taladar@sh.itjust.works 1 points 2 years ago (1 children)

If you don't update your Docker images for two years or more you are going to have even more security holes than if you had it all on the host system and didn't update that.

[–] Moonrise2473@feddit.it 1 points 2 years ago

I build the docker images every time I call docker compose, they should be updated

There's the huge bug that apparently they don't want to fix, is that it caches "apt upgrade" so I have to edit that line every once in a while

One day I will update my script to add a random commented char at the end of that line every time

[–] Zoe8338@lemmy.ml 2 points 2 years ago

Hey, please remember to tag your post! Thank you

[–] hanke@feddit.nu 1 points 2 years ago

Make an ansible playbook

[–] bouh@lemmy.world 1 points 2 years ago (1 children)

Why is infra as a code so sought after? I feel like this is installation scripts and config like bare bones, but you need another layer to make it work on top. What am I missing?

[–] taladar@sh.itjust.works 2 points 2 years ago (1 children)

Not sure why you would use it for a single server with a single admin you only install once but for multiple admins and many servers it provides repeatable results that are the same no matter who does it and it also allows you to add small settings that you would never do by hand every time you install a new machine. There is nothing worse than discovering that your dev system and your production system differ in a minor way that makes a test succeed on dev but fail on production because of something someone installed or configured manually. Well, apart from discovering that same thing happened with your 5 year old production server you are trying to reinstall after it broke.

[–] bouh@lemmy.world 2 points 2 years ago (1 children)

What I mean is that repeatability can be achieved in other, simpler ways. Like a package for example.

I feel like as technologies, ansible and docker have been spread beyond their relevant scope of usefulness. But maybe that's me.

I feel like ansible is a complex way of doing simple things.

[–] taladar@sh.itjust.works 2 points 2 years ago

Packages seem like a very convoluted way to achieve something like setting a host name or configuring the DNS server a system uses or the packages that are installed or which virtual hosts a web server serves and which certificates it uses to do so.

[–] thirdBreakfast@lemmy.world 1 points 2 years ago

Bare metal servers, VPSs, or VM's you host? If it's for VM's you host, then consider Proxmox as hypervisor and use VM templates. I'm sure old school sysops could to the same with QEMU and Virtmanager or something. But basically, I just set up a VM exactly how I like it, then convert it to a template and cookie cutter it out.

I can sense the Nix guys shaking their heads - it's on my list to try :- )

[–] MajorHavoc@lemmy.world 1 points 2 years ago (1 children)

I think you're looking for Ansible. Have fun!

The difference between an Anible playbook and a script, is Ansible has a 'check', 'change', 'verify' pattern, and is declarative (meaning that once the playbook is made, it tends to keep working on future versions of Ansible.)

[–] marx2k@lemmy.world 0 points 2 years ago (1 children)

Ehhh... as someone who does devops, you should dive into ansible core changelogs on github sometime ;)

[–] MajorHavoc@lemmy.world 0 points 2 years ago (1 children)

I assume you mean to check on his often they're is the breaking changes? :)

Declarative style isn't perfect, but it's a massive improvement from straight bash scripting.

[–] marx2k@lemmy.world 1 points 2 years ago

💯

We're an ansible shop and yeah it's better than bash scripting (where it makes sense) but ansible.. man it does have some peculiarities :/

[–] OddFed@feddit.de 0 points 2 years ago (1 children)
[–] ReversalHatchery@beehaw.org 1 points 2 years ago

Containers have to run somewhere too..