Random Infrastructure Ramblings

Although I've been a little discontent about Windows Mobile development lately, I have nothing but good things to say about Microsoft software products in general. They have the best offerings in desktop and server operating systems, best office productivity applications, infrastructure services, and by far the best development tools.

Conversely, Google provides the best of everything in the way of web related services: maps, email, hosting, browser, blogging, etc.

Around a year or so ago, I decided to (re)purchase koushikdutta.com. I wasn't really sure what I was going to do with it at the time. I just figured that my domain name should probably belong to me. I'd heard some good things about Google Apps hosting services, and decided to try it out. The whole ordeal cost me 10 bucks, so it was a no brainer really.

It took me a few weeks of learning and tinkering to get my infrastructure setup perfect, but I ended up with an infrastructure that I'm very happy with:

  • It can resolve home.koushikdutta.com to a dynamic IP so I can reach my computer from anywhere.
  • Blogger is set up to host my blog on www.koushikdutta.com.
  • All my mail is mirrored between an internal Exchange server and my account Gmail hosted by Google Apps (@koushikdutta.com).
  • ActiveSync and Gmail push to both my Windows Mobile and Android phones.
  • VPN into my home network from anywhere.

 

Hosting a top level Domain from a Dynamic IP

When your router connects to your ISP, it gets a "lease" on an IP. That lease generally expires after a few days, at which point, you may get a different IP. This is called a "dynamic IP". And since the IP is changing fairly regularly, you normally can't associate a domain to it.

For those not in on this little secret, there is a free service called DynDNS that allows you to map a dynamic IP to one of DynDNS's subdomains. With the DynDNS Update Client, your computer can watch for IP changes and report them to DynDNS. DynDNS will then update the IP address of your domain name.

In my case, my router actually supports the DynDNS Service:

dyndns

As you can see, my home network is can be resolved from the internet via clockwork.dyndns.org. So now I have a CNAME that is hooked to a shifty IP. The next step is to have my domain, koushikdutta.com, resolve to clockwork.dyndns.org. By going into the Advanced DNS settings for my Google hosted domain (which is backed by www.enom.com), I set a couple subdomains of koushikdutta.com to resolve to my DynDNS subdomain:

dns.

As you can see, home.koushikdutta.com, mail.koushikdutta.com and clockworks.koushikdutta.com all point to my DynDNS address, which in turn points to my home network.

Remote Desktop is indisposable for me nowadays. Couple that with DynDNS, and I can access my computer remotely from anywhere.

 

Pointing a Domain hosted by Google to a Blog hosted by Blogger

I did not have www.koushikdutta.com or koushikdutta.com resolve to my home IP, because I want them to go to my blog hosted by Blogger. If your domain was purchased through Google Apps, setting it up to play nicely with Blogger is really simple. Just go to your Blogger account settings and click on the Publishing tab to publish to a custom domain:

blogger

 

Gmail and Exchange Integration

Gmail is a pretty fantastic email hosting service. Not really because of the web client, storage space, or any of the other random features. It's great because the spam filter actually works:

Email Account Spam in my Inbox
11.30.08 - 12.06.08
Gmail 0
Hotmail 2
Yahoo! 38

Admittedly, Hotmail isn't that bad either. But for some reason Microsoft decided that standard offerings from other services like IMAP and POP3 access should only be available to people with a Premium Membership.

My goal in this part of the project was a little nonstandard: I wanted to access the same mail via the Gmail interface and also have that email synchronized to my Exchange server. Gmail would provide a 99.9% reliable delivery destination and a trusted SMTP server for handshaking so my emails don't get caught in a spam filters. And Exchange would give me the nicety of being able to access my email through Outlook as well as ActiveSync for my Windows Mobile phones.

So, I first set up Google Apps to provide Gmail service for koushikdutta.com and added the mail accounts:

googleappsmail googleappsaccounts

With that I would have a working Gmail account at koushikdutta.com. Next step was to set up my Exchange server account to accept mail to a couple different addresses:

exchangesetup

Notice that I have an email@clockwork.dyndns.org in that list. This email address alias provides the means of mirroring the Gmail and Exchange accounts. My Gmail account redirects all my mail to this alias:

gmailsettings

Note that this is actually doing a redirect, and not a forward. So when my Exchange server receives it, it thinks that it received an email for email@koushikdutta.com and not email@clockwork.dyndns.org.

The last step is to set up my Exchange server to use Gmail's SMTP servers. This can be done by setting up an Exchange Send Connector that routes mail through a Smart Host (smtp.gmail.com):

exchangesmtpsetup

I could forego this step, but then my mails may end bouncing due to it coming from a unauthenticated source (my personal computer), thus ending up in a Junk Mail folder. And since it is sent through Gmail's SMTP server, the sent emails will also show up in your Sent folder in that account. (Note: Emails sent through the Gmail interface will NOT show up in the Exchange sent items)

Finally, I forwarded my @gmail.com and @hotmail.com mails to @koushikdutta.com. The end result looks something like this:

infrastructure

I get push email from any account to both my phones!

 

VMs, Data Backup, et al.

This isn't really related to this article, but server setup and management is so trivial with Microsoft products. Hate to sound like a zealot, but it's true. Currently, I have one physical machine that hosts 2 Domain Controllers, 1 Exchange Server, and 1 Team Foundation Server (for source control).

hyperv

My biggest concern with this setup was "What happens if my VM host machine dies?". There's no need for SQL replication or some other process that would only back up your data. For this, there is a quick and easy solution. Just mirror the entire disk that hosts the VMs. So if your VM host or any one hard drive crashes, no data is lost, including the state of the machines hosting the services:

diskmirror

Incidentally, my VM host did explode/die a few months ago. It took me around 1 hour to go buy replacement parts from Fry's. And it took me around 10 minutes to transfer the VMs to the new computer I built.

0 comments: