What fits on a small VPS?

Let’s say you spin up a small server. Choose one from any VPS provider. I picked Digital Ocean because they’re more competitive in the lower end than AWS, Azure or Google Cloud. Let’s say your brand-new shiny VPS has 1 core, 1 GB of RAM and 25 GB of disk space. My question to you is this:

How many services that you’re currently using $BIG_BRAND for can you reasonably replicate on this VPS?

This article describes my attempts, but I’m curious to hear yours as well. Feel free to reach out to me on social media, or send me an email!

Hosting a website

So the most simple thing to do with your shiny new piece of Cloud is hosting a webserver. There’s several popular ones, but Apache or nginx are definitely the top 2 by a large margin. nginx is not just a webserver but also a reverse proxy. If you ever want to have public access to some process and you don’t trust it publicly (which is a good choice, random python webservers don’t have as much security measures), it’ll be trivial to make a subdomain or folder for that service, set up some authentication in nginx and map that subdomain / folder through to your server in the backend.

Certificates

However, certificates do come into play here. You want the connection between you and your webserver to be encrypted at all times, and that’s why TLS exists. If you want one certificate for ALL possible subdomains (*.kevinhill.nl), then you want to use DNS validation for your domain.

Good reading material on this:

In the rest of this post, I’ll assume you’ve gotten this working for at least one domain.

Email

Email is still one of the most popular ways of communication. Since it’s so ancient, everybody and their mother has some experience running a mail server. That means all software involved is battle-tested for several decades, but also that tutorials exist from decades ago which are horribly out of date. If you want to run your own email server, which may be a horrible idea for many reasons, you should be very careful. Furthermore, approach this with a mindset of “It may be fun to show this to friends, but I will NEVER use this in practice for anything important.” Even if you do everything correctly, your emails will not arrive when sent to hotmail addresses, maybe gmail addresses, and what your enterprise corporate mail solution does, nobody knows.

However, it’s still fun to play with it, right?

Many tutorials exist, I first played with several docker mail containers (which is hard on 1 GB of RAM) and eventually settled on the ispmail tutorial. It’s kept up to date throughout the years and sounds like exactly what you need in life when hosting your own mail.

Send me an email on your_name kevinhill nl.

Resources used

As long as you don’t use an antivirus scanner, you should be fine. Postfix, the mail sender, and Dovecot, the receiver, both run with very little resources. rspamd, the spam checker, uses only a few MB of RAM and very little CPU, as long as you’re using the mail server for only your own mail, or maybe a few friends. You do need a database, I’m using postgresql but mariadb or mysql are also fine. The database typically uses ~100 MB RAM but can also be used for other applications

Git server

As a good programmer, you’ve used github and gitlab before. However, wouldn’t it be fun if you could have that functionality without relying on their infrastructure?

There’s several git servers available for this purpose, I chose [gitea][gitea] because of it’s neat user interface and low resources. It uses about 60MB RAM and I’ve never seen it use a lot of CPU power except on startup. Disk space is no issue if you keep only source code in your repositories.

This server lacks CI/CD support.

Available on https://git.kevinhill.nl/

An IRC server

Okay maybe this isn’t something $BIG_BRAND provides for you, but still. An IRC server is nice to have. I’m using thelounge. Incidentally, it’s also the most expensive thing running on my server in terms of RAM, with about 200 MB in use just after startup. That’s not because it’s the only thing written in NodeJS, of course, but just an example of bad programming (/s). Also, as I configured it to save all logs to disk, it’s using about 7 GB of disk space because I’ve left it open for so long. I should clean that up.

Not publicly available because private mode allows persistence.

Mumble, a VOIP server

Although I’ve only used it once, it’s good to have a selfhosted voice server for when you need to talk to somebody and need to be absolutely sure nobody’s listening in. Except me, of course. Mumble.

PHP-FPM

When running any kind of PHP, and many many things are PHP, you need the PHP code to be evaluated. That’s typically done by telling nginx to pass any php file through php-fpm and show the results. FPM stands for FastCGI Process Manager, which means it’s a daemon that waits for requests and uses FastCGI to handle the requests.

Resource usage depends on your PHP application, obviously, but this daemon is very lightweight and consumes very little RAM in standby.

Battery Historian

So Google made a thingie. Honestly, this was mostly relevant about 6 years ago when I was playing with my phone a lot, trying to optimize power consumption etc. Nowadays, I don’t really use it. However it may be fun to analyze power usage and screen on time of your phone, if you want to.

It’s a Go webserver doing analysis over your phone’s log if you upload it.

Available on https://bathist.kevinhill.nl/

A Jupyter Notebook instance

What if you so desperately need python but don’t have your device with you right now? Jupyter is the solution, making terminals and notebooks available.

This is not publicly available since it allows remote code execution and I don’t want my server in the hands of someone else.

Conclusion

As you can see, there’s actually quite a lot of stuff that fits in 1GB of RAM. If you have any other good suggestions, please send me an email!

Sources