Live data from Hacker News

Self hosting in 2023

grifel.dev

211–220 of 307 posts

Re: Self hosting in 2023

#211
post #174

Earlier quoted context omitted.

Can you explain this please ? I have a netxjs based discussion forum in development. Is it as straightforward as issuing a command to pre-render and then the site re-hydrates via Apollo on it's own ?

Forums are dynamic so no you can't fully static deploy that

Yes this only works when you use JS to implement anything dynamic, user specific, requiring up to date (up to the second) data and so on. You can keep the static content fairly up to date.

For HN for example, you could prerender much of the content including latest comments and get Next to keep it up to date, cache invalidating as necessary. Basically have it rebuild static pages as posts are made. Then use fetch calls or maybe sockets to get the very latest posts and keep it up to date, even live updates if you wish.

ISR is the jargon here: https://nextjs.org/docs/basic-features/data-fetching/increme...

It is a bit like a mirror of what HN does. HN will use caching so that if you are logged out you get fast renders of pages. Instead of caching, you are pregenerating and keeping it up to date.

Re: Self hosting in 2023

#212
I'm selfhosting a few services (a small php website w/ blog & admin, a nextcloud instance, some small django websites, and my txt rants here: https://misc.l3m.in/txt/ ).

Why txt? Because I only have 600kB down & 200kB up, and even if I can share websites with images (webp) and other files (fonts, css...), my connection is too bad to be able to share this kind of content to hundreds of visitors, like the hundreds of visitors HN is bringing to my website when I share a post and it reach the front page (with a peak of 75k unique visits on a txt file in one day, that's nearly 1 visit per second, if 2 or 3 people are visiting some of my bigger pages, then my upstream connection is all taken by the visitors).

On top of that, robots that are crawling my websites are a real pain; out of the 7k requests I got yesterday on all my websites, nearly 6k are from crawlers (and 500 from bots trying to break my websites), that's ~75MB of data. Some of them are spamming my websites with 1 request per second for hours, so I created a new rule to ban them using fail2ban.

But even with all of this, selfhosting feel liberating ; I own my data, all of it is saved here in my house, I control my server (an old refurbished dell optiplex fx160 with 3 gigs or ram, an intel atom 220, and an old hdd of 500GB), and my websites are still faster than the vast majority of the web.

Re: Self hosting in 2023

#213
Sorry to be the "grumpy old man", but i don't get it.

In my experience, self hosting usually falls into two categories, people that "just want to host a simple static website", and "host all the things", and both are usually served better by using the cloud.

Most are in the category "i want to learn about self hosting", meaning they have (close to) zero experience, and while self hosting by itself isn't hard, maintaining a secure environment is, and that's where many people fail.

For the "simple static website", you can host it for free pretty much everywhere you like. Github pages, Azure static web apps, and countless others all offer stable, professional cloud servies for free, without the risk of exposing your network to the internet.

For the "host all the things", you see people attempting to mimic and entire data center at home, complete with monitoring, CI/CD and everything, and while i appreciate the learning experience, most people are blissfully unaware of the chore it is to maintain such a thing. Most of these services are better off being in the cloud.

- email is a likely thing people will want to self host, which is also perhaps the most stupid thing to do. First of all, it is a chore to keep your server off of various block lists, and you gain nothing but pain by self hosting it. Email is insecure by design. Every email has at least 2 parties, the sender and the receiver, and with >50% of the worlds recipients running on Google/Microsoft/Yahoo/whatever, your email will get indexed. A much better alternative is letting someone who knows what they're doing host your email, and use a personal domain. That way you can move your MX records if need be, still maintain your email address if changing provider, and let someone else deal with the problems of running the service. If it's privacy you want, use something else, or use encryption. In both cases, self hosting gives you nothing additional.

- cloud storage is another contender, and the most common "excuse" is that cloud hosting is too expensive, and yes, if you plan to store 200TB in the cloud then it is, but maybe instead you need to look at which files are needed when away from home, and use the cloud for those, and leave the rest at home, accessible by VPN if need be. If you need privacy with cloud file hosting, something like Cryptomator (https://cryptomator.org/) is much easier/better than maintaining your own server. (as a side note, you can get around 20TB of cloud storage for €20/month, or roughly the price of the electricity required to run a 4 drive NAS for the same time, but not including cost of hardware).

Not matter your setup at home, you will never create something as resilient as the major cloud datacenters. i.e. OneDrive (paid version) stores your files across multiple geographically separated data centers, using erasure coding, so if one data center dies, your files are still available in another center, and hastily being replicated to a third center. It uses atomic writes (like CoW filesystems, ZFS, Btrfs, APFS, etc) to ensure data written is correct, and has checksumming (inherent in the erasure coding), as well as versioning of files (OneDrive has unlimited file versioning for 30 days rolling), meaning you get at least some ransomware protection.

So in the end, most people are way better served by putting their stuff in the cloud and encrypting it, than they are exposing insecure services from home.

By all means, build the cluster at home as a learning experience, but save yourself some trouble and keep it within your LAN. If you need to access it externally, use a VPN instead. With modern VPNs like wireguard, there is very little overhead, and your data will thank you for it (as will your family as you suddenly have a lot more time to spend with them!).

Re: Self hosting in 2023

#215
post #5

If you don't need all that cloud operations/deployment infrastructure, self hosting a website from home in 2023 is as easy as it was in 2003. Get a DDNS, do the NAT port forwarding, run some apache/nginx/whatever and push your files with sftp or similar to the server. In contrast to 2003, upstreams got better -- even Germany has average upstream speeds of 20mbit/second nowadays [1]. With 20mbit/sec you can do quite s…

I would argue it is much easier now. There are a ton of distributions who are catering for this use case, yunohost is probably the most well known one, but there are a lot more if you look on the awesome selfhosted list. I would also say that if you only want a static site the OPs setup is almost overkill. Just install caddy and a dyndns service. Takes care of the certificate for you and is super simple to setup.

Yeah, cloudron is a other distro for this use case.

Re: Self hosting in 2023

#216
post #118

Earlier quoted context omitted.

Random http traffic seems about as harmless as it ever was, if you just host static pages, or your own scripts/software and nothing generic. What's a bit iffy is the privacy aspects. If you host anything that can identify you, your identity is just a HTTP request away for anyone who sees traffic from your IP address. But these concerns can be somewhat mitigated by making the server drop connections unless a known Hos…

> If you host anything that can identify you, your identity is just a HTTP request away for anyone who sees traffic from your IP address. run it behind Cloudflare

Not sure why I'd let some US company see all the traffic, if the same goal can be achieved other way and the goal is privacy...

DDoS is probably mitigated at residential ISP level. At least I never had to deal with it with the current ISP I had for 14 years, and I had like 10 MBit/s upstream bandwidth most of that time.

Re: Self hosting in 2023

#217

Man, I feel like sometimes people forget the 1990s. I was there, running an Apache service and whatnot. It sucked. Cost a lot of time, and really, fiddling with firewalls and Apache configuration didn't teach me much. All hail PaaS and the like. I'm not looking back.

Meh... Even the best PaaS platforms are child's play compared to advanced declarative configuration systems like Nix. One file and I can recreate my multi box self hosting setup. Why would I bother with a platform with a bunch of state?

One Docker compose file and ...

Most PaaS type offerings for Web dev separate state and code. I can destroy and redeploy a whole cluster in two commands

Re: Self hosting in 2023

#218

I'm selfhosting a few services (a small php website w/ blog & admin, a nextcloud instance, some small django websites, and my txt rants here: https://misc.l3m.in/txt/ ). Why txt? Because I only have 600kB down & 200kB up, and even if I can share websites with images (webp) and other files (fonts, css...), my connection is too bad to be able to share this kind of content to hundreds of visitors, like the hundreds of v…

Your txt site are really similar to mine: https://wiki.chungn.com/

I found it's really nice to store those text data in txt files instead of a database.

Re: Self hosting in 2023

#219
post #36

I'm still not convinced that self hosting is cheaper though. Where I live, both the electric grid and Fibre connections are unreliable, and the ISP charges about $3/month for a static IP. Assuming 2.5W for a RPi, it takes 1.8kWh a month, costing around $0.25 for electricity. This also has the downside of using residential IPs, having to deal with CGNAT/NAT if the ISP has no static IPs, exposing your home IP, slow dis…

> Assuming 2.5W for a RPi, it takes 1.8kWh a month, costing around $0.25 for electricity.

Note that it's virtually free in winter (or cheaper if you have a heat pump or only heat during off-peak hours) as the energy used by the RPi is that much energy not consumed by heaters

Re: Self hosting in 2023

#220
Self-hosting is weird. I hear a lot of people say it's so much work, but I put like an hour a month into my server at most. I think it's mostly fine from an administrative standpoint, as mentioned elsewhere, not much has actually changed from 2003. You definitely don't need kubernetes. If anything, I think most of what's changed since then is that there's been a flood of bad sysadmin advice making people believe they need cluster management stuff on a single computer. Cattle is plural. What you've got is a pet. Love it and it will love you back.

I host a lot of weird crap on my living room server including a publicly available Internet search engine, and server administration wise it's not a lot of work at all. The search engine requires a fair deal of babysitting, but that's on me for building shitty admin tools.

It's also great to have a beefy always-on computer to run compute jobs flooring all cores of the CPU for 200 hours on and not have to worry about bills later. Like I can't recommend this enough. There's so many cool projects gated behind taking more than a few hours to process.

What does give me a hassle is hosting stuff I didn't build myself though. Like gitea. Got a bunch of bots signing up creating spam profiles. I think as a rule I'd recommend against hosting anything that offers comments or sign ups. Cloudflare helps, but only just.

Post reply on HN