24 ms·
Show HN: Scar – Static websites with HTTPS, a global CDN, and custom domains
- bsingh4 7y agoYou've only taken care of the surface-level complexity with AWS. Want to do something more like add a header to the response? Well then, create a lambda, deploy it to the edge, and pay per page view. This is something Firebase is much more elegant at - the initial deploy, and then evolution and addition of features geared to static site deployment.
- paulgb 7y agoThis is cool, I'm glad somebody built this! I love netlify but I worry about vendor lock-in.
- quaffapint 7y agoWhy do you worry about vendor lock-in with netlify? They host static sites, so you are free to go anywhere. Unless you happen to be using their other services which this doesn't address anyway.
- chrisfinazzo 7y agoThis is my concern in a nutshell, unless someone has a tool that spits out a properly formatted .htaccess so I can migrate my HTTP headers and redirect rules. Netlify's playground is easy to use for setting this up, but I'd also like to have this available in a standard format - just as an escape hatch in case I need it. https://www.htaccessredirect.net https://www.htaccessredirect.net is there, but I'm thinking even less configuration if that's possible.
- gk1 7y agoNetlify doesn’t hold your files; they stay in GitHub or whatever repo you decide to use.
- reificator 7y agoI'm usually paranoid about vendor lock in, but I can't join you on this one. Netlify assumes a version control repository that you can pull from, run a build step, and then host static files from. The build tools are open source, the output is static and trivial to download and rehost, and the repository is git meaning one clone is all you need to port to any other service. Where exactly is the vendor lock in?
- StavrosK 7y agoNowhere (unless you use Netlify-specific features like Lambdas, forms etc). You can just copy your static site elsewhere and you're ready.
- paulgb 7y agoIt's not so much my code that is locked in, as that netlify has spoiled me by making deployment so streamlined that it would be hard to go back to manual deployment. This gives me another option, which I appreciate. That's all I meant.
- reificator 7y agoNetlify makes things easier, but S3 + Cloudfront + Route53 (Or insert favorite cloud vendor here) for a static site is not that far behind.
- holtalanm 7y agothis doesn't solve vendor lock-in. You're just trading one vendor for another.
- blairanderson 7y agoTL;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
- vnglst 7y agoAnd, 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
- d-sc 7y agoI 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.
- dlhavema 7y agoYeah, super cool! Thanks, this was the only part I was unclear about in connecting the domain to the bucket easily..
- jaden 7y agoGitHub 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/ https://pages.github.com/
- fjp 7y agoI have two sites up using GitHub Pages + Cloudflare and it's super easy and enjoyable
- jkarneges 7y agoIt even gives you a CDN. GitHub Pages is fronted by Fastly.
- ainiriand 7y agoLegitimate doubt: Fronted or frontended?
- masukomi 7y agofrontended doesn't make sense as a word. Fronted has many somewhat applicable definitions including * provide (something) with a front or facing of a particular type or material. * act as a front or cover for someone or something acting illegally or wishing to conceal something. "he fronted for them in illegal property deals" * stand face to face with; confront.
- morenoh149 7y agogreat 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 7y agoThe 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.
- tamalsaha001 7y agoHow 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.
- gvand 7y agoNice 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 7y agoThe 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 7y agoWhat 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.
- dvfjsdhgfv 7y ago> you can literally just CNAME www.yoursite.com to yoursite.gitlab.io After so many years I still can't really understand how easily people hand over almost complete control over their site to someone else, just because everyone else does. It's like handing over your e-mail account passwords when LinkedIn started. Yes, CloudFlare, Google and others are helping you, but there is a price to pay that might not be immediately visible.
- js2 7y agoThe lambda stuff is there just to upload the welcome.html? Also, maybe consider configuring a logs bucket for the cloudfront logs?
- t0astbread 7y agoWhat benefit does this have over Netlify?
- pier25 7y agoOr Firebase hosting?
- triangleman 7y agoYou can put AWS Engineer on your resume.
- vidyesh 7y agoGives you substance to attend AWS Global summits.
- jareware 7y agoSame feature set - plus a few extras like Basic Auth support, custom headers, preventing direct access to the underlying S3 bucket - implemented as a reusable Terraform module: https://github.com/futurice/terraform-utils/tree/master/aws_static_site https://github.com/futurice/terraform-utils/tree/master/aws_...
- iBelieve 7y agoFor anyone looking for a hosted solution, https://surge.sh/ 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.)
- cloudkj 7y agoI was actually wondering that myself: Is there interest in a hosted service? It'd be quite similar to (as many comments have suggested) Netlify and the one you linked to. I was mostly going for a DIY solution since I wanted to "own" the bits being deployed while remaining as close to the infrastructure as possible. Providing a hosted service somewhat moves away from the DIY spirit; I suppose additional tools/UIs could be offered to simplify setup and deployment and still run everything directly on AWS, but at that point one might be inclined to just move to one of the other hosted solutions for the simplicity.
- djsumdog 7y agoHow 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 https://github.com/sumdog/bee2
- 1023bytes 7y agoMy 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 7y agoIt 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.
- huphtur 7y agoRecently moved some static sites from S3 to AWS Amplify Console. Super easy setup and even easier maintenance with the Git-based workflow: https://aws.amazon.com/amplify/console/ https://aws.amazon.com/amplify/console/
- kaiku 7y agoBundling 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?
- IanCal 7y agoI think that behaviour should be handled with index documents in S3, without the need for lambda: https://docs.aws.amazon.com/AmazonS3/latest/dev/IndexDocumentSupport.html https://docs.aws.amazon.com/AmazonS3/latest/dev/IndexDocumen...
- FelipeCortez 7y agoI've always used it this way and it works fine indeed.
- cloudkj 7y agoThat 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.
- singingwolfboy 7y agoI wrote a tutorial for how to do all this setup manually, if you prefer: https://www.davidbaumgold.com/tutorials/host-static-site-aws-s3-cloudfront/ https://www.davidbaumgold.com/tutorials/host-static-site-aws... Sometimes it’s nice to understand how all the pieces fit together, instead of using an automated system!
- pier25 7y agoOff topic, but what did you use to draw the flow diagram?
- faheel 7y agoJust use Netlify.
- ryanisnan 7y agoOther than the notion that all traffic should be served over HTTPs, if you have purely static site, why the big fuss?
- thethirdone 7y agoWithout HTTPs links could be replaced and executable file downloads could be replaced with malware.
- ryanisnan 7y agoRight, I wasn't thinking about mitm concerns.
- ummonk 7y agoYou can enable HSTS preload and prevent spoofing.
- dumboluzz 7y agopeople sniffing on what kind of static content you are consuming. think public unsecured wifis or sensitive material.
- ryanisnan 7y agoTrue. I suppose for many types of content that could be a legitimate concern.
- woogley 7y agoThere are plenty of reasons even beyond privacy and MITM content changes. Supposedly HTTPS is better for SEO and also there are browser APIs[1] that only work in HTTPS context [1]: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts/features_restricted_to_secure_contexts https://developer.mozilla.org/en-US/docs/Web/Security/Secure...
- ryanisnan 7y ago
- romanovcode 7y agoHow to host static website with HTTPS, a global CDN and custom domains for free: 1. Setup public repo with Hugo project 2. Add Travis CI integration with GH Pages 3. Use CloudFlare for free SSL + other goodies Why would anyone need this?
- whereareyouwow 7y agoTotally agree! Only thing is GH pages might limit your size at some point... Wish they would introduce a per GB pricing and allow you to scale. That would make it a permanent solution.
- anvarik 7y agoyou lost me at GoDaddy
- fishtoaster 7y agoLooks very similar to my project https://github.com/kkuchta/scarr 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!
- cloudkj 7y agoWow, that is a fun coincidence! Indeed, I was going for a catchy four-letter acronym in the same vein as popular stacks like LAMP or MEAN. Perhaps the fact that we both landed on the same components and permutation of components means that there's something there :) I also started off in the same manner of implementation - bash scripts wrapping AWS CLI calls - then stumbled upon the more straightforward, template based approach.
- sova 7y agoHa, so cool that you both ended up in the same end of the Sphinx! =)
- NateEag 7y agoAm 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?
- mevile 7y ago> 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.
- codegladiator 7y agoNo, vendor lock in can mean a lot, from lets say even a simple plain API implementation, where one vendor might implement something(storage for eg) in a way where its not possible for the other vendor. I recently moved one of my k8s cluster from gc to aws, even terminology change can introduce a lot of awkwardness.
- shshhdhs 7y agoI 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
- danpalmer 7y agoHN won't take a static website on a $5 VM down if it's set up even remotely correctly. Traffic to a popular link on HN is likely to get on the order of ~100rps max (more likely 1-10rps). Nginx will handle that with no problem. CDNs may make a site a bit faster, but for a static site it's unlikely to make much difference if you're on a good host in US/EU or central Asia. If you're hosting in Australia or Japan, maybe it might be a little slower than expected, but still totally usable.
- whalesalad 7y agoI 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.
- cloudkj 7y agoI think the complexity for this setup is about the same. Once the different AWS services are provisioned during the initial setup, subsequent deploys are quite straightforward. For example, I have a three-line Makefile target for Jekyll sites that looks something like this (using Docker with a local `aws-cli` image wrapping the CLI): docker run --rm -e "JEKYLL_ENV=production" -v $(PWD)/src:/srv/jekyll -it jekyll/jekyll:3.8.5 jekyll build docker run --rm -itv $(HOME)/.aws:/root/.aws aws-cli aws s3 sync src/_site s3://www.<mydomain> docker run --rm -itv $(HOME)/.aws:/root/.aws aws-cli aws cloudfront create-invalidation --distribution-id <mydistribution> --paths "/*"
- vijaybritto 7y agoThis seems like a nightmare to setup and maintain for a new comer. Netlify lets us setup things in a whiff. This is a nice project but not for anyone below intermediate.
- tempsolution 7y agoHa I just did the exact same thing yesterday evening... Funny how stuff like this hits place one in HackerNews these days.
- adontz 7y agoI did the same on azure a few days ago and it was much much easier.
- rsweeney21 7y agoWe 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 7y agoDoes the webflow save to a git repo?
- rsweeney21 7y agoYes. It also provides a really nice UI for building our www site which we like to rev frequently. Webflow is the bomb if you are familiar with HTML and CSS. Super clean HTML, total control over all the css attributes, drag and drop builder.
- donmcronald 7y agoIs it a completely hosted service? It looks cool, but I'd be reluctant to use it if it's a subscription to an online tool where I have to pay forever. Is there a standalone version of that editor?
- rsweeney21 7y agoIt is hosted, but you can use it free forever if you have Netlify in front of it and use your free sitename.webflow.io URL as your origin server. You can also export your site as static html if you want.
- gcb0 7y agolooking at webflow, i have flashbacks (not sure if the good kind) of macromedia fireworks in the 2000's.
- timClicks 7y agoSorry to nitpick, but "Copyright © 2019" isn't a "license". It's not even a full copyright declaration without listing an owner.
- tide_ad 7y agoSorry to nitpick, but copyright declarations are a thing of the past in many nations with copyright protections automatically conveyed upon creation, registration only necessary within a short time after infringement was detected, with registration serving to only maximize the monetary sanction the government will levy on your behalf. and regarding license, they have the MIT license added to the repository
- pbhjpbhj 7y ago>"a full copyright declaration" A what? In the majority of the World copyright has been automatic for about 140 years. How you get copyright is you make a work. No need to put anything else on it. IIRC there are about 3 countries that aren't signatories to the Paris Convention. In USA you can file a notice in order to get better treatment in court, but it's not been required for 40 years or so, is that what you're referring to? FWIW the license is very clearly MIT, https://github.com/cloudkj/scar/blob/master/LICENSE https://github.com/cloudkj/scar/blob/master/LICENSE.
- myresume 7y agoTry out https://freepage.io https://freepage.io is much easier to use than github pages. You don't even have to create an account, verify email and all that nonsense to use it. And it has social media built in to get your page out there in to the world.
- srathi 7y agoHow much should this cost per month in AWS billing for a small static website?
- jboynyc 7y agoOf course that depends on what kinds of assets you serve and how many hits you get, but to provide a ballpark, I had a small personal site with few media assets on S3, and it consistently cost me US$0.12 per month. I think once it cost me 14 cents and I thought, "Wow, I must've been popular last month!" I didn't run analytics so I can't say how many hits it got, but traffic was probably fairly average for a personal site.
- enigmango 7y agoLess then $1/month if you've got low traffic. I haven't used this, but I have this type of setup for a static site that uses Hugo. - S3 costs: $0.10/month - Route53: $0.50/month ($0.50 per hosted zone) S3 costs could be lower - I have other buckets with stuff that count towards my cost.
- SadWebDeveloper 7y agoAnyone 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
- RobGav 7y agoIf may I suggest the simplest solution to have static site with GUI and GitHub or Gitlab support is Publii - https://getpublii.com https://getpublii.com
- shapiro92 7y agoThis is highly complex for no reason. GitHubPages, Netify provide you with easy to use custom static page hosting. Your abstraction is nice, but the learning curve for someone is incredibly high for such a setup.