An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Converting corfield.org to Railo

March 28, 2009 ·

As you might imagine at this point in my Railo for Dummies series, I'm ready to try it on a real website such as my own. I've been running corfield.org on CFMX7 Standard Edition for a long, long time and never upgraded to CF8. Trying to run corfield.org on Railo has been on my 'todo' list for a long time as well and now seemed like as good a time as any. Here's how it went...I pushed the Tomcat 6.0.18 'tar.gz' file and the Railo 'war' file up to the server and discovered that Tomcat 6 will not run on Java 1.4.2 which is what my server had installed. I downloaded Java 6 Update 13 (it keeps getting updated!), pushed it up to the server and installed it. It wouldn't run. It seems the default heap sizes are too big for my poor little VPS, at least while I was running CFMX7 as well. I finally got Java 6 to run with -XX:PermSize=96M -Xmx196m so I created setenv.sh in the Tomcat bin folder containing:
#!/bin/sh
JAVA_OPTS="-XX:PermSize=96M -Xmx196m"; export JAVA_OPTS
JAVA_HOME=/opt/java6; export JAVA_HOME
This file is automatically run by Tomcat at startup to set various environment variables. Remember to make it executable! I wanted Tomcat to start at boot time on the VPS so I created /etc/init.d/tomcat containing:
#!/bin/sh
/opt/tomcat/bin/startup.sh > /dev/null
Again, don't forget to make it executable! Then I added a symbolic link in /etc/rc3.d/ (which is how other startup scripts are managed):
ln -s /etc/init.d/tomcat /etc/rc3.d/S90tomcat
I restarted the VPS and confirmed Tomcat was running. Yay! Following the Railo + Tomcat procedure from my earlier posts, I deployed Railo and tested that. I configured the datasource, mappings and so on that my site needs. I shutdown Tomcat, renamed ROOT to welcome and made the change to server.xml so that Tomcat's web root for the empty context was where my main site is deployed. After restarting Tomcat, I was able to browse to my blog (on port 8080) and navigate to other sections of my site. Yay! Then I removed the unused web applications from the Tomcat webapps folder (remember I said you should do that in production?).
Side note: I use a very old version of BlogCFC (3.5.2) and when testing my site locally, I discovered a small incompatibility in how parseDateTime() handles dates, between CFMX7 and Railo. BlogCFC assumes you can parse strings like "3 31, 2009 11:59PM" but Railo does not like that. I changed the string format to look like "2009-31-3 23:59:59" and that solved the problem. This was the only CFML compatibility issue I have encountered so far getting my site running on Railo.
Next, I connected Apache to Tomcat, following my own mod_proxy instructions (except that I don't yet have AJP enabled in Apache - that's on my 'todo' list) and made the changes necessary to read URL.PATH_INFO instead of CGI.PATH_INFO. Finally I disconnected JRun from Apache (by commenting out the JRun connector directives) and removed all the CFMX7-related symbolic links from the /etc/rc*.d/ folders. I restarted the VPS and here is corfield.org running on Railo / Tomcat / Java 6!

Tags: blogging · coldfusion · railo

10 responses

  • 1 Jean Moniatte // Mar 28, 2009 at 8:53 PM

    Nice, thanks a lot for taking the time to post all the details. I am sure that it will be very helpful for many people.

    One question: what made you choose Railo (vs CFMX and BlueDragon)?
  • 2 Brad Wood // Mar 28, 2009 at 11:10 PM

    That's pretty cool Sean. Do you still have CF7/Java 1.4 running beside Ralio/Java 1.6?
  • 3 Andy Allan // Mar 29, 2009 at 12:08 AM

    Interesting stuff Sean. I'm sure there's a few folks who are a bit ... bemused, for want of a better word, about the manual tasks you have to perform, but in the grand scheme of things, the steps you outline above will take no longer than it would to install CF8. That being said, if you ever have to recompile the web server connector in CF, you'll be more than comfortable with the Railo steps.

    And just a little point, which I'm sure many people have considered themselves, but because of the low overhead of running Railo in comparison to CF8, it makes perfect sense to run our blogs on Railo, and there's no reason why hosting companies can't take advantage of this because you could easily configure multiple Railo webs and still not get close to the memory requirements of CF8 (plus the fact Railo works SO much better in a shared environment that CF).
  • 4 Gary Gilbert // Mar 29, 2009 at 3:48 AM

    Sean,

    Welcome to the Railo Club :) I've been on Railo since just before Christmas and with my own VPS it's a nice feeling.
  • 5 Sean Corfield // Mar 29, 2009 at 11:26 AM

    @Jean, I've been meaning to try Railo on my VPS for a long time. With the upcoming open source release in a few days - and the series of blog posts I'd been writing about Railo - it seemed like a good time to knuckle down and actually do it. I'm a big fan of open source (which is why I got involved with OpenBD for a while) so running my blog on a free open source stack is appealing - even tho' the VPS package includes CFMX7.

    @Brad, I still have CFMX7/Java 1.4.2 installed but I don't have it running. It would be easy to switch back, of course.

    @Andy, yes, Railo's support for shared hosting - where each account can have its own web administrator but the hosting company can still control the overall server settings - is very impressive. The memory and disk usage is also a factor: compare 490MB (CFMX7 installed) with 150MB (Java 6 + Tomcat 6 + Railo installed), for example.
  • 6 Sean Corfield // Mar 29, 2009 at 11:34 AM

    @Andy, re: manual steps. Getting a quick local dev env setup is easier/quicker with Railo Express than even the fairly slick CF8 double-click installer. As soon as you get into dealing with setting up virtual hosts, there's really no difference between the CF8 setup and the Tomcat setup - they're both manual. I have 31 virtual hosts on my local dev setup :)
  • 7 salomoko // Apr 1, 2009 at 8:33 AM

    @ Sean/Gilbert

    where's your VPS getting managed?
  • 8 salomoko // Apr 1, 2009 at 8:35 AM

    sorry, I just snapped about the hosting provided by at the bottom... hah!
  • 9 Siraj Sayeed // Jun 30, 2009 at 8:57 AM

    Hi Sean,
    I was trying to parse a date with ParseDateTime("06/27/2009 12:00 PM") and railo returns {ts '2009-06-28 00:00:00'} where as CF8 processes it correctly. "11:59 PM" or "12:01 PM" are done correctly. Do you think its a bug or some time related settings?
  • 10 Sean Corfield // Jun 30, 2009 at 10:19 AM

    @Siraj, I thought I'd seen that before so I guess that confirms it. Sounds like a bug. I'll put a ticket in JIRA for you.