Monday, January 5, 2009

Personal Web Hosting with App Engine

A few days ago I got a notice from my hosting company that my year long contract has expiring soon. I was using this hosting for three small websites that are 100% static and figured that there should be a cheaper way to get this done.

My first instinct was to look at Amazon S3 as their storage and bandwidth rates are pretty good. For my usage pattern I'd be looking at paying pennies per month to host all three sites. Unfortunately there's one fairly major flaw in web access to S3 that makes hosting an entire website there a non-starter. There is no way currently to set up a S3 bucket to host a file from the root of the bucket (i.e. http://www.jamesbogosian.com/ cannot be set up to serve http://www.jamesbogosian.com/index.html).

After thinking about it some more I realized that even though Google App Engine is designed to host dynamic websites that it could be easily used to suit my needs. Here are the steps that I took to get this working:

  1. Sign up for Google Apps for the domain in question (jamesbogosian.com)
  2. Log into App Engine and create a new application
  3. Download all of the content from jamesbogosian.com and place it in a directory named "static"
  4. Create an app.yaml file at the same level as the static directory that looks like this one (replacing your app ID from step 2 on the first line)
  5. Using appcfg.py from the App Engine SDK (download this if you haven't already), upload your "application" to appspot.com
  6. Log into Google Apps control panel and select "Add more services"
  7. Add your application to this domain by providing the app ID, and choose to host the "application" off of www.yourdomain.com
  8. Add or edit the "www" CNAME on your domain to point to ghs.google.com
  9. In most cases you will also want to redirect your naked domain (i.e. jamesbogosian.com) to www. This is different for each domain registar / DNS set-up. I use GoDaddy, and there was a small trick to get this working (I think)
    1. In the GoDaddy Domain Management tool, set up the forwarding from http://yourdomain.com to http://www.yourdomain.com, as a 301 redirect
    2. In the GoDaddy Total DNS Control and MX Records tool, change the A Record on your domain to point to 64.202.189.170 (this seems to be the way to get forwarding to actually work)


Now, there are a few limitations worth noting:

  • There is a single file size limitation of one meg.

  • There is a file count limitation of 1,000 files. You can work around this by using the zipserve module.

  • Spikes in traffic may currently be greeted with quota errors, but if you're talking about doing real low-traffic hosting I'd imagine that would never happen

20 comments:

Kilohoku150 said...

Just pointing www to @ should do. You shouldn't need a 301 redirect.

Bogo said...

Unfortunately you cannot serve App Engine applications off of the naked domain (yourdomain.com), which is why www is CNAMEd to ghs.google.com and the naked domain redirects there.

abhi said...

hey Bogo, I tried replicating the steps that you out lined but it does not seem to be working. I am still getting redirected automatically to google sites. Any sugegstions/help is highly appreciated

Bogo said...

Abhi,

I'm fairly certain that I wrote these directions down accurately as I was doing it. I've got four separate domains set up this way with no problem. Without being able to log into your domain etc. it'd be pretty hard to help :)

Bevin said...

Starting from the beginning, having downloaded the GAE SDK, my PC automatically converted the .py files with Python (check!). Then, the step you ask for about the app.yaml files, what is that, and how do I go about opening it? I tried opening the .py file, but I get a DOS interface with some code that just whizzes by the screen before the program disappears. I want to just be able to 1. click to logon, 2. upload, 3. logoff. Can I do that? Thanks.

Bogo said...

Bevin, the best I can offer are some links to the App Engine tutorials:

http://code.google.com/appengine/docs/python/gettingstarted/

specifically:

http://code.google.com/appengine/docs/python/gettingstarted/uploading.html

I've never done this with Windows, so I'm not sure if there is a GUI interface to the SDK.

Anonymous said...

Hi Bogo,

i am trying to do the domain redirect as you suggested, however i still get the godaddy ad page? any other suggestions?

thanks,

L

Bogo said...

No, sorry. I don't know much about GoDaddy hosting/DNS but like I said I've followed these instructions for four domains and it's seemed to work.

Anonymous said...

Thanks for the info but what does this line mean - In the GoDaddy Domain Management tool, set up the forwarding from http://yourdomain.com to http://www.yourdomain.com, as a 301 redirect.

Where do I set this redirect mapping? I am using godaddy and tried mapping @ to www but that throws an error.

Bogo said...

In the "Domain Manager" section of Go Daddy I see a section called "Domain Information". It's in the top left hand corner of the screen when managing my domain. In there is a section "Forwarding" with a manage link.

Anonymous said...

Thanks a lot. Very helpful post. Sorry to hijack this comment thread but just adding another link here for everyone one else who is going to land here with the problems I have been dealing with for the past 3 hours. There is a domain setting in the google apps that also needs changing =>
http://www.google.com/support/forum/p/Google+Apps/thread?tid=724ef70272546852&hl=en&search_impression_id=7c32251d6a27cbee%3A12250e72a95&search_source=related_question

Bogo said...

Not at all, more information is always good. Thanks for the follow up.

Dedicated Server said...

Are there any charges of this excellent service?

Warner Carter said...

They constantly have server downtime without alerting customers, and when you try to ask them about it, they immediately deny it ever happened. AVOID AVOID AVOID. I wish I could give them zero stars. Small business web hosting

Glen said...

I'm preparing to make my personal blog and looking forward to use app engine for such development. I hope these steps will be effective to make my personal web hosting easier. Thanks.

Leticia said...

Making a personal website I think will be easy for a newcomer through following above provided awesome blog making instructions. I wish in my blog creating time such instructions was there. Anyways keep up the good work through sharing helpful post!!

Zachary Levi said...

It's nice reading self-help guide in choosing hosting providers. It allows you to choose the right one for the kind of profession you're into. I really love this article. Thanks.

cheap minecraft server hosting

Casey said...

Personal web hosting with App engine seems like a great idea. I've never think of it. Thanks for letting know all the important details of such process. Looking forward to work with App engine.

Cheap Web Hosting said...

Sound like a very good idea of personal web hosting with App engine and I hope that here provided allocation will surely be handy for everyone to know this issue perfectly. Keep up the good work :)

Kylie Connor said...
This comment has been removed by a blog administrator.