[HN Gopher] Self hosting in 2023
___________________________________________________________________
Self hosting in 2023
Author : michalwarda
Score : 116 points
Date : 2023-02-19 19:03 UTC (3 hours ago)
(HTM) web link (grifel.dev)
(TXT) w3m dump (grifel.dev)
| ktpsns wrote:
| 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 something with a
| page-only website and contemporary event based webservers. And
| thanks to SoC systems, energy consumption is a no brainer.
|
| [1] https://www.statista.com/statistics/1338657/average-
| internet...
| dkjaudyeqooe wrote:
| > self hosting a website from home in 2023 is as easy as it was
| in 2003. Get a DDNS, do the NAT port forwarding
|
| Did they have CGNAT in 2003? Because that breaks everything.
| flyinghamster wrote:
| Even from the client side, CGNAT can break a lot of things.
| I'm very glad that my mobile provider gives me IPv6 as well -
| that allows me to get to my home systems without any NAT in
| the way. Even hotspot clients get an IPv6.
|
| Of course, IPv6 is its own can of worms, but (cross my
| fingers) it's working for me.
| hsn915 wrote:
| That is not "easy". If it was, no one would be using cloud
| hosted sites like carrrd or squarespace or wix or whatever
| michalwarda wrote:
| Definitely. I'm just so used to the git pipeline flow that it
| would break my usual flow a bit too much :). That's why those
| new tools just make it so amazing! Especially combined with
| better and better ISP
| autophagian wrote:
| > if you want to Dockerize it, then Docker related stuff is
| required i.e. Kubernetes
|
| Yeah... I'm not surprised the author gave up on it, but you
| absolutely do not need to use k8s if you're dockerizing something
| like a blog. I'm a little baffled at this sentiment.
| michalwarda wrote:
| Yeah. Maybe I phrased it badly but I meant like more
| complicated apps than a blog :D
| autophagian wrote:
| Ah, gotcha! Even then, I've found i've gotten a pretty decent
| distance with docker-compose before k8s sounds like an
| attractive (or least bad) proposition
| schemescape wrote:
| I'd never heard of Coolify, but it looks like what I've been
| searching for, i.e. an all-in-one solution for hosting stuff on a
| VPS (or Pi). But the docs [1] say it requires a minimum of 30 GB
| of disk space.
|
| Does anyone know if that is accurate? What could possibly be
| taking up that 30 GB if all I want to do is host a static site
| and maybe Deno or Node? I'm fairly certain I set something
| similar up in the past on a much smaller MicroSD card...
|
| [1] https://docs.coollabs.io/coolify/requirements
| MSkog wrote:
| If you don't need/want a UI then Dokku is another option. It is
| more mature with things like built-in backups for the database.
| I've been a happy user for many years now. Coolify seems nice
| as well though.
|
| https://dokku.com/
| michalwarda wrote:
| I have a 32 GB SD card it's running on it no problem. It
| currently takes like 4 GB (it can store previous docker images
| for speeding up builds and allowing auto rollback).
| schemescape wrote:
| Thanks! That sounds much more reasonable. I wonder why they
| put 30 GB as the "Minimum required resources"...
| morpheos137 wrote:
| Linux is really bloated these days. I am confident you
| could self host a decent website on OpenBSD with less than
| a GB of disk space and several GB of RAM. It is really
| incredible to me how in 2023 we are doing basically nothing
| that could not be done in 2013 but it takes an order of
| magnitude more computing power. Serving a medium size
| website is not really that complicated unless you are hosts
| a bunch of videos or whatever.
|
| Stories like these just go to show me how much fat there is
| in Tech. The sector is in for a sharp reality check. You
| don't need 10s of gigs of RAM and 20 cores to host your
| blog or small business e-commerce site. But if you use the
| latest bullshit framework then maybe you do...
| antihero wrote:
| Astro be pretty chill if you want a no computation approach to
| making a website
| rambambram wrote:
| Question: were you forced to use a subdomain with your chosen
| method, or was selfhosting also possible on the main domain that
| you purchased?
| michalwarda wrote:
| Possible on both.
| ilrwbwrkhv wrote:
| This is amazing. More devs should build stuff like this for
| themselves. On the extreme one of the scale there is the amazing
| Andreas Kling building his own operating system. Building a whole
| system will give you unprecedented control and understanding.
| That is what being a hacker is all about.
| michalwarda wrote:
| And I have to say that this "physical" server running and
| seeing it just makes the experience of web developing much more
| "real". At least for me :)
| ilrwbwrkhv wrote:
| It is. I still get awe inspired that some markup I type and
| put on this disk here can be accessed across the world. Like
| I can physically touch the tape if I want to. It reminds me
| of how wondrous this whole thing felt like when I first
| discovered the internet in the 90s.
| bayindirh wrote:
| Having a server under your hand and deploying other things than
| webpages to automate your infra and life is a very underrated
| experience.
|
| I don't host my pages myself, but the server(s) I have power
| the _invisible_ infrastructure which accelerates my life a lot.
| shswkna wrote:
| Infra such as? Just interested out of curiosity. You can keep
| it vague if you prefer...
| bayindirh wrote:
| Well, nothing to keep hidden. DNSMasq, Syncthing, a tool
| which I developed that sends e-mails when things go wrong,
| etc.
|
| The resulting infra is hidden, because it doesn't flow
| through any popular services or something. You can argue
| that Syncthing is using public discovery servers, but you
| can put it on a small VPS, and you'll have a complete off-
| the-grid installation of it, too.
|
| I host it on an OrangePi zero, so it's unobtrusively small.
| It just vanishes somewhere at home.
| urbandw311er wrote:
| Does anybody know how you'd do this if your ISP uses carrier
| grade NAT? (Eg mobile dongle). My limited understanding is that
| with CGNAT there isn't a unique public IP that points to you,
| (even if only temporarily). So presumably DDNS is out?
|
| I guess IPv6 could/would solve this one day?
| watchdogtimer wrote:
| I use a Cloudflare tunnel, and set up my DNS at Cloudflare to
| route incoming requests through the tunnel
| fm2606 wrote:
| I self host and use a RPi 3B+. Actually I have a total of 3B+ but
| only one is actually doing anything for the website. I have my
| database running on a RPi 4b with 4gb. I could easily consolidate
| to a single Pi but early on I had different plans for each one
| but just keep 'em running for no good reason.
|
| I'm fortunate in that I have a static IP. Initially I was using
| NOIP and it worked great but then noticed my IP address never
| changes. Also, NOIP still exposes your actually IP which I didn't
| care for.
|
| Now instead of NOIP I rent a cheap $4/month VPS with nginx to
| reverse proxy to my home. This does require me to open a port,
| which again I'm not a huge fan but it is what it is.
|
| My next iteration will be where I close the port and do updates
| via SSH. I'm the only one who uses my website so it is more of a
| playground for me than anything.
|
| Finally, I feel setting up a server - or just interacting with a
| remote computer, be it across town, across the country or in the
| other bedroom, is a good skill to have. When I got my 1st remote
| job that gave me access to a server I was more than comfortable
| to do what I needed to do.
| michalwarda wrote:
| I'm planning on a similar setup and avoid exposing the network
| directly. Didn't have time to do that yet but I'll look into
| that this week!
| lost_tourist wrote:
| how would noip work if it didn't expose your ip? This statement
| confuses me. It's funny how used laptops that are 10x faster
| than an rpi4 are about the same price. Obviously they use more
| power though :)
| fm2606 wrote:
| At the time I set it up I didnt know what I was doing or how
| it all worked, etc etc, so that is where the statement about
| it exposing my IP came from. It has been so long that when I
| first set it up I may have known it was exposed but didnt
| care. As time went on I just didnt like knowing it was
| exposed. Why? I just prefer it not be. Not that it couldnt be
| found I am sure
|
| And you are absolutely right about the laptops and I have 2
| right now that are just collecting dust. But currently I have
| no reason to change to a laptop. It is kind of like driving a
| nail in the wall with a sledge hammer, sad to say a laptop is
| more than I need in a server at this moment. The only benefit
| I get from a laptop for my current needs is a built in
| battery backup.
| moritonal wrote:
| Have you considered using something like CloudFlare Tunnels?
| Hides your IP and let's you apply 2-Factor over services you
| expose.
| nucleardog wrote:
| I do similar with the VPS and reverse proxy, but use a
| wireguard tunnel from my home device to the VPS to allow nginx
| to hit my local device instead of forwarding a port.
|
| Avoids punching a hole in your local network, avoids issues
| when your home IP changes, and ensures nothing ends up going
| over the internet in the clear.
| fm2606 wrote:
| Ah very nice. I may do that instead. Thanks for the tip
| BenjiWiebe wrote:
| I'm doing that as well. I'm using an IONOS VPS since they
| have a DC close to my ISP's upstream, so less added latency
| than most VPS's.
| jarek83 wrote:
| For me google no-tool (as it often is just random score) shows
| 88/91 for the page. On subsequent run it's 95/100 though.
| threeseed wrote:
| One thing to be mindful of is security.
|
| The last you want is for your setup to be compromised, be used to
| send spam/botnets and then getting perma-banned from your ISP.
|
| I would argue it's a lot less risky just to put your static site
| on S3/Github etc.
| doublepg23 wrote:
| Indeed. My friend had a crypto miner put on his self-hosted
| server.
|
| This was merely weeks after telling him to switch to Tailscale,
| but it was a great learning experience.
| michalwarda wrote:
| As mentioned in the post. I would probably not use this setup
| with my more "exposing" projects like full web apps.
| layer8 wrote:
| Yeah, I would decouple it from any residential ISP, but use a
| $4 VPS to still self-host. That also removes the need for a
| DDNS setup. Given some basic Linux skills, all you need is SSH
| plus nginx+certbot on Debian with _unattended-upgrades_ or
| similar, that you can point your domain to.
| threeseed wrote:
| Would recommend Tailscale over SSH.
|
| Really easy to setup/use and means you don't have to open up
| ports like 22 which are constantly being port scanned.
| Entinel wrote:
| I really wish someone could convince me self hosting is worth it
| but more often than not it just seems like busywork. Do you
| really need to self host your static website? There is no real
| privacy gained and probably some security lost. Then you get into
| hosting more complicated apps, email, etc, and making sure you
| can access them from anywhere at any time and it just doesn't
| seem worth it to me.
| michalwarda wrote:
| I had a huge paragraph in the article about decentralization
| and how important it's in my mind for the future of internet
| but I've scrapped it because it felt like I was a blockchain
| guy even without mentioning it. So I'll make it simpler.
|
| Honestly I just feel awesome seeing those blinking lights in my
| room and thinking it's sending packets to other people.
| michalwarda wrote:
| I've spent some time on exploring the current self hosting scene
| after I got frustrated about pricings on different platforms and
| how absurdly complex certain stuff became. I'm happy to share it
| with you guys!
| j45 wrote:
| Proxmox and some great guides on GitHub might make life a lot
| easier for many people. I am astounded as how simple and point
| and click it has been.
| IncRnd wrote:
| The blog that you are currently reading has a perfect
| PageSpeed score 100 / 100.
|
| Unfortunately, no it doesn't. The page that has this blog post
| scored 95 in performance for mobile in one run and 86 in the
| next. It scored 91 for desktop.
|
| They'd get a higher score by adding text compression and by
| serving static assets (all of them?) with an efficient cache
| policy.
| Brian_K_White wrote:
| You were there looking over their shoulder when they wrote "At
| least at the moment of writing it", and are asserting they are
| lying?
| michalwarda wrote:
| Weird, shows up as 100 for me... I'll look into that though!
| Thanks for heads up!
| IncRnd wrote:
| You're welcome! I dislike the tool for this reason - it
| changes too much. Though I've found that the guidelines are
| very good for my sites.
|
| PS I get 100 consistently for your home page, so maybe you
| have an optimization there that can be replicated?
| jakelazaroff wrote:
| I see 95 mobile, 100 desktop. It's on the front page of HN, so
| presumably the server is taking a bit longer to respond to all
| the traffic.
| schemescape wrote:
| > Turns out in 21st century you can even update [Raspberry Pi]
| without downtime.
|
| Hopefully I didn't just miss it in the article, but... how?
| jacooper wrote:
| Kernel care is apparently free for the RPI
|
| https://tuxcare.com/patch-raspberry-pi-systems-without-a-reb...
|
| Also I thin you can use Ubuntu PRO on the pi, which includes
| Livepatch.
| MangoCoffee wrote:
| just get a cheapest VPS from lowendbox
| AdrienPoupa wrote:
| Self hosting is really cool. However when it comes to static
| hosting, apart than keeping your data at home and having fun
| setting up servers, I don't really see the point when there's so
| many free good options. I use CloudFlare Pages for my blog, their
| integration with GitHub is flawless and you get to host your
| website at edge for free.
|
| When I need to host dynamic content, another good option is
| CloudFlare Tunnels (I promise I'm not sponsored by them, their
| products are good is all :)), so you don't have to do shenanigans
| updating DNS records on the fly, and more importantly you don't
| have to compromise your network opening up and forwarding ports.
| vishal0123 wrote:
| Not to downplay the intent, but hosting static site is much
| simpler in something like github or netlify. Also in my area
| business internet with fixed IP is more expensive than what I
| would pay for decent enough cloud instance($50 vs $10).
| michalwarda wrote:
| Definitely simpler than setting up everything from group up.
| Though ATM I would argue that It would take me the exact same
| amount of time to get another app online :). Regarding IP, in
| the blog post further down I'm explaining that I also don't
| have fixed IP and how you can setup DDNS. Thanks for reading!
| [deleted]
| stjo wrote:
| With dynamic dns static IPs are not as critical. Most routers
| support them natively. What it does is quite simple - every
| time the router receives a new IP, it updates your dns entry.
|
| Not to mention that most "dynamic" IPs change only while the
| router is offline and your lease is up. So as long you don't
| power it off, it may not change for large intervals of time.
| RockRobotRock wrote:
| I have had my "dynamic" IP for two years now. I even managed
| to keep it when I moved to a new unit in the same appt
| complex
| nubinetwork wrote:
| My home network also seems to have no problem holding an ip
| despite being dynamic. I usually have to change the mac on
| my router before I'll get a new ip. In 15 years, I think
| I've only had it change unintentionally 2 or 3 times.
| infogulch wrote:
| Presumably you only need a fixed IP for email delivery. Public
| sites like blogs could be fronted by a CDN, and you can manage
| private sites behind a vpn like tailscale etc.
|
| I think a design where you rent a cheap $5-$10 vps with a
| static IP that forwards SMTP messages both ways through a
| secure tunnel to your personal mail server in your home would
| be a good starting point for self hosting.
| leerob wrote:
| Wanted to clarify some of the points raised about Next.js:
|
| > I've been using Next.js for a while and hosting the apps built
| with it on AWS with custom express servers. One day I've noticed
| that my servers are getting red-hot while doing almost nothing,
| and response times got huge.
|
| OP mentions they're hosting a static website _now_ but must have
| previously been rendering a server-rendered page. It 's not clear
| whether they explored the static-site generation support in
| Next.js, which would have avoided any regressions in server-
| rendering performance, making this a non-issue.
|
| > Long story short the library introduced a huge performance
| downgrade that was not caught by existing tests. > Because
| benchmarks were using only Vercel's (creators of NextJS) "Edge"
| infrastructure. And the bug was happening everywhere but not
| there.
|
| Indeed, there was a regression, but it was not due to lack of
| tests as a whole. The linked threads point to issues both self-
| hosting (serverful) as well as on Vercel (serverless). There was
| a week between a fix being reported through the opened issue and
| a fix being placed on a canary release. Regressions will happen -
| the best thing is ensuring more tests are added and things are
| fixed quickly.
|
| > We need alternative independent hosting to ensure that the
| community does not get stuck with a single provider.
|
| You can (and will always be able to) host Next.js, both
| completely static (drop files in an S3 bucket) or on a server
| (Docker, EC2, whatever you want).
|
| Just wanted to clarify those things. Your new site looks great,
| nice work.
| michalwarda wrote:
| Wow. Didn't expect a response directly from Next.js VP!
|
| Before anything I wanted to say that I love Next.js and I'm
| using it in my projects daily. It's definitely the best
| solution right now at the market for the project types me and
| my company is producing :).
|
| In regards to the inconsistencies in the article. Yes it was a
| server rendered page, not this particular blog. A much more
| complicated project.
|
| Also I didn't want to sound as if the regression was handled
| badly. Quite the opposite, as soon as I've pinpointed the issue
| and was able to create a good Issue in the tracker the response
| was very swift!
|
| And I understand that the regressions will keep on happening.
| I've been building apps for long enough to see waaaaay bigger
| problems slip into production. So no hard feelings!
| leerob wrote:
| I'm always looking to see how we can improve things.
| Appreciate your feedback! Let me know if you have any other
| questions in the future.
| Ayesh wrote:
| 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 disk speeds in SBCs, etc.
|
| Services like Hetzner have private servers for almost the same
| amount, which gives you faster storage, server IP addresses (for
| email reputation), DDoS protection, and a whole lot more to
| sweeten the deal.
|
| The only thing I self host today is a script that runs on my
| OpenWRT router, that uploads the probed data from my inverter and
| BMS to monitor my PV setup. I look forward to get rid of it too,
| once I get better BMS/Inverter.
| michalwarda wrote:
| As mentioned in the blog post. I wouldn't probably put a "real"
| production app on it so easily. You can replicate the same
| effect and more on a service like hetzner. But if you have a
| Raspberry Pi laying around and like 2-3 hours. At least a blog
| is enough! And the amount of hardware related things you'll
| learn is massive.
|
| I've been running a few web bootcamps in the past. Explaining
| the hardware part through cloud admin panels is extremely hard.
| Having a physical thing right in front of you is spoko simple.
| Much easier for people to *click.
| paxys wrote:
| Costs for hosting a static site or something with minimal
| computation is down to 0 at this point using any one of a dozen
| cloud/edge providers, so it's hard to compete with them on the
| basis of cost. The arguments for self hosting are really about
| having full control over your service stack.
___________________________________________________________________
(page generated 2023-02-19 23:00 UTC)