Live data from Hacker News

Self-Hosting Dozens of Web Applications and Services on a Single Server

cprimozic.net

1–10 of 285 posts

Re: Self-Hosting Dozens of Web Applications and Services on a Single Server

#3
Great post with lots of details. I'm sure I'll try some of tools mentioned.

We do something similar, multiple django sites and static sites on a single digital ocean droplet. We use docker for everything though, and have a single nginx listening on 80/443 that routes traffic to the sites by domain. Each site has a separate pg db and everything is glued together / configured / deployed via ansible.

Re: Self-Hosting Dozens of Web Applications and Services on a Single Server

#4
post #2

I went the opposite direction, 1 vm per service. It's much easier to secure, backup, restore thanks to full isolation.

I hope you don't use the VM snapshotting feature as backup method? I had problems when running a database service on it for obvious reasons.

Re: Self-Hosting Dozens of Web Applications and Services on a Single Server

#5
I (my company) use a similar approach: a single dedicated server with docker containers, by using dokku [0], for an heroku-like self-hosted PaaS.

Most of our applications are either:

- app developped in-house (django/flask): Procfile + deploy with git push

- standard app with a docker image available: deploy directly

Dokku comes with useful "service" plugins for databases, auto https (letsencrypt), virtual hosts... Overall, a good experience.

[0] https://dokku.com/

Re: Self-Hosting Dozens of Web Applications and Services on a Single Server

#6
Nice writeup, and at the core not too different from what I'm doing myself (albeit with the server at home, not colo'd, and the specs are far more modest).

The only thing I'd change in your workflow, perhaps, is switching from docker CLI commands to docker-compose. That'd make things a lot more reproducible and easy to read, and if you group relevant containers into a compose file, they're also automagically networked together, which is handy.

Your "trick" of grouping TCP ports by the hundreds is something I might steal, I've been using $lastport+1 for a while and now there's a bit of guesswork involved whenever I need to do things that don't go through the proxy. Then again, that's not often, so I might leave it.

Re: Self-Hosting Dozens of Web Applications and Services on a Single Server

#8
>I have all my HTTPS certificates issued + managed via letsencrypt. It's a terrific service; all I have to do is run snap run certonly --nginx every 3 months and everything is taken care of automatically.

Hopefully through cron and not manual invokation! Certbot can safely be executed daily by cron, as it will only attempt renewal if it is required.

Automating certificate renewal is an very important step in ensuring availability. I feel like part of the on-call sysadmin initiation process (pre-ACME days) was getting a frantic midnight phone call because someone forgot to renew a certificate...

I suspect they are using cron, but this has been omitted unintentionally.

Re: Self-Hosting Dozens of Web Applications and Services on a Single Server

#9
Nice write-up :) I'll probably adopt some of these fancy new tools like nginx or munin (that you call old) some day... still running good old Apache + php, postfix, dovecot, irssi, ... I think my box (in its various reincarnations, first as dedicated server, then as VM on a bigger dedicated server that I shared with friends, and now as cloud VM) has been running since ~2005. Now I feel old ;)

Re: Self-Hosting Dozens of Web Applications and Services on a Single Server

#10
post #4
post #2

I went the opposite direction, 1 vm per service. It's much easier to secure, backup, restore thanks to full isolation.

I hope you don't use the VM snapshotting feature as backup method? I had problems when running a database service on it for obvious reasons.

Nop indeed, I use the native backup tool to create a dump then use borg to save the backup in a remote location
Post reply on HN