logoalt Hacker News

Serving a website on a Raspberry Pi Zero running in RAM

227 pointsby xngbuildsyesterday at 3:10 PM91 commentsview on HN

Comments

c0nsumeryesterday at 4:03 PM

This feels a little weird because while they are running the website itself (HTTP) off the Pi, they are handing off all TLS to a cloud provider.

So while the content is in RAM on the Pi, a lot of the heavier lifting (TLS termination) is done elsewhere, which saves a ton of CPU load on the Pi.

show 7 replies
jcalvinowensyesterday at 4:16 PM

I have a self hosting Pi Zero W running Gentoo. It started as a joke, but I kept it because it's actually occasionally useful for testing new kernel releases.

I found a fun bug with it a couple years ago: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...

It is still able to build software faster than it is released. It takes roughly a month to recompile the entire system :D

show 1 reply
tomaspiaggio12today at 1:59 AM

maybe i'm being stupid, but what's the complexity behind this? why is this exciting? is it because it's running on memory or because it's running on the pi? i find this trivial unless you're a new engineer.

for the ones that say that the pi can't handle tls that's just stupid. that's trivial as well.

for the ones saying that you need a vps how cloud native are you people? you can just expose a port on your router (if you're brave enough) and have any dynamic dns service point to the correct ip address.

show 1 reply
seemazeyesterday at 4:54 PM

I've been using Raspberry Pi Zeros for cheap little linux appliances since they were released. Boot them up with the latest Alpine Linux and run the whole thing from ram. You can also remove a card from a running machine with no ill affect, and they easily survive power cuts. I've never had a card fail.

MitPittyesterday at 3:42 PM

A raspberry zero is more powerful than an enterprise server from the 1990s. A minimalist static website is not impressive. You can fit way more in there.

show 6 replies
dividuumyesterday at 7:21 PM

I guess "Diskless" was defined by the same people that invented the term "Serverless"? That Pi is still using an SD card to boot from.

A Pi with Ethernet can truly boot diskless via TFTP. And later Pi4 and Pi5 can even boot directly from the internet by getting their initial "boot.img" FAT partition via HTTP from anywhere. That would be diskless.

show 1 reply
FlyingSnakeyesterday at 8:17 PM

PiZero is a pretty solid machine.

I run my micro-homelab on a Pi Zero from 2018. It’s behind Cloudflare tunnels. It runs the apps i need on a DietPi OS within 180MB and it’s uptime is ~8 months.

show 1 reply
spharsyesterday at 3:59 PM

The OP link is not to Pi zero website, here's the actual website that's being hosted on the Raspberry Pi:

https://zero.btxx.org/

vednigyesterday at 5:01 PM

we're running a complete production grade cloud storage service with Raspberry Pi Zeros at https://getcloud.doshare.me that's how powerful Rpi hardware we've tested it for upto 10k concurrent requests with storage ofcourse, but still too far powerful

fdjafhdasfjhdsyesterday at 4:36 PM

RAM? In this economy?!

_stiofanyesterday at 4:36 PM

The pi zero's are great. I have a bunch of them. I used to use them as a tiny server for live webcams streaming to YouTube for customers, but YouTube now have a minimum sub count before you can go live, which sucks. These boards are pretty powerful.

show 1 reply
basilikumyesterday at 7:00 PM

The Pi Zero has 512MB RAM and a one GIGA Hertz CPU. It's a fucking super computer. Maybe not today, but not that long ago and back then people were running much more intensive things on them than hosting a website. It should be perfectly capable of handling TLS. AES might be a bit haeavy without hardware acceleration, but you can also do only ChaCha20 as the single supported server cipher. It would be easy to DDOS, but you should be able to mostly address that with firewall rules rate limiting connection attempts upstream.

I don't mean to shit on this, exploration is nice and putting perfectly fitting hardware to use instead of throwing abundant unnecessary hardware on every simple problem — just to bring it to crawl with loads of shitty bloates software — is good, but it's not particularly impressive.

backtogeekyesterday at 8:02 PM

Brilliant write up, just 1 correction, the TierHive VPS should only be $1.20 per year not $4 :)

doginasuityesterday at 5:59 PM

For optimal moral support, have one of the spare Pis holding a sign, maybe "Pi is our guy"

ritcgabtoday at 2:54 AM

People run websites on a VPS with 32MB RAM decades ago and it was fine. What is new about this?

Venn1yesterday at 4:42 PM

They are powerful little devices. I used a Pi Zero 2 with an ethernet adapter to host an x86 TrackMania² server using BOX64 and it never had a problem. Only swapped it out recently because I needed the Zero 2 for another project.

coolThingsFirsttoday at 9:28 AM

In which country does OP live where their ISP permits them to host a website?

corvadyesterday at 11:52 PM

I mean yeah, but the Pi Zero can also do TLS and much more complex tasks so I really don't understand why this is such a big "feat." It's a linux pc just running a webserver. Am I missing something here?

slow_typistyesterday at 6:30 PM

Instead of having an open port in my router and sending data in plain text, I would use an ssh tunnel or a vpn. Or probably put the entire web site on the VPS.

orliesaurusyesterday at 5:07 PM

So what benchmarks did you run or what's the advantage? Might as well just run the site on the VPS at this point since you're paying for it?

grahammccainyesterday at 8:22 PM

I’ve wanted to get into raspberry pi builds for a long time. Off to order one now and try this.

mxkuznyesterday at 10:05 PM

Nice writeup. darkhttpd + tmpfs is a clean minimal stack — the diskless approach is also a quiet win for SD-card longevity, which usually the first thing to die in long-running Pi setups.

wolvoleoyesterday at 4:54 PM

Umm some people run a website on a conmodore 64. That's impressive.

A Raspberry Pi Zero can just run apache.

starik36yesterday at 5:43 PM

I have several of these running all sorts of quickie utilities. The key for making things faster (at least for my tasks) was to write everything I need in c#.

For whatever reason, the speed seems far faster than Python for me.

jcgrilloyesterday at 4:17 PM

After seeing what new R-Pi stuff is selling for I went rummaging in the parts drawer and found the following:

- R-Pi Zero W

- Sixfab UPS hat

- Sixfab Cellular IoT App Shield

- R-Pi model 1B

With all this I should be able to make a multiply redundant always-on bastion host. It's awesome that alpine supports the armhf stuff, many OSes have dropped 32bit support entirely.

show 2 replies
tonymettoday at 12:49 AM

the zero is the coolest PI imo . You can run nearly any network service on it. Great for adguard or pihole. Smokeping. Lots of fun stuff. Supports usb Ethernet too

sam_lowry_yesterday at 5:31 PM

tell OP about tftp

129x_spacetoday at 12:44 AM

[dead]

fukinstupidtoday at 4:53 AM

[dead]

fukinstupidtoday at 4:53 AM

[dead]