rss
twitter

Installing 'Railo Server with Tomcat' on OSX

As one of the first steps in preparing for new development on BlogCFC, yesterday, I wanted to download and install Railo so the new code can be tested on Railo as we move along.

First, let me say, it has been a while since I worked with Railo and the new installers are amazingly simple. It took only a few minutes to download and install Railo and fire up the Server Admin.

Unfortunately, what I wanted to do next was not as easy...actually...it was easy to accomplish, not so easy to find the information I needed, though. I wanted to create a new 'web context' that pointed to the directory where the new BlogCFC code would reside. I had used the 'Railo Server with Tomcat 7' installer found here and seen in the image below.

The problem I ran into was most of the information I could find about creating a new 'web context' was written for other installation types - most notably, when using Jetty as the servlet.

Thanx to the extremely patient Charlie Griefer, who pointed me to a blog post from Todd Rafferty, I was able to find enough information for me to be able to piece together what I needed to do. I am posting this mainly for my own future reference.

DISCLAIMER: This is the process I used to get this working. I am new to Tomcat. I am not certain if this is a 'best practice' - and if its not please let me know a better way. Use this at your own risk.

Let's start from the beginning, go to the Railo download page and grab the files 'Railo Server with Tomcat 7' - go ahead...I'll wait. Please note that I am demonstrating how I did this on OS X, on Windows, your mileage may vary

Go ahead an run the installer - it really is pretty easy. When you are done, in the directory you chose to install Railo, you should see a directory structure similar to the image below.

Now that Railo is installed, I needed to do some prep work. Next I added an entry to my HOSTS file for the BlogCFC code.

view plain print about
1127.0.0.1 railo.blogcfc6.dev
You will need to use an appropriate domain name for your project.

Next, open up the server.xml file located in the {railo}/tomcat/conf directory - where '{railo}' is the path to the Railo install directory. Look for the section where the <Host> blocks are located and add a new <Host> block like such:

view plain print about
1<Host name="railo.blogcfc6.dev" appBase="/Web Stuff/Sites" >
2 <Context path="" docBase="/WebStuff/Sites/BlogCFC6" />
3</Host>

Note:

  • The 'name' attribute is the same as the 'domain' name that is specified in the HOSTS file entry we created
  • The 'appBase' attribute is the parent directory of your project directory.
    I am honestly not sure if this attribute is needed since we are not 'exploding' a .WAR file, but it did not break anything. Can someone from Railo maybe chime in and let us know?
  • In the <Context /> block, the 'docBase' is the web root of the application.

Next, we need to copy some files to the project web root. Navigate to the {railo}/tomcat/webapps/ROOT directory and copy the WEB-INF directory. Then, paste the WEB-INF directory into the directory you set as the 'docBase' in the <Context /> block above.

Finally, restart Tomcat. On OS X this can be accomplished by running the shutdown.sh and startup.sh files, respectively. These files are located, by default, in the {railo}/tomcat/bin directory. Once Tomcat has restarted you can navigate to http://{host name}:{port number}, where {host name} is the domain name you specified in the HOSTS file and {port number} is the port on which Tomcat is listening - if you used the default value in the installer, this will be 80.

DISCLAIMER (again): This is the process I used to get this working. I am new to Tomcat. I am not certain if this is a 'best practice' - and if its not please let me know a better way. Use this at your own risk.

UPDATE: I heard form Mark Drew and Todd Rafferty, both from the Railo team, and the <Host> entry code was updated to reflect the changes they suggested. Mark also noted that copying WEB-INF is not necessary - when Tomcat is restarted, it will be created automatically. Thanx Mark & Todd!

2 comments

(Comment Moderation is enabled. Your comment will not appear until approved.)
GB said...
I had some serious issues when I first tried to install and set up Railo with Tomcat. I'm still very new to Tomcat. I found that every sub directory in my site was getting it's own WEB-INF folder auto-generated - and regenerated if I deleted them. It was aggravating and I didn't understand Tomcat. I still don't claim to understand it fully. But I'll share what I found.

I found that removing the 'appBase="/Web Stuff/Sites"' from the Host tag in tomcat's server.xml resolved my issue with every sub directory in my site was getting it's own WEB-INF auto-generated. Other than that my set-up seems identical to yours.

You mentioned in your notes that you weren't sure it was needed bu you didn't find that it was breaking anything. I don't know that my site was malfunctioning in any way with a WEB-INF in every sub directory, but I know it's not the intended arrangement for Railo/Coldfusion sites.
Joe Brislin said...
For those that would like to run Adobe ColdFusion and Railo side-by-side, I already had Adobe CF installing using Apache on port 80. So I changed the Tomcat install for Railo to use port 8080. I then used this post from Sean Corfield's website, http://corfield.org/entry/Railo_for_Dummies_Part_I..., and utilized Proxy pass throughs in Apache so that I can still have all websites running via port 80. This allows me to run an Adobe CF site at local.dev and then run the same website on Railo at railo.local.dev. It's a great setup for testing on multiple platforms and works like a charm.

Hope this helps someone else.