top | item 19981869

Show HN: Scar – Static websites with HTTPS, a global CDN, and custom domains

363 points| cloudkj | 6 years ago |github.com

170 comments

order
[+] fishtoaster|6 years ago|reply
Looks very similar to my project https://github.com/kkuchta/scarr from a while back. It even uses the same acronym (I assume that's just a coincidence, since we both just picked a cool-sounding english-language word using the initials from S3, Cloudfront, ACM, and ACM.

At a glance: - Mine handles domain registration + ACM verification automatically - This one wisely uses clioudformation instead of api calls - This one does apex->ww redirects, whereas mine uses the apex and has no redirect

Seems pretty cool!

[+] jaden|6 years ago|reply
GitHub pages [0] gives you static sites with HTTPS and a custom domain without nearly as much complexity as this if you're looking for an alternative to Netlify.

[0] https://pages.github.com/

[+] gtirloni|6 years ago|reply
I feel like Netlify has set the standard in this area now so I'm curious to learn what's different when I see these projects mentioned here.
[+] jkarneges|6 years ago|reply
It even gives you a CDN. GitHub Pages is fronted by Fastly.
[+] fjp|6 years ago|reply
I have two sites up using GitHub Pages + Cloudflare and it's super easy and enjoyable
[+] NateEag|6 years ago|reply
Am I the only one who still hosts my own static sites on a plain old virtual machine?

It's pretty simple to configure nginx for static sites, and by doing it yourself you reduce vendor lockin to just about nil.

Even if S3 is massively cheaper, $5/month for a tiny VM seems like a small price to pay for being vendor-abstract.

I suppose S3 is way less likely to suffer a meaningful outage than my little VM, but how many 9s do my personal websites actually need?

[+] clintonb|6 years ago|reply
Maintenance is my primary concern. I deal with software for a living. I want my blog to just work without me having to worry about maintaining the VM. Netlify makes this dead simple.

I used to host Wordpress sites for myself and family members. I've now moved nearly all of those sites to Netlify (for hosting) and Forestry (for editing/CMS). I no longer have to worry about malicious hacking attempts, Wordpress updates, or anything else outside of the site content.

Here is my post on this transition for those interested: https://dev.clintonblackburn.com/2019/03/31/wordpress-to-jek....

[+] shshhdhs|6 years ago|reply
I disagree with encouraging people to do this. You are not accounting for a CDN here, like the post. A website on the HN front page went down yesterday on a $5 VM.

And S3 just holds your HTML files, for super cheap. There’s no lock-in concern there. You can easily migrate to nginx in the future if you really want, but start with S3

[+] WhiteOwlLion|6 years ago|reply
There are some low end VPS providers too that go as low as $1/mo. I usually stick to $2/mo or higher just for stability, reliability. Even you even got hosts like Hetzner Cloud, Scaleway (see European hosts) that provide great service, bandwidth, and VPS. I don't know why people use Amazon... I don't find their value proposition very good unless you need dynamic scaling for unpredictable demand.
[+] Symbiote|6 years ago|reply
I host my site on Apache running on an ARM board in my garage.

I'll consider moving to a VM if/when the ARM board eventually fails, but it's been running for 6 years so far. I have 6TB of storage, which mostly serves as a NAS but includes about 200GB of photos for the website.

There is no deployment process; the web root is mounted by NFS on my desktop. I can share large files with people just with "mv" or "ln -s".

> how many 9s do my personal websites actually need?

My router seems to crash every 3-4 months, and I need to reset it. There's around 15-30 minutes of power failure every year. I don't worry about this.

[+] tyre|6 years ago|reply
yes. I host my personal website (maddo.xxx) on a single EC2 instance with just nginx. It's easy. It's fast. When I want to over-engineer the shit out of it for fun, it's ready.

Deploys? One line of `scp`

scp -r -i ./certs/maddoxxxnginx.pem ./app/* [email protected]:/var/www/maddo.xxx/

(that deploy script just bulk uploads everything, but that's fine for now. The whole site is measured in KB.)

[+] jniedrauer|6 years ago|reply
I served a static website off nginx from a docker container for a while. At some point there was a breaking change and it would have taken 3 minutes to fix, but I didn't bother. Static hosting is a solved problem and there's not really a reason to do it yourself unless you just want to learn.
[+] jakelazaroff|6 years ago|reply
How is there vendor lock-in for static websites, though? Can't you just take your files and go somewhere else?
[+] dmitriid|6 years ago|reply
I’m old enough to serve my static site from nginx running on my server :) No virtual machines.
[+] pushpop|6 years ago|reply
If it’s a static site and you own the domain then vendor lock-in isn’t really a problem regardless of if you use cloud services or not. Because you can just dump those files on a different provider and change your DNS entry. It’s not even remotely the same level of complexity as other services when people normally talk about vendor lock-in.
[+] wolco|6 years ago|reply
I do. I'm surprised more don't on hn perhaps it speaks to something bigger.
[+] klodolph|6 years ago|reply
I switched from S3 to a $5/month VM a while back and it is massively better.
[+] mevile|6 years ago|reply
> you reduce vendor lockin

I don't know why anyone cares about vendor lock in. It's either trivial to move an aws lambda to a google cloud function because you don't have a lot going on, or it's not trivial to move stuff from even your own servers to other servers because it's under huge load and you have considerable amount of data you'd have to migrate under complex conditions.

Moving around is either hard or easy based on things that don't really have anything to do with vendor lock in.

[+] gvand|6 years ago|reply
Nice project.

As an aside, I genuinely wonder under which circumstances a CDN will be useful for a static website nowadays. I have a static website that has been on the HN homepage a few times and got picked up by the Chrome mobile recommendations and a nginx/https with slightly tweaked configuration never had a problem handling the traffic even on the smallest DO droplet.

Edit: Thanks for these replies.

[+] Xylakant|6 years ago|reply
The CDN makes the site load faster by caching the content on edge nodes close to the client. It’s not for taking load off the origin, but purely for network latency.
[+] zachruss92|6 years ago|reply
What I like about static sites is that you can serve the site in its entirety from a CDN. So you can literally just CNAME www.yoursite.com to yoursite.gitlab.io (or w/e static site host you use). This dramatically cuts down on latency worldwide. It also removes your web server as a single point of failure for short-term outages.
[+] tedshroyer|6 years ago|reply
The technical reason to use a CDN with aws s3 is so that you can have a custom domain name with https. s3 will do http custom domains, but to get https you proxy it. In this case, you can think of Cloudfront as the proxy.
[+] rsweeney21|6 years ago|reply
We use a combination of Netlify + Webflow + Hugo for our website (www.facetdev.com). With that we get a global CDN and our website will never go down.

Netlify has been awesome and it made it stupid easy to combine our www site on Webflow with a hugo static blog in a subfolder (/blog). This might be my favorite web publishing workflow ever.

If you haven't tried Netlify yet, definitely give it a look.

[+] triangleman|6 years ago|reply
Does the webflow save to a git repo?
[+] djsumdog|6 years ago|reply
How much does this cost? I put in some more effort to setup my HAProxy and nginx containers on a Vultr node, but I get LetsEncrypt for free, so I'm just paying for a Vultr node (or DO droplet) and the price of the domain name:

https://github.com/sumdog/bee2

[+] 1023bytes|6 years ago|reply
My estimate is about $1.5 a month, so definitely less than a full VPS, but it depends on the traffic and how much data you store.
[+] cloudkj|6 years ago|reply
It costs at least $0.50/month but probably not much more than that for most small to medium sites.

The $0.50 is the monthly cost of the Route 53 hosted zone; the CloudFront and S3 costs typically amount to pennies, but of course it depends on traffic.

[+] whalesalad|6 years ago|reply
I have a two-line Makefile that with one target that sync's my website with an S3 bucket. Deploys are instant. The rest is handled by Cloudflare an AWS. The sheer number of moving parts in this system is outrageous for a static website. A fun project for sure, though.
[+] kaiku|6 years ago|reply
Bundling service config and launch makes the whole process easier, for sure. There's also more than one way to configure this depending on what your needs are, so it'd be cool to have a few different versions of SCAR.

I started with a setup similar to your diagram and tweaked it when I realized S3 didn't serve index.html when the URL was just the parent "directory", i.e. example.com/foo/ doesn't resolve to s3://example.com/foo/index.html. To get this working I had to write a bit of JS in a Lambda function and deploy it at the edge of my CloudFront distribution to do some URL rewriting.

Given that's the behavior most people expect, might be worth considering?

[+] cloudkj|6 years ago|reply
That should indeed be the default behavior out of the box with the way the S3 buckets are configured. I have a couple Jekyll sites deployed this way, and a request to the parent directory does get served by the contents in `index.html`. Are you not seeing that behavior?

I'd definitely like to add more variants of the default stack. At the minimum, I'm sure there are folks that prefer `www` redirects to the apex domain, or removing the `www` subdomain altogether.

[+] SadWebDeveloper|6 years ago|reply
Anyone have an a average monthly fee for using these as hosting solution? last time i ran the numbers using all that services go from 5 to 10 USD per month and was better to use amazon lightsail (3.5 per month) or other cheaper alternatives at lowendbox
[+] iBelieve|6 years ago|reply
For anyone looking for a hosted solution, https://surge.sh/ is super nice and simple without any of the complexity of managing the stack yourself. Deploying uses one simple command, and you get hosting and custom domains for free, though I believe SSL is paid for custom domains. (I'm not affiliated with Surge at all, just a happy user.)
[+] tamalsaha001|6 years ago|reply
How is this any different from Firebase hosting? We have been using it for a while with no problem. Also comes with a very generous free tier.
[+] timClicks|6 years ago|reply
Sorry to nitpick, but "Copyright © 2019" isn't a "license". It's not even a full copyright declaration without listing an owner.
[+] morenoh149|6 years ago|reply
great job! I wish more projects have 1-click deploy to Heroku, aws, gcp or azure. This is a good habit more people should get into.

Running this project on aws can give a cloud beginner an interesting way to expose them to many concepts. Now I just have to figure out what static website I want to run in this!

Please do the same for running your own scalable wordpress install!

[+] donmcronald|6 years ago|reply
The technology is awesome, but I won't use Cloudformation, Azure Resource Manager templates, etc. until AWS, Azure, etc. support spending limits. Getting into the habit of clicking "Deploy Stack" when you're credit card is attached to an account that allows unlimited spending seems risky to me.
[+] t0astbread|6 years ago|reply
What benefit does this have over Netlify?
[+] triangleman|6 years ago|reply
You can put AWS Engineer on your resume.
[+] pier25|6 years ago|reply
Or Firebase hosting?
[+] blairanderson|6 years ago|reply
TL;DR this is an AWS stack with 10 AWS services required to build/deploy a static site with HTTPS/CDN

I will be staying with netlify

[+] d-sc|6 years ago|reply
I just built my first static page since middle school this last weekend using netlify and a static site generator [Publii]. I was amazed at how simple and fast netlify is.

I’m confident I could figure out how how to do something much more complicated. But I want to focus on other things and it’s nice to not have to think about it.

[+] vnglst|6 years ago|reply
And, if I’m not mistaken, it’s also missing the 1-command-deploy-a-completely-new-version-but-also-keep-the-current-one feature.

It’s still a cool project though, since it shows exactly how many problems Netlify solves for us

[+] pier25|6 years ago|reply
Off topic, but what did you use to draw the flow diagram?
[+] cloudkj|6 years ago|reply
The AWS CloudFormation console has a "Designer" tool that allows drag-and-drop creation of template files, and also visualizes existing JSON or YAML template files with these diagrams.