Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Does a static site need anything more than a simple VM running a server?
36 points by swidi on April 15, 2022 | hide | past | favorite | 51 comments
I'm an amateur blogger and programmer, running a custom-made static site on a Linode VM with Caddy [1]. I don't use containers or CDNs or anything fancy; my site generator just spits HTML into a folder and I rsync it to the server.

Do I need anything more than this? Is there some modern technology that is demonstrably better than my workflow? I worry I've been left behind, but I also find containers and other modern obsessions to be overkill for my needs.

Thanks for any and all advice.

[1]: https://caddyserver.com/



The best “I just want to serve HTML” workflow I’ve found is the Netlify/GitHub Pages workflow, as long as you consider version control useful.

I can see two downsides to using a VM. 1) You need to update it. 2) Your website goes down if your VM goes down. Do these matter? I’d say 1) is moderately important and 2) depends on your website.

Using Netlify fixes these issues (but introduces other potential problems). Does that make it “demonstrably better”? Depends. I’m not you, so I don’t know any pain points or annoyances you have or what you consider important. At the end of the day it doesn’t make a difference to the actual website.

That said, it is very quick to try. Why not spend an hour or so and see if it’s worth it for yourself?


Netlify is down 5-10 min each day since the last few days ... at this point I switched back to my VPS for better reliability ...


You don't need more than that.

There are easier ways _depending on the context of what you already know_. There are better ways depending on what you're optimizing for. For you I bet this will be hard to beat. For me, I'd probably throw it in AWS S3, because that's what I know without having to think about it or do much work.

Containers and other such things are more for when you need different things, like a dynamic site or backend async processing, or not a site at all, and especially when you need some/all of that and are tired of sysadmining a VM.


S3 is the right answer for anyone with even passing familiarity with AWS. Bit of a pain that HTTPS requires cloudfront, but otherwise the dead-simplest way of getting HTML to a browser.


As an exercise a few months ago I tried deploying a static site to a freshly purchased domain on netlify, start to finish I found it took less time than any aws workflow and gave me free inbound forms.

I say this as a very experienced aws and s3 user who also has several static and dynamic sites on s3 buckets, VPS & ECS.

netlify for simple static sites is a simpler and faster workflow with https and forms as 0 config and free.


You don’t need a VM for static sites.

As others have said, you can just drop it in S3.

The other alternative is Cloudflare pages. It’s cheaper than s3 with a generous free tier. I find it less hassle than uploading to s3. Git commit, git push, a few moments later it’s deployed on a global CDN.

Both options will be cheaper than running a VM and maintenance free.


Linode VM and Caddy isn't too left behind. It's likely to continue being well within "just fine" parameters for at least the next decade.

At some date after that point you'll be seen as a retro computing hobbyist if you're willing to change your personal brand, and people will flock to your blog to learn just how you manage to pull it off...


AWS S3 bucket set to serve static pages, use the aws command line to sync it with your source folder.

Its easy, cheap and resilient. If you want you can then cloudflare the site or aws have an equivalent service.


This is what I do. Two sites minimal traffic and it's something like 6 cents a month.


GitHub Pages are 0 cents a month. With the best uptime and reachability stats of all static hosters


Really? Better than Cloudflare, for example? I thought that github.com have had a rotten track record recently, but I'll be honest, I have no idea which services are/aren't impacted.


I couldn't find recent proper performance tests, only spam. This is an old one: https://savjee.be/2017/10/Static-website-hosting-who-is-fast...


I do mine with Google Cloud storage. I found it simpler for setting up than AWS. Have used both


Azure has the same, for the record


That VM is obsolete, the new way is

https://jamstack.org/

for instance host with

https://www.netlify.com/

Basically you check your files into GitHub and chill, it is as easy as it gets.


I disagree. It's not "obsolete", it's just a different option with its own pros and cons.


Perhaps not obsolete, but there is no sense in paying for a VM for a static site when things like Cloudflare Pages will do this for free.


Also if the "value" here is "run a static web site without a lot of pain" services like Cloudflare pages, Netlify, AWS amplify are 𝐦𝐮𝐜𝐡 less effort and hassle than a static server like nginx when you consider SSL certificates and all that.


Sure. Mind your caching and it’ll be crazy fast and handle more traffic than you’ll ever throw at it.



How are any of these simpler than "Get VM, install server, rsync files"? Why is the solution always "sign up for a proprietary service that might not exist next year and rig up a bunch of fragile webhooks"?

Also, I don't use Git or Github.


It's simpler from a certain point of view, namely one where you don't want to have to maintain the VM.

It's more complicated because you need to know more random tech that I bet you don't want to learn. Which is fine, it's really not necessary.

By the way, you should learn git sometime. Or there's a couple other VCSes that are somewhat known, but git is both good and has good networking effects (everyone uses it).


I prefer Mercurial, and as a hobbyist I can afford to stay with it. I know Git has GitHub and all the connectivity of that, but I just truly dislike Git.


Ah, I didn't see that you use mercurial instead of git when I made my last comment.

I'd love to be able to make red-line decisions like this regardless, no matter what. For example, I absolutely hate MacOS and would love to say "hard no" to any job offer if they insist that I use MacOS, regardless of job fit or TC. But ultimately, I back down once they show me the money, and find myself using it anyway.


That works, as long as you know one of them.


I agree about the fragile frameworks but not the rest.

In this case I'd say that "simple" is a product of familiarity, manual steps, and future maintenance. "Get a VM" also means "install stuff on a VM", "secure a VM", "monitor load, memory, disk space on a VM" and "manage a VM into the future, upgrading the host OS and fixing whatever breaks". Is rsync easier than git? Maybe, but it doesn't have version control (which is nice to have). I think the git suggestions are based on the assumption that only a tiny number of people could do VM setup, webserver config, rsync etc but couldn't do git add, commit and push.

Personally, I use Cloudflare because it handles DNS, CDN and is basically hands-off after setup.


* no need to install and configure OS

* No need to install and configure web server

* No need to setup firewall

* No need to main and patch above components every day

* No need to upgrade the OS every few months/years

I have not used mercurial in close to a decade, but from what I can remember you could push to a git server from the mercurial client.


I'm an SRE and I'll say that all of these services are far simpler than configuring, maintaining and monitoring a VM.

If you want to maintain your Mercurial setup then consider S3 + Cloudfront.


Azure websites and githubpages are nice too. Why pay when you don't have to?


Free services never truly are, and I don't want to build something on a foundation I don't pay for. Corporate generosity always runs out eventually.


It is not generosity, they hook you in for free so when your needs grow you will stick with their platform and pay. Static sites are cheap to host that is why it is free.

Should your needs grow past simple static sites they are hoping you will use their paid options. This isn't a "you are the product" situation.


Does pages.cloudlare also run apps or just static pages?


just static page. But you can use their worker service to run some server-side functions


Miss the digital ocean 3 free site offer. May try that.



Yeah. My experience with hosting a svelte site on render was just amazing. Highly recommend it


The only concern is that you don't have any redundancy. What happens when you push an update? What if the service provider shuts down the VM to patch it?

If you are fine with your site being down for short periods of them then this approach is perfectly fine. Otherwise you'd need to set up multiple instances and some sort of load balancing between then.

Others have suggested hosted solutions for static sites (Netlify, Vercel, Github Pages, Cloudflare) and I think those would be a lot easier if you want a no fuss production solution.


You're paying $5-10 per month to host static files on a linode VM, when you could host it for free on netlify, vercel, github pages... etc

Vendor lock-in is no where near as bad for static sites too, as the actual static build is the same just slightly different deploy commands for different platforms.

A commercial product might not exist in a few years, but you can't guarantee someone else will pay for your Caddy server VM, after you're gone too.


You need something better if what you've got isn't doing the job. Doesn't sound like that's the case, so, there you go

I serve my blog from Node.js on Heroku, even though it's mostly statically rendered, because that's my comfort zone. A CDN or even nginx would be more efficient, but I don't need it to be. I much prefer having the breezy and familiar workflow


One thing to take into account is the flexibility of already having a VM over the touted CDN/jamstack workflow.

I think of it in terms of marginal cost. What is the cost of spinning up another site in a CDN/jamstack workflow? Not too bad if it's also static. What about spinning up another service like a database? Or not even leaving the HTTP space, what about a non-static site? I like having the flexibility of say hacking together a RSS aggregator in a weekend and throwing it onto my VPS behind my already running reverse proxy.

(Oh and it's a "free" VPN if you are already paying for the VPS for another reason.)


I run static sites on Amazon S3 storage with cloudflair in front.

It costs about 6 cents a month.


I think you'll be fine unless you suddenly get DDOS or something. But then cloud flare would solve that.


The only thing I'd add is a CI/CD pipeline to make updating the VM easy. Maybe an Ansible playbook to better ensure the files get copied and that Caddy gets updated, if needed. All optional though.


a vm running a server is not really "simple", at least not by my idea for static html. i would think a vm/server is only needed if you have specific hosting requirements.

maybe i'm missing something as i didn't see anyone else suggest it, but i would just use github pages, or even something like gdrive, dropbox, mega can host html i think.


Firebase Hosting is really good for this kind of thing. You can even expand it later to add more dynamic content.


You don’t need anything more than this.


Caddy, you say?

This is what I would do.

Keep the Markdown files on your local PC.

- Add/modify Markdown files.

- run a bash script to

- - rsync them all to your VPS

- - run Caddy on VPS

Done.

View on your favorite web browser.


This is my exact method. Render Markdown into HTML, rsync up to the Caddy server.


This is what I do too... But I'm debating dropping my VPS and self hosting with TinyCore Linux (non-persistent OS) and H20.


No, I meant edit locally, rsync and do Caddy at the VPS.

Kinda like your very own CI/CO.


S3




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: