Selfhosted
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:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
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.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
view the rest of the comments
Just go nginx, anything else is faffing about. Busybox may not be security tested, so best to avoid on the internet. Php is pointless when its a static site with no php. Id avoid freenginx until its clear that it is going to be supported. There is nothing wrong with stock nginx, the fork is largely political rather than technical.
Absolutely, but it has a built-in webserver that can serve static files, too (I constantly use that in my dev environment).
But I guess you're mostly right about just using Nginx. I already have multiple containers running it, though. Most of them just serving static files. But it's ca. 50 megabytes compressed size each container just for Nginx alone.
How about Python? You can get an HTTP server going with just
python3 -m http.server
from the dir where the files are. Worth remembering because Python is super common and probably already installed in many places (be it on host or in containers).I once built a router in Python, but it was annoying. The much I like Python, the much I dislike coding in it. Just firing up a web server with it is no big deal, though.
I was even thinking of node.js, but this comes with a whole different set of issues. It would allow for future extensions of the project on the server-side, though.
What do you use for Node containers? I use an Alpine image where I install Node but I've been wondering if there's a better way.
Would be my first one. I'd likely go the Alpine route, too. It's used as option for the Docker official image.
https://hub.docker.com/_/node/tags?page=1&name=alpine
Having PHP installed is just unnecessary attack surface.
Are you really struggling for space that 50mb matters? An 8gb usb can hold thar 160x?
Yes! Especially running it's built-in webserver outside your dev environment. They "advertise" doing so in their Docker packages documentation, though. Every project without PHP is a good project. It's still an option - at least technically.
In a way, yes. I just want to optimize my stuff as much as possible. No unneeded tools, no overhead, a super clean environment, etc. Firing up another Nginx container just doesn't feel right anymore. (Even if it seems to be possible to manually "hack" file serving into NPM - which makes it a multi-use container serving various different sites and proxying requests.)
The machine I use as docker host also has a pretty low-end CPU and measly 4 gigabytes of RAM. So every resource not wasted is a good resource.
RAM is not the same as storage, that 50mb docker image isn't going to require 50mb of ram to run. But don't let me hold you back from your crusade :D
Thanks for educating me on basic computer knowledge! 🤣
Applications need RAM, though. A full-fledged webserver with all the bells and whistles likely needs more ram than a specialized single-binary static file delivery server.
Sorry, wasn't meant to be condescending, you just seem fixated on file size when it sounds like RAM (and/or CPU?) is what you really want to optimise for? I was just pointing out that they arent necessarily correlated to docker image size.
If you really want to cut down your cpu and ram, and are okay with very limited functionality, you could probably write your own webserver to serve static files? Plain http is not hard. But you'd want to steer clear of python and node, as they drag in the whole interpreter overhead.
I care about anything. RAM usage, file size, etc. I'm a minimalist when it comes to software. Use as less of all resources as possible. After once writing a router in Python I thought I could do this in Lua, too, but never actually tried. Maybe this would be a nice weekend project?
Even if Nginx is the way to go, I currently experiment with SWS which was suggested here. Technical aspects aside: The software is actively developed and the maintainer provides Docker images on their own (easy for Deploying a container based on that) and a package for my distribution (easy for development testing).
Well op look at it this way...
A single 50mb nginx docker image can be used multiple times for multiple docker containers.