Hacker News new | past | comments | ask | show | jobs | submit login
Free static page hosting on Google App Engine in minutes (fizerkhan.com)
95 points by fizerkhan on Feb 17, 2014 | hide | past | favorite | 63 comments



I host my personal website GAE. One thing to be aware of is when moving to a personal domain, you need to map to a subdomain so you can't use a naked domain[1] (e.g. 'http://github.com'). You have to map to something like 'www.'

[1] https://developers.google.com/appengine/kb/general#naked_dom...


This is the main reason why I haven't bothered switching to GAE for my static website. AWS + S3 + Route 53 allows hosting naked domains: http://aws.amazon.com/about-aws/whats-new/2012/12/27/root-do...


CloudFront allows naked domains, so you can use naked domains for almost anything if you place a layer of CF before it.

For example, for this case of GAE, you can use

  Naked domains <=> CloudFront <=> GAE


DNSimple allows you to use naked domains with cloud services, without using a CNAME.


This isn't really true. You just need to configure a redirect from the naked domain to your serving URL, at www.

For example, my site (justbeamit.com), runs on GAE, but the naked domain simply redirects to the www.


I thought about adding an edit in there to clarify you could do that, but I think the points remain that in the end, you still end up with www. in the URL bar.


The real reason is because you cannot add a CNAME record using the zone apex.

AWS gets away with this afaik with some magic to point to the IP address for the loadbalancer that would serve your content.

Techincally you can find the IP address for your GAE subdomain and add an A record for your apex domain, but keep in mind that this is a bad idea.


Did a quick comparison with my own service, BitBalloon.

On appengine you're just deploying a dynamic app that just routes everything to a static folder, but since Google doesn't know this is a static site, it's pretty limited what they can do to set good cache headers and optimize stuff for performance. So even if they have an awesome infrastructure, BitBalloon will make your site perform better.

Here's the quick test result from the same site uploaded to AppEngine and BitBalloon:

http://tools.pingdom.com/fpt/#!/vLi9d/http://teststaticsite.... http://tools.pingdom.com/fpt/#!/dwqwvX/http://speedtest.bitb...


That's a good observation. I wrote a small open-source script to do the same thing:

https://github.com/stochastic-technologies/static-appengine-...

It supports multiple domains for a single AppEngine instance, and custom URLs for each page. Pull requests for caching/headers/etc welcome!


The difference is much lower if you run the App Engine request a second time. The first time you run it, it needs to spin up an instance which can take some time. If I run it a second time I get 770ms for bitballoon and 955ms for App Engine, which is much less significant. Also, running the test from my local computer, app engine wins out presumably because Google's network is basically unmatched when it comes to proximity to your users.

Additionally, if you actually define your static files as static, then it doesn't even need to spin up instances to serve them.

I've certainly had my criticisms of App Engine in the past, and for certain workloads it's not appropriate [1], but for mostly read only websites like blogs, news, landing pages, I even run a forum on app engine, it's perfect.

In fact, that blog post where I complain about the cost of app engine for hosting my game is itself hosted on app engine. It cost me 6c the day it hit the front page of hn. I pay more for the domain than I do for app engine hosting.

[1]: http://www.war-worlds.com/blog/2013/06/switched-away-from-ap...


I believe App Engine actually has specific handling for files you identify as being static. This bypasses much of the dynamic overhead.



The speed difference is negligible. The price difference for a custom domain is not.


Peoples definition of negligible probably varies.

Half a second is definitively enough that plenty of large scale tests have shown differences in conversion rate.

That difference gets much bigger for people with more than 1 page view due to perfect caching headers.


GitHub Pages is even easier to set up, and does support naked domains (although to use their CDN it is limited to DNS providers that support ALIAS records) -- https://github.com/blog/1715-faster-more-awesome-github-page...


Yeah, I'd personally rather have naked domains than a couple hundred milliseconds better performance for my static sites (which are basic and small pretty much by definition.)


"Moreover it is faster than other static hosting services. Because it runs on Google infrastructure."

Um, wow.


I actually benchmarked this a while ago. I use a lot of static pages that need to be absurdly fast.

I can definitively say that unless Google App Engine has substantially changed in architecture over the last 12 months, it is definitely not faster to host your static site there rather than on an nginx-based VPS with someone like Digital Ocean.

My tests showed load times on GAE-hosted static sites to be around 200ms - 300ms slower than a reasonably-optimised DO VPS.

It's possible, of course, that GAE would pick up some speed if you're loading the page from somewhere a long way away from the equivalent VPS, as GAE essentially comes with a built-in CDN (to the best of my understanding).


Thanks for actually doing the research on this. My "um, wow" was a response to people assuming Company XYZ's performance is amazing at face value.

When serving static pages, it is unlikely that any sort of engine will outperform something more like a CDN. I hate it when people just throw out the Google name as proof of performance/excellence/etc. Can we be a bit more scientific here?


Elie Bursztein leads Google's anti-abuse research, and recently mentioned on Google+ that he moved his personal web site to GAE: http://www.elie.net/

I can load his GAE-hosted web site in ~300ms, and there's a useful performance box on the right sidebar of his site that breaks down how long each component takes to load on GAE:

$ time curl http://www.elie.net/ > /dev/null % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 36146 0 36146 0 0 113k 0 --:--:-- --:--:-- --:--:-- 114k real 0m0.316s user 0m0.005s sys 0m0.005s

I've been thinking of doing the same with my personal web site but haven't yet.


Interesting - that's 100ms faster than the test sites I was using.

Do you know what language he used to implement the base setup? I had a suspicion that implementing in Go might end up being faster than Python.


From some of his other posts I'm 99% sure that he used Python.


The great thing about static sites is that it's really easy to put them behind a CDN. Amazon Cloudfront is pay-what-you-use and seems pretty reasonable especially for smallish sites.


We currently use a mix of Akamai (100TB/month commit, static assets), Cloudfront (serves a static JS site out of S3, 10-50GB/month of usage), and Cloudflare (caches JSON get requests from an Elastic Beanstalk REST API). I've found Cloudfront to be faster than Akamai (although a bit pricier unless you're committing to 10TB+/month from a specific region), and Cloudflare to be faster than both (although with Cloudflare I can't invalidate individual files/URI paths, just the whole site, which I can live with).


Correct me if I'm wrong, but doesn't Akamai have a not-insignificant minimum monthly charge?

And does Cloudflare cache HTML pages? Last I checked it only cached (what it considered) static assets and hit the origin for every page.


> Correct me if I'm wrong, but doesn't Akamai have a not-insignificant minimum monthly charge?

Yes. "It was like that when I got here." I'm working on it.

> And does Cloudflare cache HTML pages? Last I checked it only cached (what it considered) static assets and hit the origin for every page.

Yes. This is configurable.


Need to create page rules if you want to cache HTML pages.

Also, cloudflare does support clearing of individual files. There is an API for it. Pretty sure their web client does too.


Is there a way to redirect all[1] requests to index.html? The use case is an Ember app that uses history location and is deployed as a static website. In this case, requests to `/whatever` still need to serve index.html and let Ember handle the routing. Can GAE app.yaml specify rules like this?

I ran into this problem with S3 and ended up writing a simple server to handle it and deploying to Heroku.

[1] By all, I mean all except the ones to /assets or something similar.


Did you try using Cloudfront with S3? I believe it solves the problem you detailed with regards to redirects.


Nope, didn't try Cloudfront. I'll look into it, thanks!


If you still run into problems, reply back to this and I can get in touch to help (no cost).


Something like this?

handlers:

- url: /.*

  mime_type: text/html

  static_files: static/index.html

  upload: static/index.html
Anything you don't want to go to index.html you can just put before that handler since it processes the app.yaml from top to bottom and stops at the first match.


How is it better than just using Dropbox or S3 or even Google Drive to host static content?


If you want mostly free hosting I built this a long time ago. http://www.cdninabox.com/ it mirrors any site with caching using Google Edge cache.

Because it will handle URL Re-Writes you can host on any host in a subdirectory and still have it be your root for the customer.

I mostly abandoned this when Google Launched "PageSpeed" for appengine which was too much a direct competitor. Also when they moved to AppsForDomains you could no longer have a naked domain, and that was annoying. I don't like www. having to be on the front of my URL.


From years back, there was a tool created called DryDrop[1] that allows you to publish static GAE sites via GitHub push.

[1] http://drydrop.binaryage.com/



Somewhat related, I've recently found and evaluated nodejs static site generators (including ghost which I find vastly overhyped and still too stuck in wordpress way of doing things). And the relatively unknown wintersmith [1] is just so awesome that it really needs some mention. It's easy to get started, relatively well documented compared to others, and you have full control to extend it should you need to.

[1] http://wintersmith.io


Putting up a landing page for a 'parked' domain name would be a great use of this. Rather than letting your registrar put up a page where they make money off of the clicks.


I have my personal site hosted on Google App Engine too. Must say its sleek and simple. I had evaluated a lot of other (typical) options like EC2, Dropbox(S3) and even Github pages. Nothing came close to the ease and the performance that GAE gives. Benchmarking about 10 URLs on my site, returned an a.r.t of 3.5ms aggregate on GAE vs 5.6 ms on EC2.


"All the services has its advantages and disadvantages over other."

What's wrong with this sentence?


Congratulations -- you've just joined the club of people who've learned that programmers, extraordinarily aware of computer program syntax and having a desire to tune code endlessly, are almost all paradoxically hostile toward any attention paid to their broken English prose.


No, they are just lazy, let the compiler do the checking, a compiler known as HN.


I would love if when I typed a post into a text box such as this one or on Reddit, when I hit reply/submit spelling and grammar mistakes were autocorrected immediately before the post.

A wise man once said: If you want something done, ask the laziest person in the room how to do it.


Another wise man once said: If you want something done, ask the busiest person in the room, and it will be done :-)

A team made by the right combination of those two types will kick asses.


It's derogatory without being useful? Or did you mean the parent comment's?


It's not "derogatory" to point out that a sentence is grammatically flawed to the point of being incomprehensible.


It's grammatically flawed but perfectly comprehensible. Maybe the author speaks English as a second language and missed this one when proofreading.


The individual words may be comprehensible, but the sentence as a whole is very ambiguous and unclear. The most direct interpretation of it is contradictory, and beyond that it's pretty much nonsensical.

I don't think that anybody expects perfect English from people who may not have English as their first or primary language. That doesn't excuse sentences as broken and incomprehensible as the one in this case, however.

And it certainly is not "derogatory" in any way to point out writing that fails to convey whatever idea it was intended to. If anything, that's the best thing that can be done for the author. It's better for him or her to know that their writing has problems and cannot be understood properly, rather than not knowing this fact at all.


Did you really parse the sentence as "The service has nothing but its own advantages or disadvantages over ???other" with no need to backtrack?

I'm sure that if the author of that sentence doesn't master English yet, (s)he's pretty aware of it, and knowing that no matter what people can more or less understand really helps ensuring that (s)he will try again.


When learning a new language it is often difficult to master the little details. Swap out 'has' with 'have', 'its' with 'their', 'other' with 'others' and it changes to:

"All the services have their advantages and disadvantages over others"

Each of these differences may appear significant to a native speaker, but the basic meaning of each word is almost the same.


Seems you can set up custom DNS for your site too, with wildcards even. Pretty nifty.


Any limitations on traffic?


Free quota limitations are listed here:

https://developers.google.com/appengine/docs/quotas


Seems nice! How do you set up a custom domain name for it?



What service allows full SSL use without paying big bucks?


I quite like https://www.startssl.com , they are pretty cheap and even free in some cases. I still don't know why companies go for expensive certs.


Can you use one of the static site generators and git to publish your posts?


Yes, you can use push-to-deploy on a Google-hosted repo.

https://developers.google.com/appengine/docs/push-to-deploy


Since it's Google, I am sure one is allowed to use Adsense.


What are the advantages of using GAE over Github Pages?


To have your own domain running on GAE is not free anymore... and it is a ridiculous process to set it up.


I'm glad I stumbled onto the second page of hacker news, this is an absolute gem!




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

Search: