The Minimal Server
I was a sysadmin for a long time. I did that for money, so I never really wanted to spend time doing the same thing in my own time, which lead to a severe case of cobbler's children walking barefoot in my private server.
So, today at lunch, I decided to clean up my garbage. So this is what I ended up with, which is the minimal server that is good enough to be generally useful for me.
This is a cheap VPS provided by the nice folks at burst.net who are not giving me anything to speak nice things about their service. However, I will do it anyway:
- Crazy cheap ($5.50 but I have a 20% discount for life)
- Good amount of monthly bandwidth
- Lots of disk space
- Good uptime
- Fast network
- Very cheap
- Decent performance
I had CentOS 5 installed, and it stays. If burst ever starts offering Ubuntu Precise, I may switch. Or, since this works, I may not.
What's good about CentOS? It's stable and boring.
What's bad about CentOS? It's too boring. Lots of cool stuff just isn't packaged.
I need to serve a bunch of domains, but I have a peculiarity: they are all static sites. I want:
- Low resource usage
- Decent performance (that mostly involves supporting ranges and content negotiation)
- Support directory indexes
- Easy configuration
- Virtual domains by name
Almost any server works well for this. Even Apache, except for the easy configuration bit. I ended up with gatling because it fits those criteria fairly well.
- It uses about 1.4MB of RAM , which is always nice in a VPS
- It's pretty fast
- Has not crashed in 2 hours?
- Supports indexes
- Here's the configuration: "-c /srv/www -P 2M -d -v -p 80 -F -S" (yes, there is no config file at all)
- Virtual domains are just folders and symlinks inside /srv/www which is the easiest possilble way to do it.
- It supports reverse proxying for when I want to try a python web app I am working on.
No, I don't want a mail server. I have gmail and/or a real mail server for that. I want to get the mails from cron. For this, I used ssmtp and an extra gmail account. It works, and here's the whole config:
email@example.com mailhub=smtp.gmail.com:587 UseTLS=YES UseSTARTTLS=YES AuthMethod=LOGIN AuthUserfirstname.lastname@example.org AuthPass=notputtingthetrueoneheredude
The best I can say about this configuration is that it works, and doesn't involve running a daemon.
For when I need to be in two places at the same time: OpenVPN rules, and there is no argument. I have a squid running occasionally, and there is a Quassel core for IRC stuff. I installed mosh to make ssh less painful, rsync handles file deployment and backup storage, cron schedules stuff, and that's it.
Plenty of free RAM and CPU (yes, that's the full process list):
[root@burst1 ~]# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 2156 664 ? Ss 22:01 0:00 init  root 1135 0.0 0.1 2260 576 ? S<s 22:01 0:00 /sbin/udevd -d root 1518 0.0 0.1 1812 572 ? Ss 22:01 0:00 syslogd -m 0 root 1594 0.0 0.1 7240 1032 ? Ss 22:01 0:00 /usr/sbin/sshd root 1602 0.0 0.2 4492 1112 ? Ss 22:01 0:00 crond root 1630 0.0 0.1 5684 716 ? Ss 22:01 0:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2 root 1631 0.0 0.0 5684 444 ? S 22:01 0:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2 root 1636 0.0 0.2 3852 1372 ? S 22:01 0:01 /opt/diet/bin/gatling -c /srv/www -P 2M -d -v -p 80 -F -S root 1677 0.0 0.2 4284 1232 ? Ss 22:02 0:00 SCREEN /root/quasselcore-static-0.7.1 root 1678 0.0 2.1 36688 11148 pts/0 Ssl+ 22:02 0:03 /root/quasselcore-static-0.7.1 root 3228 1.0 0.7 12916 4196 ? Ss 23:28 0:13 mosh-server new -s -c 8 root 3229 0.0 0.3 3848 1588 pts/2 Ss 23:28 0:00 -bash root 3275 0.0 0.1 2532 908 pts/2 R+ 23:48 0:00 ps aux [root@burst1 ~]# w 23:49:03 up 1:47, 1 user, load average: 0.00, 0.01, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/2 126.96.36.199 23:28 0.00s 0.01s 0.00s w [root@burst1 ~]# free total used free shared buffers cached Mem: 524800 49100 475700 0 0 0 -/+ buffers/cache: 49100 475700 Swap: 0 0 0
All things considered, fairly happy with the result.