Wednesday, August 12, 2009

Using a Custom Domain with Google App Engine

By default, when you publish an application to Google App Engine the site is accessible though [your-app-id].appspot.com. You can provide a custom domain name for your application, but the process, while not difficult, is not straight forward, immediately intuitive, or quick. In summary the process is:

  1. If required, purchase your domain name.

  2. Sign up for a free Google Apps standard edition account for your custom domain

  3. Add the App Engine to your domain

  4. Set up mail and disable services on the custom Google Apps account if required


Purchase your domain name


This is the regular process for purchasing a domain name from any one of a hundred registrars worldwide. I use GoDaddy for domain names without the country name (.com etc) and for Australian (.au) domains I use NetRegistry. If you already have a domain (possibly hosting non-Google sites) that is fine as well.

Setting up a Google Apps Standard


You require a Google Apps domain for your custom domain. Go to the Google Apps page to create one if required. For the purposes of using a custom domain for a App Engine application, you only need the standard edition; do not let Google upsell you the Premier edition if you do not need it for that domain.

During or after creating the Google Apps account you will need to verify your ownership of the domain, by either creating a dummy DNS CNAME entry or by placing a specific file on your web site.

Note that aliasing domain names to another Google Apps account (used currently to allows multiple email address domains) does not work. You must have a Google Apps domain specifically for your chosen App Engine application domain.

Add the App Engine application to your Google Apps account


On your Google App control panel, use the Add more services link to add your Google App Engine by applicaton id. Note that the act of adding the application to a Google Apps domain has no affect on the Google login authentication model (all Google users or Domain users only) option selected when you first create the App Engine application.

Once added, you will need to customise the URL. From the services dashboard (still on the Google Apps control panel), click on the name of your application (the application id) and then on 'Add new URL'. Google will then step you through the process of modifying your domain registrar's DNS settings so that the URL will work with Google apps.

Its worth noting that you do not have to make these changes at your registrar. If you are currently using hosted name servers and your web host provides DNS zone configuration options on their control panel, you can make the same change there (adding or updating the CNAME entry for the subdomain you wish to use for your application, such as 'www').

Once done, you should be able to use your custom domain to call your App Engine application, but you should also consider doing some cleanup of that brand new Google Apps account.

Set up mail and disable services on the custom Google Apps account if required


You should take the time to activate and set up your email on the new Google Apps account. Click the activate link under the email service on the Google App administration panel. Once again you will need to visit your domain registrar or domain host and configure DNS settings, this time four or five MX record entries.

If your domain is already hosted and provides mail services, you do not need to do this step, but using Google Apps for your domain email may become important in the future, and it is unclear if emails sent to the domain directly from Google even refer to the MX records or are routed internally to the Google inbox.

You will probably want to also set a catch-all email address for the domain. You can find this setting on the Service settings page for mail on the Google Apps control panel's dashboard.

Once this is complete you should be able to send email to your domain and receive them in your administrator's domain mailbox on Google apps.

If you do not want to log into your App Engine Google Apps account just to monitor your domain email, take the time to set up either message forwarding or enabling POP or email access for your primary mail client to monitor the account.

Lastly, consider disabling the other Google Apps features in the new Google Apps account that you do not intend to use, such as Docs, sites, contacts and so forth.

Comments


The end-to-end process for setting up a custom domain for a Google App Engine application, as you have seen, can definitely streamlined and made easier for App Engine developers with no interest in Google Apps.

In my case, I already owned a Google Apps domain, so I would have preferred not to create a completely new account. On the other hand, the requirement for Google Apps allows Google to re-use their domain verification and URL customisation functions, and provide the user with an email inbox, which may be important in the future when Google App Engine allows you to receive email from your application.

If you have any problems attaching your (sub) domain to Google App Engine, or if you have any other comments, please let me know.

2 comments:

  1. Thanks! for taking the time to post this! I am currently adding an app engine account to my google apps account.

    ReplyDelete
  2. I really want to thank the author for such a nice blog that helped me to understand why it is important. Domain Email Finder

    ReplyDelete