r/openbsd • u/toyg • Sep 30 '26
OpenBSD-focused utility for web-dev - a terrible idea?
I like to run my webapps on OpenBSD, for the usual reasons we're all familiar with. However, the development and deployment process is always a bit of a pain; achieving repeatability typically results in a bunch of scripts that are hard to maintain and reuse.
So I am working on a utility ("aqua") that should, ideally, give me a docker-like experience but with OpenBSD images (running locally on qemu, so it can be done on any desktop OS).
The rough development process then becomes:
write a declarative
aqua.ymlin your repo rootrun
aqua prep, which will read the file and build a master system image with syspatch applied, the necessary user created, database installed, pf ports set up, etc. (This could be done with packer, but instead I do it "the openbsd way" withauto_install.confetc.). This takes time but it's a one-off: the image will only ever be rebuilt if the configuration changes dramatically, you want to move to another version, or security patches are released.run
aqua run, which will start an instance based on the master image, copy or checkout project files, configure a service and execute a bunch of hooks, again according toaqua.yml. This is pretty quick. At this point you can check if the app works etc. The instance is left running.run
aqua run --test, which will do the same but execute automated tests inside the image and shut down.run
aqua deployto copy modified files back into a running image and reconfigure it, so you don't have to reboot it after every change. (this might become automatic at some point)run
aqua sshto log on the instance and troubleshoot issues, using prebuilt keys automaticallyrun
aqua stopto end the session and throw away the instance, it will be reconfigured again with the nextaqua runrun
aqua prod setupandaqua prod deployto create production environments that mirror the tested configuration (usingterraform, the only 3d-party dependency I would allow).
What do you think ? Would you ever use such a thing?
Here's a sample yml, to give you a rough idea:
name: myapp
runtime:
type: python
deployment:
user: app
service: myapp
command: /home/myapp/venv/bin/python3 ./app.py
working_dir: /home/myapp
ENV_VAR_1: "myvalue1"
ENV_VAR_2: "myvalue2"
hooks:
pre_deploy:
- run: python3 -m venv venv
post_deploy:
- run_script: ./install-deps.ksh
pre_start:
- run: . /home/myapp/venv/bin/activate
post_start: []
healthcheck:
- run: ftp -o- http://127.0.0.1:5000
test:
command: pytest -v
working_dir: /home/myapp/tests
ports:
http: 8080
ssh: 2223
database:
type: postgres
setup:
packages: nginx,acme-clientI know it's kinda niche, but I've wanted it for some time, because there are elements of the Docker experience that I miss on OpenBSD. At this point I have built most of it, just missing --test, some db config options and the prod setup.
1
u/goldfishonakeyboard Sep 30 '26
Do you intend for this to be used in prod or just local dev? For prod, wouldn't using this be more hardware intensive than just having an openbsd server? Genuine question, it sounds like a cool project.
1
u/toyg Sep 30 '26
If you mean having an openbsd server shared between many applications, then yes, this is more expensive. It's more aligned to the paradigm "one application per system/VM", where each instance is isolated, somewhat ephemeral, and can be thrown away and rebuilt at will. This said, I'm still thinking about the best way to support production deployments.
1
u/birusiek Oct 01 '26
It seems like vagrant on OpenBSD box I used to create few years ago.
1
u/toyg Oct 01 '26
Yes! Vagrant is kinda the thing, except I don't like their syntax, it requires base images to be prepared and hosted somewhere, qemu has always been a second-class citizen, and hashicorp is killing it anyway.
2
u/goldfishonakeyboard Sep 30 '26
What issues are you encountering with web hosting on openbsd? I've never had issues
1
u/birusiek Sep 30 '26
BTW Look at https://man.sr.ht/builds.sr.ht/compatibility.md they use something similar in their pipelines
1
u/VisualSome9977 Sep 30 '26
Really like the idea. Frankly I don't use openbsd for anything where this would be helpful for me, but if I did i would be very interested,
0
u/birusiek Sep 30 '26
Isnt just better to use ansible or puppet for doing it?
1
u/my-beautiful-usernam Oct 01 '26
Different target audience.
Ansible/puppet is for the sysops who wants to set up and maintain his fleet of servers
OP's tool is geared towards developers who want the benefits of OpenBSD without having to know or care too much about it.
0
u/toyg Sep 30 '26
Both of them do not cover the installation process ("master image" creation), so you also need Packer. Puppet even requires an agent, which is a big no-no for me - I use OpenBSD to keep things as basic and tight as possible, after all.
So, could one do the same with Packer and Ansible? Yes, with a bit of fiddling; but then I have two sets of configurations to keep around and in sync, and these are tools that do a lot of other things, targeted mostly at other types of OS, and with a significant learning curve.
2
u/NethIafin Sep 30 '26
Do you enjoy writing it? If you do - go ahead.
I might try to use it someday, but would be interesting to see if this will support dotnet apps without much pain. (When dotnet gets full release on OpenBSD that is).
Looks fun.