Tuesday, July 1, 2014

Using a custom domain for my Bluemix Python-based weather app

Last week I played with IBM Bluemix, Python, and JSON to deploy a (very) simple weather application. Now, as an enhancement, I wanted to use my own subdomain for that app. I succeeded, here is how.

One of my own domains is "4loeser.net" which I use, e.g., for this blog. To avoid collisions with some other services linked to this domain, I created a subdomain "bm" (as in BlueMix). Next I added a CNAME entry to route all requests for "bm.4loeser.net" to "mybluemix.net".

CNAME entry

That was the easy part. The next is more complex because it requires two simple steps, not just one. In my Bluemix account I have to click on my email address in the upper right corner. The pulldown menu has an entry "Manage Organizations". Then, in the admin panel, you select "domains" and add your custom domain.
Add a custom domain to Bluemix
The second step is to make your application available under your domain. For that you have to route it to that additional name. It can be done by clicking on the button for application settings in the upper right corner (circled in red) and choosing "edit routes":
Application settings in Bluemix
That brings up a panel where you can define the routes to your application. In my case I added http://weather.bm.4loeser.net as a second option. I could have removed the mybluemix-based route.
Route the Bluemix app to your domain
What is left is some testing and writing up my experience. Done.

Update: There is a follow-up article describing how I added a Cloudant / couchDB database to my Python application on Bluemix.