Monday Oct 14, 2013

Configure a Domain Name for an OpenShift Application

While getting Roller up and running on OpenShift was relatively quick and easy, it took longer to get my application to work with one of my domain names. I followed the instructions provided, which included configuring a CNAME with my DNS provider, but it still wouldn't work. I also added an A entry for the IP address, but that didn't help either.

Eventually, I found an entry in the OpenShift forum where someone was having a problem configuring multiple domains for a DIY gear Tomcat instance. I was only trying to configure one domain, but I am using Tomcat in a DIY gear. Following the example in the forum post, I added an extra <Host> entry to my server.xml file, but this didn't work. After reading about the Tomcat host container, and trying several differnt combinations. I finally figured out a configuration that worked.

The Tomcat host container documentation stated that if using multiple <Host> elements, "exactly one of the Hosts associated with each Engine MUST have a name matching the defaultHost attribute of that Engine.". For my Tomcat instance, the defaultHost was set to a value of "OPENSHIFT_DIY_IP", which is equal to the IP of the OpenShift app. So I removed all but the original <Host> entry, and set its name to match the defaultHost value. Previously, the original <Host> entry had a name of "OPENSHIFT_APP_DNS", which is equal to the application's default domain name: <appname>-<domainname>.rhcloud.com.

Once I pushed this change to origin, and the application restarted, I was able to access my application with my domain name. And the application's default domain name still worked too, which wasn't the case with some of my previous attempts.

By getting my application to work with a domain name that I can control, I was able to add Google Analytics, for which I already had an account for the domain. It also helped me to verify ownership of the site with both Google and Bing Webmaster tools.

Sunday Oct 13, 2013

Apache Roller on OpenShift

I previously maintained an Apache Roller-based blog hosted by KGB Internet Services. I had no problems with KGB Internet Services, in fact, they were great. I just wasn't a very active blogger, and traffic to my site was next to nothing, so it wasn't worth the monthly fee. So a few months ago, I shut down my blog, and cancelled the hosting service.

But I'm interested in learning more about the various Platforms as a service (PaaS) that are available. I couldn't decide on a platform to start with, until I found a blog entry by Glen Mazza that showed how to deploy Apache Roller on Red Hat OpenShift. I'm familiar with Roller, and I like how OpenShift's deployment process uses Git, so I decided to give it a try. Plus, OpenShift's free pricing plan was very attractive. Following Glen's instructions, I had a Roller instance up and running in about an hour. And this is my first entry on the new blog.

I still want to learn more about the other popular PaaS providers, but I'll experiment with OpenShift for awhile. So far, I've only used with DIY and MySQL cartridges. But I want to take a close look at the others, especially the JBoss ones, since I use JBoss daily at work.

So if it it's easy to work with, and performs well, I'll probably keep this blog up and running.