News for hackers. Stuff that matters.
Re:Static site hosting hurdles by akerl_ on Monday September 05, 2022 @06:52PM (#32730437)
It felt odd to see a doc this comprehensive on static site hosting with no mention of AWS S3/Cloudfront, given how easy it is to push content to an S3 bucket (either manually or via the CI pipeline of your choosing) and then serve it up either direct-from-S3 or via Cloudfront.

But then it turns out that this is actually pushing folks towards some new paradigm of static cached HTTP responses instead of files. It pitches this as an attempt to “standardize the hosting side of static sites”, which doesn’t pass muster for me. We’ve already standardized the hosting side of static sites by using the file system. Shifting to a new storage format besides “HTML on disk” doesn’t unify anything, nor does it seem desirable to have fewer options for serving content.

Re:Static site hosting hurdles by twhitmore on Tuesday September 06, 2022 @06:12AM (#32735077)
I agree -- the OP said space for all the separate HTTP response variations might be an issue, and "With a smart enough storage format all of these could be solved".

I think he misses that storing HTML and having a webserver turn this into HTTP responses, might be exactly the storage format that solves this problem.

Re:Static site hosting hurdles by Dalewyn on Monday September 05, 2022 @07:18PM (#32730641)
>We’ve already standardized the hosting side of static sites by using the file system.

Worth noting that the incoming younger generations can't and don't into file systems.[1]

Yes, anyone who wants to be a webmaster should do their homework, but that is besides the point.

We are probably the last generation who can be ubiquitously assumed to have an understanding of files and folders/directories in a computer.

[1]: https://www.theverge.com/22684730/students-file-folder-direc...

Re:Static site hosting hurdles by hedora on Tuesday September 06, 2022 @02:40AM (#32733735)
In fairness to younger generations, I can never figure out how to use file choosers in modern operating systems or in crap like google drive.

It takes me a minimum of 60 seconds to naviate to ~ using the GUI on my work laptop.

(Partially because the dialog box sucks, and partially because I only do that once every 6 months or so.)

It's like some UI designer didn't understand folders, then somehow forced their brain damaged mental model of them on the rest of the population. After that, for some reason I will never understand, the rest of the industry copied the design.

(I've worked on filesystem implementations, tested for POSIX compliance, debugged insane customer issues, etc, etc. I know how directories work...)

Re:Static site hosting hurdles by oneeyedpigeon on Tuesday September 06, 2022 @05:21AM (#32734753)
> It takes me a minimum of 60 seconds to naviate to ~ using the GUI on my work laptop.

Which OS? For all its flaws (and there are many related to this issue, like overzealous hiding), macOS lets me add ~ as a 'Favourite' which then shows up in file choosers as well as the main file browser app.

Re:Static site hosting hurdles by Dalewyn on Tuesday September 06, 2022 @02:45AM (#32733761)
>It's like some UI designer didn't understand folders,

He probably didn't.

Re:Static site hosting hurdles by zactato on Monday September 05, 2022 @09:51PM (#32731732)
I think people in the web development space will continue to understand this concept. People who are curious will learn how the internals work.

For everyone else, who cares? Search is so good that it doesn’t matter where a file lives on your device. They don’t need to understand the internals of how directories work.

Good riddance! Even though people knew how to use files and folders no one did it well. It was a mess of “new directory” and “copy of copy of essay5.doc” I’m so thankful that most folks don’t have to deal with that anymore. They can use their computers instead of fighting them.

Re:Static site hosting hurdles by Spivak on Tuesday September 06, 2022 @01:22AM (#32733189)
I’m apparently young enough to be targeted by this article so I’ll weigh in. We’re better off for it, files as a storage layer and/or format (meaning how routes on web servers are defined by the folder structure) suuucks. File semantics are annoying, complicated enough that nobody really gets them right, and broken at the margins. The concept of a virtual read head and seeking around files would never be invented today. File descriptors keeping random external magic state? What could go wrong? All but a tiny few file operations not being atomic — bleugh. See the stuff Ansible has to do just to get atomic copy. Permissions, attrs, xattrs, acls, and SELinux tags are a god damn mess. Locking is also a mess and filesystem dependent — sqlite doesn’t officially support NFS because of it. And with all that useless metadata we still don’t have a way of actually reliably specifying the format or encoding of files leading to garbage library after garbage library for guessing it. File paths being binary strings on Linux is a ridiculous tripwire, running out of inodes or open file handles is a leaky abstraction, links — hard and soft are a bandaid and make traversal stupid to reason about. Look at the dumb shit tar has to do to deal with it. Holding handles to deleted files is absolutely ass backwards and a pox on the people that made it necessary for updates to work. File rotation just shouldn’t be necessary. The application having to think about compression is the wrong layer. Whoever invented unix:abstract files committed a warcrime.

If you’re someone who likes working with the filesystem directly, why? Seriously why? It really does seem like anything would be better.

Even for code, wouldn’t you rather things like Python modules or packages be first class objects? No more sys.path nonsense, no more namespacing, just your whole venv in a single trivially relocatable file.

Re:Static site hosting hurdles by Dalewyn on Tuesday September 06, 2022 @02:01AM (#32733451)
Unless you are an engineer working directly with code concerning file systems, you don't need to know any of that. Well, maybe file permissions, but most people don't need to deal even with that in their daily uses of computers.

Being able to understand where your data is located in a computer and knowing how to manipulate them makes a lot of subsequent data management easier. For one, a file system is independent of any given piece of software. You don't need to rely on your word processing program knowing where your documents are, you can just tell it where your document is. You don't need to wrangle with sending a picture from your Photos program to your email program, you can tell your Photos program where to save the picture and you can just tell your email program where your picture is.

And did I say picture? Is it a JPEG? PNG? GIF? An abstraction of the file system won't tell me, but if I go look in the file system I can immediately tell what the picture is, and where it is too.

And like I just alluded to, you get to decide where the files reside too. Your Photos program might stuff all 6000 of your pictures under "C:\Program Files\VendorMcVendorface\Photos\userdata", and sure, that works, but that's nonsense. You could sort everything exactly how you want it where you want it. "C:\Photos\2006\Yosemite" for just all the pictures you took on a trip to Yosemite National Park in 2006, for example.

Admittedly, it's a feat that file systems have been successfully abstracted away for Joe Average, but not knowing how to navigate and use file systems is going to bite you in your arse when something inevitably comes around demanding you do it.

Understanding file systems is one of those bits of knowledge and wisdom in life you can do without, until you can't. And by then, you don't have time to call for a time out and get a crash course on it.

Re:Static site hosting hurdles by ciprian_craciun on Tuesday September 06, 2022 @03:09AM (#32733921)
> Worth noting that the incoming younger generations can't and don't into file systems. [...] We are probably the last generation who can be ubiquitously assumed to have an understanding of files and folders/directories in a computer.

[the author here] The article is not about misunderstanding file-systems.

As I've commented earlier on a different thread, <https://news.ycombinator.com/item?id=32733825>, the problem is that when it comes to performance and jumping through the hoops the internet gatekeepers (i.e. the search engines) have set out, just dropping some files somewhere the web-server can pick up isn't enough; there are additional tasks that can't be easily performed with files-on-the-disk approach.

Re:Static site hosting hurdles by Dalewyn on Tuesday September 06, 2022 @03:35AM (#32734125)
Not that I'm interested in arguing against your intent, but the second and third paragraphs clearly lay out the article is about the younger generations not knowing what a file system is.

I linked it here because, with regards to "already standardized the hosting side of static sites by using the file system", it means squat if the webmaster-to-be doesn't know what a file system is. There's no preconception of using files to hold and serve data from if you don't know (and possibly don't care) about file systems.

If we're going to be discussing attempts at changing the paradigm, then it stands to reason to understand the environment at large that might be encouraging it. If we're going to be talking about something replacing file systems for data storage, it's pertinent to know first of all that the younger generations give zero bits about files.

Also, SEO is at best a tangent to data storage and serving. Some webmasters might not even care to bother with SEO if they don't care about search engine rankings.

Re:Static site hosting hurdles by doliveira on Monday September 05, 2022 @08:12PM (#32730991)
That's fascinating! Young people struggling with files and folders just like my Mom does.
Re:Static site hosting hurdles by Dalewyn on Monday September 05, 2022 @08:44PM (#32731231)
It's really not surprising.

The most familiar computer to young people, their smartphone, does everything to hide and abstract away the file system and even the fact that it's a computer.

When someone doesn't even realize a concept exists, it shouldn't come as a surprise they will struggle.

Re:Static site hosting hurdles by nerdponx on Wednesday September 07, 2022 @01:57AM (#32746892)
More cynicism is warranted here. "Platform companies" like Google and Apple love it when users fail to understand how their devices work, because they get locked-in to the plaftorms. This is the successful end result of a long campaign of deliberate miseducation of users.
Re:Static site hosting hurdles by danuker on Monday September 05, 2022 @07:06PM (#32730540)
S3 is not competitive. Here:

https://neocities.org/supporter

Re:Static site hosting hurdles by akerl_ on Monday September 05, 2022 @07:13PM (#32730597)
Competitive by what metric? My site lives more or less entirely within the AWS free tier. I think my total AWS bill is around $20/mo, and 80% of that is for the stupid number of domain names I’m hosting zones for.
Re:Static site hosting hurdles by Something1234 on Monday September 05, 2022 @07:37PM (#32730765)
Quick question: Why wouldn't I use my free tier registrar DNS? Are there really that man DNS queries serviced cause you pay based off the number of responses? Especially if they are stupid domains.
Re:Static site hosting hurdles by akerl_ on Monday September 05, 2022 @07:57PM (#32730902)
As far as I can tell, there’s only 2 upsides I’m getting by using AWS as a registrar:

1. I’m lazy, and I already manage a bunch of other stuff in AWS, so it’s convenient for me to have the domains in the same place

2. For some of the domains, I’m serving records that point to other AWS resources (like Cloudfront and S3). AWS’s Route53 has clever helper features when you’re pointing records at other AWS services).

Otherwise, you’re right that there’s plenty of registrars that’ll do perfectly solid DNS

Re:Static site hosting hurdles by lukewiwa on Monday September 05, 2022 @08:36PM (#32731174)
For me my static sites are small enough that it all falls within the free tier and I can deploy everything using the CDK.
Re:Static site hosting hurdles by numtel on Tuesday September 06, 2022 @02:44AM (#32733755)
If you're ok with using Cloudflare's free plan for your DNS, you can stop paying for each hosted zone.
Re:Static site hosting hurdles by the_gipsy on Tuesday September 06, 2022 @03:58AM (#32734261)
"HTML on disk" does not cover headers.

But it's true that cloud providers have that solved, and "DIY" bring-your-own-server don't, and the article somehow concludes that bringing your own server with the right configuration is not an option.

Re:Static site hosting hurdles by ciprian_craciun on Tuesday September 06, 2022 @04:26AM (#32734422)
> [...] the article somehow concludes that bringing your own server with the right configuration is not an option.

[the author here] On the contrary, it is an option to fine-tune your web-server configuration to put all the right headers in the right places. (I usually do this from HAProxy and just ignore the web-server.)

However, the point I was trying to make in the article is that where these headers are configured is divorced from the content itself lives. I can't look at a HTML file and easily say "when the browser will hit this resource these are the HTTP headers that will be sent in the reply"; I need to execute in my mind the web server configuration logic to get that.

Thus my proposal is to move back (some of) the headers where they belong: as meta-data right besides the actual resource.

Re:Static site hosting hurdles by the_gipsy on Tuesday September 06, 2022 @06:40AM (#32735260)
But do you really need different headers for different resources for a static site? I can imagine a distinct "downloads" folder maybe, but not much more.
Re:Static site hosting hurdles by waffle_ss on Monday September 05, 2022 @11:01PM (#32732259)
Just using the file system is inadequate for some reasons that TFA mentions. For instance, returning gzip or Brotli compressed versions of resources, or returning HTTP 301/302 redirects for certain requests.

Also if you use CloudFront be aware you'll be paying for bandwidth, so if one of your pieces goes viral (or you're just a popular writer) the cost can be surprisingly high (over $50/mo).

Re:Static site hosting hurdles by indigodaddy on Tuesday September 06, 2022 @01:50AM (#32733373)
Pretty sure you can stay in free tier without a CC on file though? So assume they’d just deactivate your services if you breach free tier resources for the month..(?)