Abstract
I have been wanting to learn more about coding and DevOps recently. While I am not currently very good at either right now, I certianly have the tools to learn more and improve. This led me to wanting to make a project that assists in creating and managing virtual machines (VMs) and containers on my home server that runs FreeBSD. While it is easy enough to SSH into the box and do anything that I need to, it would be nice to have a web interface that I can login to and manage things that way. It would be even nicer to have one click app deployments similar to what a VPS provider like Linode can do. So, let’s try to build one.
Ideas
Obviously this is not going to be a project that can be done, at least not for me, in one blog post. There is quite a bit of learning that I will need to do, and a few different kinds of problems that I will need to solve. That is on top of all the design and architect decisions that need to be made before actually creating it. I do have a few things in mind that I would like to work towards:
- Runs on FreeBSD: This one probably seems obvious as we are targeting Bhyve (FreeBSD virtualization platform) and jails (FreeBSD container platform), but in my mind it is good to specify the target OS(s) in a project, as it wouldn’t make sense to target FreeBSD if I am writing a .NET app.
- As few dependencies as possible: While there is nothing wrong with depending on other packages and software (to some degree this is unavoidable), I also do not want to have Gigabytes of required packages to run this app. I know it is annoying for me when I am downloading new tools to try out, and I assume it is not any different for anyone else in the world.
- One Click Apps: I really like the idea of being able to press a button and deploy a database or a new Git server. I am not really sure how I am going to accomplish this goal, but I am thinking things like Ansible, Chef, or Salt Stack would probably be the way to go. It would also be cool to allow for custom one-click-apps.
These goals feel rather ambitious right now, but this is more of a learning project than anything else. If I fail, hopefully I learned something. If I don’t fail, maybe I will have made something really cool.
Setting Up Dev Environment
Before I really get started trying to do any coding, I need to get an environment set up to work in. Since I am targeting for FreeBSD, I will need a FreeBSD box to test in. So I will be setting up a FreeBSD 13.2 VM with nested virtualization enabled. Enabliing nested virtualization is pretty easy to get working, assuming your hardware supports it:
# For intel processors
# Unloads KVM kernel module
$ sudo modprobe -r kvm_intel
# and re-loads it with nested virtualization enabled
$ sudo modprobe kvm_intel nested=1
# For AMD processors
# Unloads KVM kernel module
$ sudo modprobe -r kvm_amd
# and re-loads it with nested virtualization enabled
$ sudo modprobe kvm_amd nested=1
This change can be made permanet by editing
/etc/modeprobe.d/kvm.conf
. Just add either
options kvm_intel nested=1
on Intel systems, or
options kvm_amd nested=1
on AMD systems.
From there, just install FreeBSD 13.2 as normal and start hacking away on the project. I will be giving updates on the project as enough interesting stuff to write about comes up.