News for hackers. Stuff that matters.
Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @01:48PM (#33166422)
Speaking as someone who hosts multiple websites, email, etc. in the corner of a room

> [it should] be reliable if I kick a cable out of the wall

Right, if you want it to be reliable but also be able to cut its cables, then you will need a secondary host outside the home.

> or in the unlikely event that I get a bunch of traffic.

Are you serving media (music or video of more than a few seconds)? If not: DSL or mobile data (if your data cap allows) is fine for HN front page. Judging by the current page weighing 100KB, you can have 10 visitors every second at 1 MiB/s upload. (HN reaches that rate only in spikes, even at a top three position.)

> I’d also like it to be quick!

It's currently not quick at DigitalOcean (2 seconds for TLS setup, 12 seconds for HTML, 8 seconds for JavaScript, etc... 27 seconds total). It can only get better!

I can recommend something beefier than a raspberry pi, though, or at least than than the pi 1-3 speeds that I'm used to. I personally use an old laptop which is plenty fast for, well, anything you'd also ask of a daily driver, except it now doesn't need to render a GUI which speeds things up a lot. They can peak up to 100W depending on the model, but are usually very low power when nothing is being asked of them.

> Oh, and I don’t want to have my home network hacked.

Then install unattended-upgrades, put admin panels (phpmyadmin, wp-admin) behind basic authentication, don't host things you don't trust (random code written by 'someone on the internet' that has never been tested by anyone), put it in a VLAN if you want to be extra cautious, and you'll be fine. It never hurts to keep your phone and other systems on the LAN up-to-date anyhow so they should be secure as well, even if someone does get in.

Re:I wish my web server were in the corner of my room by adhoc_slime on Tuesday October 11, 2022 @02:10PM (#33166807)
Pretty much! As engineers we all sweat sleepless nights mulling over five 9's and we conflate these valid business needs with our hobbies and personal art/projects.

It doesn't have to be this way! Put it on a pi and have fun, if not for your sanity at the very least do it for your second most valuable resource, your time. If all a person wants to do is have a website that plays a piezo buzzer when someone visits on your RPi, just write that damned code, they shouldn't feel the need to worry about all the nitty gritty when all that they wanted to do is have fun!

Re:I wish my web server were in the corner of my room by marginalia_nu on Tuesday October 11, 2022 @04:08PM (#33168592)
89.9999% has five nines too, just sayin' ;-)
Re:I wish my web server were in the corner of my room by BizarroLand on Tuesday October 11, 2022 @04:28PM (#33168820)
0.99999% as well
Re:I wish my web server were in the corner of my room by NaturalPhallacy on Tuesday October 11, 2022 @05:39PM (#33169576)
~3.65 days of a year. I suspect a lot of small projects nail this.
Re:I wish my web server were in the corner of my room by ohgodplsno on Wednesday October 12, 2022 @01:31AM (#33173243)
Hey, that's my Raspberry Pi when I find this one thing that looks fun, try it out and give up a few days later. Extremely efficient uptime, it's 100% when i need it.
Re:I wish my web server were in the corner of my room by imhoguy on Wednesday October 12, 2022 @03:44AM (#33174042)
Look how much electricity we would save if many unused servers would turn on only when users actually need them. We need WoL via browser. https://en.wikipedia.org/wiki/Wake-on-LAN
Re:I wish my web server were in the corner of my room by RealStickman_ on Wednesday October 12, 2022 @06:12AM (#33174900)
You mean spinning up resources as needed?

I think I've heard of some services like that...

Re:I wish my web server were in the corner of my room by marginalia_nu on Wednesday October 12, 2022 @06:16AM (#33174931)
That's more like billing resources as needed, rather than actually spinning them up. The resources are always spinning.
Re:I wish my web server were in the corner of my room by imhoguy on Wednesday October 12, 2022 @06:48AM (#33175138)
Yep, exactly that. I know most of HW can go on power-save on idle states, but still drawing some 5-15W of energy doing nothing. We need some kind of "e-ink" for web resources which doesn't change much but just need to be reached occasionally/on-demand, with a slight unsuspend delay of course.
Re:I wish my web server were in the corner of my room by birdyrooster on Wednesday October 12, 2022 @03:11AM (#33173833)
When a bunch of people ping you because the Plex isn't running right, you find that obsessing over the 9s early saves you headaches.
Re:I wish my web server were in the corner of my room by iso1631 on Tuesday October 11, 2022 @02:53PM (#33167540)
> I personally use an old laptop which is plenty fast

If connected on wifi to your router this of course solves the "kick a cable out" problem too, even if the battery is really old you'll almost certainly still have a few minutes.

> Then install unattended-upgrades, put admin panels (phpmyadmin, wp-admin) behind basic authentication

I'd go as far as protecting the directory to only allow access from local network, and use wireguard to reach the machine.

It's likely a server in the corner of the room will cost more than a VPS, certainly in my country. A server drawing 25 Watts cost more than the $3/month I pay. (That said I also have a pihole running on a 1B - my parasitic house load is about 100W for the fridge, router, wifi, etc)

Re:I wish my web server were in the corner of my room by LeifCarrotson on Tuesday October 11, 2022 @03:13PM (#33167841)
> I'd go as far as protecting the directory to only allow access from local network, and use wireguard to reach the machine.

Or, you know, only allow access from the attached hardware and reach the machine the old-fashioned way: By walking.

Regarding costs, it's useful to know the cost of a watt: For my electric rates, the equation runs:

    $0.11/Watt-month = $0.162/kWh x 730 hours/month / 1000 kilowatts/watt
So at least in my area the 25W server would not quite cost more than $3/month.
Re:I wish my web server were in the corner of my room by makapuf on Tuesday October 11, 2022 @03:45PM (#33168294)
I roughly equate 1W ~ 1$ / year, a bit more now.
Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @04:23PM (#33168753)
I thought I had made a mistake when I calculated the cost of 100W incandescent lighting to be the awfully coincidental number of almost exactly 100€/year. Finding this to be correct was quite the revelation: makes estimating the cost of anything in the house so easy because I already knew the wattages :)

(The landlord had installed these sensor-activated ancient bulbs in the hallway, where I pass through to to the cellar / power meter, and I was trying to track down this mysterious 100W that seemed to be always running, without fail. Turns out, it was only running when I was checking the meter! We then did the math with a better runtime estimate and still went out to buy LED bulbs at our earliest convenience. They're brighter than before (we erred on the high side), just as warm light, and use 2.5x less power.)

Re:I wish my web server were in the corner of my room by parminya on Tuesday October 11, 2022 @05:22PM (#33169403)
No matter how common it is, I never know what "2.5x less than some reference number" means. Is it "divide the reference number by 2.5"?
Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @07:37PM (#33170693)
Correct, i.e. 40W instead of 100W. It sounded more impressive than "40% of the original value" so I went with "2.5x less". Not the best measure to choose one's words by, admittedly.
Re:I wish my web server were in the corner of my room by iso1631 on Thursday October 13, 2022 @02:07PM (#33194436)
40W LED? Wow that's big! I think the biggest LED bulb I have is 11W
Re:I wish my web server were in the corner of my room by lucb1e on Thursday October 13, 2022 @06:39PM (#33197402)
2x20 (notice plural 'bulbs' in the original message a few steps up the thread), and this is actually measured whereas iirc the box said a bit less

And yes, in my opinion we erred on the high side, but it's not far off from what the original incandescent (which apparently was 2x50W, measured).

Re:I wish my web server were in the corner of my room by Dylan16807 on Tuesday October 11, 2022 @11:40PM (#33172524)
You managed to say that immediately. Were there other serious explanations that came to mind? If not then you need to have more self-confidence because you do know!
Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @04:04PM (#33168543)
> even if the battery is really old you'll almost certainly still have a few minutes

Very true! Battery from like 2015 still manages to keep it running for about two hours I think, which is frankly amazing. I was constantly dealing with taking the battery out of the laptop when not in use (98% of the time, it was connected to a charger, either in a classroom or at home, so I'd need only to bridge the stand-by/suspend/sleep period in the train). At the time, it didn't seem to have an effect as the battery still decreased in capacity, but I gotta say, it is certainly doing a good job since then!

Unfortunately, the external drives are not on uninterruptible power and having two of them in a btrfs mirror caused me more headaches than I like to admit. Even after I figured out which one had the more recent data after going out of sync, I misunderstood the phrasing of the man page and mixed up the arguments for the device to be recovered and the device to recover from. 2/7 would not recommend btrfs on devices without UPS, or if you don't want to shell out the money to buy three instead of two large drives so you can have a 1:1 disk image of the known good device before starting to operate on it (which is what btrfs was supposed to do in the first place, but alas).

> A server drawing 25 Watts costs more than the $3/month I pay.

With the screen and keyboard backlight and such turned off, it should draw less than 25W unless you're actively making use of it (and thus it being worth it), but yes that's ballpark correct.

I also get a lot more value out of it than what I expect to get for $3/month, though :). LAN speed transfers can be nice, no network latency (at least not beyond of your control) when you host a game server, access control is all up to you, dedicated hardware, you can choose to upgrade to 16GB RAM at will (perhaps you got a new DDR4 machine and have no use for the old DDR3 RAM that still fits in this 'server') without having to pay extra every month for those gigabytes forever, buying storage basically at cost price...

Re:I wish my web server were in the corner of my room by shadowgovt on Tuesday October 11, 2022 @03:33PM (#33168140)
How did you solve the problem of getting a stable mapping from DNS name to IP address?

For me, that's the big challenge; all I have is home internet on a dynamic IP provided by one of the big cable monopolies in the US.

Re:I wish my web server were in the corner of my room by belval on Tuesday October 11, 2022 @03:41PM (#33168249)
Here are several things that you can do (from more to less affordable):

- Setup public IP updating. You server runs a daemon that updates the DNS record automatically. You can do that with NameCheap. ($)

- You can pay 5$ to have a digital ocean droplet that acts as a reverse proxy that just forwards traffic to your real server. ($$)

- You can pay for "entreprise" service and get a static IP. ($$$)

Re:I wish my web server were in the corner of my room by pak9rabid on Tuesday October 11, 2022 @03:41PM (#33168242)
Personally, I host my DNS with dyn.org, and use something like ddclient (which runs on my Linux firewall/router) to update my DNS records with Dyn in the rare event it changes. I've never had issues with it.
Re:I wish my web server were in the corner of my room by jvolkman on Tuesday October 11, 2022 @03:41PM (#33168239)
Dynamic DNS as others have mentioned. Or, many ISPs will provide static IPs for an additional cost, but you may need to switch to their business service.
Re:I wish my web server were in the corner of my room by HuwFulcher on Tuesday October 11, 2022 @03:38PM (#33168211)
You can use something like dynamic dns updaters[0]. They run on the box and when they detect that your ISP has changed your IP will update the DNS records accordingly.

[0] https://github.com/timothymiller/cloudflare-ddns

Re:I wish my web server were in the corner of my room by mdorazio on Tuesday October 11, 2022 @03:40PM (#33168232)
Most ISPs offer a static IP address as an add-on or higher-cost service. Might vary depending on where you live, though.
Re:I wish my web server were in the corner of my room by quest88 on Tuesday October 11, 2022 @03:37PM (#33168195)
ddns tools like noip.
Re:I wish my web server were in the corner of my room by graton on Tuesday October 11, 2022 @03:46PM (#33168309)
One option would be to use Cloudflare Tunnel [1]

You would run a program on your system which connects to Cloudflare. The traffic goes to Cloudflare first, and then gets forwarded to your system.

[1] https://blog.cloudflare.com/tunnel-for-everyone/

Re:I wish my web server were in the corner of my room by anony23 on Tuesday October 11, 2022 @06:00PM (#33169806)
I like ngrok
Re:I wish my web server were in the corner of my room by theodric on Tuesday October 11, 2022 @07:29PM (#33170639)
Cloudflare tunnel even lets me host a vanity website (potateaux.com) from a NAT'd LTE uplink using a regular phone hotspot. Game-changer, especially given the price!
Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @07:30PM (#33170645)
I keep being amazed how the self-hosting community loves to recommend "just send all your traffic through a bigcorp".

It's the antithesis of self hosting and it's in literally every big thread about self hosting on HN or r/selfhosted or such.

Whether it's to protect from DDoS attacks from some unknown baddies that are out to get you (never happened to me and I host all sorts of crap, including user-uploaded content), to speed up loading in remote parts of the world by 200ms (I tested my site on cloudflare in ~2015 and it didn't work at all, it just literally forwarded every request and waited for a reply), or apparently now to catch downtime somehow (the brand "Cloudflare Tunnel" instead of suggesting an open source caching service running on any old VPS from a friendly vendor near you).

Re:I wish my web server were in the corner of my room by anderspitman on Tuesday October 11, 2022 @09:41PM (#33171712)
Cloudflare Tunnel can be a step in the right direction. That said, I maintain a list of selfhosted alternatives here:

https://github.com/anderspitman/awesome-tunneling

Re:I wish my web server were in the corner of my room by stefandesu on Wednesday October 12, 2022 @03:43AM (#33174032)
Nice, thanks for the list! Do you have any recommendation how to tunnel from a VPS to my home server if I'm already using Tailscale? Just use any old reverse proxy like Nginx/Traefik/Caddy?
Re:I wish my web server were in the corner of my room by francislavoie on Wednesday October 12, 2022 @04:02AM (#33174161)
Caddy supports .ts.net domains and will pull the cert from the running Tailscale daemon on your system. And even better integration is coming soon, Tailscale is working on things.
Re:I wish my web server were in the corner of my room by stefandesu on Wednesday October 12, 2022 @04:43AM (#33174429)
Sounds great. I'm not in a rush, so maybe I'll just wait until Tailscale releases whatever they are working on.
Re:I wish my web server were in the corner of my room by anderspitman on Wednesday October 12, 2022 @10:25AM (#33177430)
Yep, exactly. Just use the Tailscale IPs or domains in your reverse proxy config.
Re:I wish my web server were in the corner of my room by nine_k on Tuesday October 11, 2022 @11:10PM (#33172317)
I'd say that "self-hosting" is defined by where your processing and data reside, who controls these.

But if you want to be accessible to the outside world, you need to direct your traffic outside; I don't see a substantial difference between routing your traffic through Cloudflare, Comcast, Equinix, or any other major connectivity provider.

Re:I wish my web server were in the corner of my room by lucb1e on Thursday October 13, 2022 @06:45PM (#33197454)
> I'd say that "self-hosting" is defined by where your processing and data reside, who controls these.

And I would mostly agree so long as you're the only one who has access to said data. There will always be "ISPs", of sorts, that your data needs to pass through; that's simply how the internet works.

The nitpick about Cloudflare is that they are starting to act as a gateway to the internet. Maybe you can turn their fronting off if they start giving you trouble, or maybe your registrar also runs behind Cloudflare. Anyway, bit of a philosophical discussion how much power to vest in one company.

The real trouble is that their main offering involves giving them the private keys to your traffic. I don't know if that's also the case with this Tunnel product, but at least for regular websites, then they process your actual data, as with the bank example (a colleague at said bank was not happy).

Re:I wish my web server were in the corner of my room by lostlogin on Tuesday October 11, 2022 @03:54PM (#33168429)
What does a static IP cost over there? It was a US$7.50 one off charge here in New Zealand.
Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @03:55PM (#33168434)
My ISP simply gives everyone a static IP by default.

I know of only one ISP in the Netherlands that uses CGNAT and there you can ask support to fix it, which takes them 24 hours. I learned that the hard way when wanting to have a gaming night, hosting a factorio server in my student room. No gaming night for me, or so the ISP thought while rubbing their hands. It took me a bit but I eventually managed to proxy the UDP traffic somehow, not sure anymore if I used hole punching or somehow encapsulated it in TCP and reverse SSH tunneled or something. (Edit: on second thought, pretty sure I asked the other participants if they had IPv6 -- they did not -- and then proxied the traffic from my server via IPv6 using iptables. /edit)

We are quite fortunate with having had an early ISP community that managed to gobble up all the IP addresses we'd need for a good long while, and our population is relatively stable compared to other parts of the world. I know not everyone is this fortunate. (Hello ipv6...)

Even in a place like Germany, it seems one needs to be a business connection to get this service, it's simply not offered for consumers at all that I could find in some town in NRW. This is why I'm so happy the Netherlands has ISPs like Freedom (successor of XS4ALL) and Tweak who not only care about being cheap. Even if you don't use Tweak or Freedom, I feel like it keeps the local competition sharp.

Re:I wish my web server were in the corner of my room by sally_glance on Tuesday October 11, 2022 @04:00PM (#33168491)
If you're lucky and your ISP supports dynamic DNS updates: Get a router/gateway capable of running OpenWRT (alternatively some routers might support this natively, or you could setup an old PC for routing), use the appropriate client and set it up to adjust the DNS record [0].

[0] https://openwrt.org/docs/guide-user/services/ddns/client

Re:I wish my web server were in the corner of my room by rodgerd on Tuesday October 11, 2022 @04:19PM (#33168710)
I guess this depends, but most ISPs where I live will do a static IPv4 for residential. Mine also does a /56 IPv6 allocation if you ask.
Re:I wish my web server were in the corner of my room by toast0 on Tuesday October 11, 2022 @04:22PM (#33168746)
There are free dynamic dns services available. dns.he.net is one.

Try not to worry too much about what happens when your IP is reassigned before you can update the name.

Re:I wish my web server were in the corner of my room by Gigachad on Tuesday October 11, 2022 @05:06PM (#33169261)
You can rig up your own dynamic dns pretty easy. Most dns services have some simple api you can use so usually it’s just a curl line in your cron tab to run every minute.
Re:I wish my web server were in the corner of my room by airstrike on Tuesday October 11, 2022 @04:29PM (#33168828)
Once upon a time I ran a local Shoutcast radio server on Winamp 2 and used no-ip.org to configure a DNS name dynamically
Re:I wish my web server were in the corner of my room by daledavies on Tuesday October 11, 2022 @04:33PM (#33168874)
I have a cron job that updates my domain's records at digitalocean every hour via their API. But in practice my ISP only actually seems to issue a new IP if I restart my router.
Re:I wish my web server were in the corner of my room by wtf_is_this on Tuesday October 11, 2022 @04:38PM (#33168919)
I didn't see this as an answer, but use Tor (: It has the side benefit that it's harder to discover your service(s) on the wider Internet.
Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @07:35PM (#33170683)
Good suggestion! I used this in 2014. Blog post about it: https://lucb1e.com/?p=post&id=120 (Btw, I no longer vouch for the quality or correctness of an 8-year-old post of mine.) I remember that the latency wasn't amazing or anything, but I apparently found it acceptable enough to use it for SSH.
Re:I wish my web server were in the corner of my room by zrail on Tuesday October 11, 2022 @05:06PM (#33169251)
Dynamic DNS has been a thing since the first dotcom boom. Your router probably already supports at least one service.
Re:I wish my web server were in the corner of my room by hugey010 on Tuesday October 11, 2022 @05:51PM (#33169695)
I'd call your ISP, because mine is not small and offers "business" class service which costs the same as residential, reserves a static ip, and slightly boosts uplink speeds.
Re:I wish my web server were in the corner of my room by ekianjo on Tuesday October 11, 2022 @07:38PM (#33170706)
Duckdns.org
Re:I wish my web server were in the corner of my room by jjav on Tuesday October 11, 2022 @10:50PM (#33172169)
> How did you solve the problem of getting a stable mapping from DNS name to IP address?

I technically have a dynamic IP, as the ISP also sells an upgrade to a guaranteed static IP which I don't pay for.

However, I've been getting assigned the same IP consistently since 2013. I used to use a dynamic DNS service to keep track of it but stopped doing that since it never changes.

Re:I wish my web server were in the corner of my room by kjs3 on Tuesday October 11, 2022 @11:02PM (#33172259)
It never changes until it does. And eventually it will. Just be ready for it to change if anything you count on relies on it. I know this from experience (and far more than just mine).

P.S. - I pay for a static IP from my ISP. Don't count on that never changing either. I know this from experience.

Re:I wish my web server were in the corner of my room by vachina on Tuesday October 11, 2022 @11:57PM (#33172654)
You can set up your domain to have very short TTL (like 2 minutes) and have a script polling your external IP every 2 minutes to watch for IP changes, then have the script change the records of your domain when the IP does change.

Most nameservers provide a REST API for updating records so this is very easily done.

Re:I wish my web server were in the corner of my room by kqr on Wednesday October 12, 2022 @06:22AM (#33174963)
But don't set your TTL too low or many caching resolvers will ignore it and use a default instead!
Re:I wish my web server were in the corner of my room by aembleton on Wednesday October 12, 2022 @04:39AM (#33174408)
I have a cron that updates the DNS entries on Cloudflare with my current IP address. This runs every five minutes.
Re:I wish my web server were in the corner of my room by BatteryMountain on Wednesday October 12, 2022 @05:15AM (#33174596)
Mind sharing your script? Just want to compare :)
Re:I wish my web server were in the corner of my room by aembleton on Wednesday October 12, 2022 @06:38AM (#33175059)
This is to update a record named jellyfin. Its a python script.

  import json
  import requests
  
  IP_API = 'https://api.ipify.org?format=json'
  CF_API_KEY = # Cloudflare API Key
  CF_EMAIL = # Cloudflare email address
  ZONE_ID = # Zone ID
  RECORD_ID = # Record ID for this DNS entry
  
  resp = requests.get(IP_API)
  ip = resp.json()['ip']
  
  
  resp = requests.put(
      'https://api.cloudflare.com/client/v4/zones/{}/dns_records/{}'.format(
          ZONE_ID, RECORD_ID),
      json={
          'type': 'A',
          'name': 'jellyfin',
          'content': ip,
          'proxied': False
      },
      headers={
          'X-Auth-Key': CF_API_KEY,
          'X-Auth-Email': CF_EMAIL
      })
Re:I wish my web server were in the corner of my room by BatteryMountain on Wednesday October 12, 2022 @05:14AM (#33174594)
In my country the dynamic IP's at most fiber providers are so long lived / stable, we can basically treat them as static. You have to phone them if you want force renew your ip address because doing it from our side, we end up with the same public address. I appreciate this behaviour from my provider. Boring & predictable. Just check it once a month if it is still the same.
Re:I wish my web server were in the corner of my room by chillfox on Wednesday October 12, 2022 @05:30AM (#33174675)
I moved to an ISP that provides a static IP for $5 extra a month.

But before that I created a service for looking up my ip address and hosted it for free at fly [1]. Then I setup a script in cron to update my dns every 5min if it had changed.

[1] https://fossil.chillfox.com/echo_ip/index

Re:I wish my web server were in the corner of my room by pak9rabid on Tuesday October 11, 2022 @03:39PM (#33168220)
I second the isolated VLAN approach. I host all my public-facing sites in a VLAN specifically made for that, which grants no access to anything private.
Re:I wish my web server were in the corner of my room by bonestamp2 on Tuesday October 11, 2022 @05:04PM (#33169238)
I third. I've got our computers and phones on one VLAN, everything else is on a separate VLAN (streaming boxes, cameras and other smart home crap, guest devices, etc).
Re:I wish my web server were in the corner of my room by znpy on Wednesday October 12, 2022 @04:53PM (#33182957)
I did but a /slightly/ more expensive but web-managed switch with the precise idea of playing with vlans... Needless to say, I never "found time" to actually do it :)

One day I will. In the meantime, could you please drop some links to some good introductory pages ?

Thanks!

Re:I wish my web server were in the corner of my room by bonestamp2 on Thursday October 13, 2022 @05:21PM (#33196646)
I'm using a ubiquiti managed switch and three ubiquiti access points. Basically, you setup VLANs in the Unifi management software and then you can assign ports on the switch and Wi-Fi profiles to a particular VLAN.

From there, any device that connects to one of those ports or wi-fi networks will use the assigned VLAN. The access points are great because you can create several wi-fi networks and then the software provisions them to how ever many access points and switches you have, so you don't have to login to each one and set them up separately.

Any links I sent would be specific to Ubiquiti, but happy to do so if you plan to use their hardware.

Re:I wish my web server were in the corner of my room by Melatonic on Tuesday October 11, 2022 @05:41PM (#33169593)
Old laptop at your own place + second old laptop at a home lived in by family or friend would probably work great for this.

Hell now I want to try this with two old but decent android phones - they would sip power and have a built in UPS and would blow a RPI out of the water speed wise. Throw a USB-C to Ethernet adapter on each and setup for HA (or if you were really lazy just a simple round robin DNS setup). Put one at a friend house and have them both setup with the free Cloudflare proxy thing and you would not even need to open any ports on your firewall.

Re:I wish my web server were in the corner of my room by benplumley on Wednesday October 12, 2022 @12:26AM (#33172853)
The problem with using old phones is that the battery swells up after a few months left continuously on charge. You could extend the life using Tasker and a smart plug, but you'd lose a lot of the UPS's potential.
Re:I wish my web server were in the corner of my room by BatteryMountain on Wednesday October 12, 2022 @05:24AM (#33174643)
Old phones don't get security/kernel/driver updates, careful...
Re:I wish my web server were in the corner of my room by Haegin on Tuesday October 11, 2022 @06:43PM (#33170213)
To solve the redundancy problem I wonder if running something like Hashicorp's Nomad on a few raspberry pis split across some friends houses could work nicely. Each site gets hosted at multiple houses for redundancy but no one person needs multiple devices.
Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @07:22PM (#33170565)
Not familiar with Nomad; how does that work under the hood? Do you proxy all traffic through this third party who then load balances with a regular old http proxy, or is it actually self-hosted by the set of friends? With multiple DNS A records, this shouldn't work (it'll just fail in 1/N cases if 1 of the N IPs is down), so I'm curious how this is different from just hosting with Hashicorp directly.
Re:I wish my web server were in the corner of my room by acaloiar on Tuesday October 11, 2022 @07:51PM (#33170807)
Each friend's Nomad "client" (a node in the cluster) would accept a "job" which is the HTTP server. The missing piece is communicating back to some authority which clients are running the service, and on which ports. This could be done with DNS SRV records. Most commonly, Consul is used for DNS in a Nomad cluster.

This article is likely to give you a good idea of the architecture: https://developer.hashicorp.com/nomad/tutorials/load-balanci...

Re:I wish my web server were in the corner of my room by lucb1e on Tuesday October 11, 2022 @08:34PM (#33171163)
So if I understand it correctly, this haproxy they suggest is the new central point of failure? Sorry for being skeptical but I'm not really understanding the advantage.
Re:I wish my web server were in the corner of my room by joeblubaugh on Tuesday October 11, 2022 @10:53PM (#33172205)
You can also run multiple haproxies with identical config. One machine goes down? Your existing proxies still balance load to jobs.
Re:I wish my web server were in the corner of my room by lucb1e on Thursday October 13, 2022 @06:47PM (#33197480)
But people would need to know which other domains run the other proxies. Might as well manually type in the other domain.

The only way I see to avoid a SPOF is with anycast, which I think involves running your own ISP to be able to arrange your own BGP sessions and announce at multiple locations.

Re:I wish my web server were in the corner of my room by Manu40 on Tuesday October 11, 2022 @08:54PM (#33171332)
Hi there. I have a R-pi vs 2, and I'm wondering how well you think that would hold up for a basic blog site. It doesn't need to be super fancy, but I would like it to at least be a little nicer looking and just a little more complex than for example Ycombinator.

Is this worth while to do? I'm concerned about using a pi, because micro-sd cards seem to be notoriously bad for corrupting data in less than ideal power situations.

Re:I wish my web server were in the corner of my room by joeblubaugh on Tuesday October 11, 2022 @10:51PM (#33172184)
You can always plug in a spinning disk. I used an RPi Model A to stream HD video off an HDD for around a year and it worked just fine. Keep an image of your SSD in case it gets corrupted and you need to reinstall.
Re:I wish my web server were in the corner of my room by Manu40 on Wednesday October 12, 2022 @01:22AM (#33173188)
Okay, so forgive me if this is a dumb question, but I thought the R-pi 2 requires the OS to be on the micro-sd to boot and can't use USB or PCI adapter connected drives?
Re:I wish my web server were in the corner of my room by joeblubaugh on Wednesday October 12, 2022 @07:04AM (#33175228)
Yes, that’s true. What I was suggesting: * put the OS on the sd card. * Put all the data on an external drive that is more reliable. * Take a snapshot image of the sd card when setup is complete. If your sd card is ever corrupted you can use the image to restore the server.
Re:I wish my web server were in the corner of my room by Manu40 on Wednesday October 12, 2022 @01:48PM (#33180468)
Oh, okay. Thanks.
Re:I wish my web server were in the corner of my room by lucb1e on Thursday October 13, 2022 @06:53PM (#33197518)
> I have a R-pi vs 2, and I'm wondering how well you think that would hold up for a basic blog site.

Whether it could survive a lot of pageloads, like when submitting to HN and it gets traction, 100% depends on the blog software.

It won't run Wordpress well because that software is ridiculously heavy, and I frankly don't have good examples of database-based blog software aside from something I wrote myself. Mine still does multiple mariadb queries per pageload, so it's not as though it's extremely lightweight, but page generation comes out to a few milliseconds on a laptop with a CPU from 2012 inside. This software would survive the HN homepage easily.

I would estimate that anything that can handle >10 requests per second will survive the HN homepage, but if you're on the edge of 10r/s then perhaps it might be slower during the busiest minutes. If you would use static page generation (like jekyll, though I'm personally not a fan of how jekyll works it's the most well-known example) then the pi will definitely survive serving those static pages easily.

> I would like it to at least be a little nicer looking

The looks don't make it heavier or less heavy. Having a few style rules applied to the page is a few extra bytes per pageload, but they're not going to make the difference between it working or it not working.

Re:I wish my web server were in the corner of my room by selcuka on Tuesday October 11, 2022 @09:29PM (#33171619)
> I can recommend something beefier than a raspberry pi, though, or at least than than the pi 1-3 speeds that I'm used to.

Thin clients are perfect for such tasks. More powerful than a Pi, fanless, uses little power, and comes with a proper network card. Second hand HP T620s are cheap.

Re:I wish my web server were in the corner of my room by Gasp0de on Wednesday October 12, 2022 @07:40AM (#33175507)
> Then install unattended-upgrades, put admin panels (phpmyadmin, wp-admin) behind basic authentication, don't host things you don't trust (random code written by 'someone on the internet' that has never been tested by anyone), put it in a VLAN if you want to be extra cautious, and you'll be fine.

Also default security measures such as disabling root login via SSH, disable password login via ssh, use fail2ban (also works for wp-admin and the likes!), install/use firewall and only open services which you want to access from the outside.