Saturday, August 14, 2010

The S.T.A.R. Stack

A few months back, I wished for a STAR here; a portable install (of sorts) for running ColdFusion applications. The use-case is the same as the one for WAMP/LAMP where you get an all-in-one stack.

A few assumptions/prerequisites were:

  • It should be free (… at least as in “beer”)
  • I shouldn’t have to delve into configuration details (e.g. apache “.conf” files) to set it up (same as WAMP); unless I wanted to
  • I should be able to leverage the best ability for each job (i.e. Tomcat container isn’t as good at delivering css, html, js, or images as Apache’s HTTP server)
  • I should be able to fit the stack plus the application on a small USB stick (256M) for redistributing my application. (perhaps even, make a windows application delivered thru’ a browser? When we have the cfexecute and the directory, file and registry api; who needs a cli?)

Well I have it made,…finally!!

I took the XAMPP Lite stack and ripped out their Apache webserver. For those who want to use PHP and MySQL, simply download their Lite version and leave it untouched with full capability. That way, you can add services to auto start/stop.

Next I got Tomcat 6 (and I have verified it works with Tomcat 7 too) and the mod_jk.so I got the latest Railo distribution (railo-3.1.2.001.war (34 MB)). I integrated Railo with Tomcat by adding the {railo}/WEB-INF/lib/*.jar to {tomcat}/lib/ and then merging the {railo}/WEB-INF/web.xml with {tomcat}/conf/web.xml.

Next step was to merge Tomcat with Apache webserver. That was easy and is documented everywhere. Long and short of it; just add the mod_jk,

# Load the JK module
LoadModule  jk_module  modules/mod_jk.so
<IfModule jk_module>
JkWorkersFile conf/workers.properties
JkShmFile     log/mod_jk.shm
JkMount     /*.cfm worker1
JkMount     /*.cfc worker1
</IfModule>

add a simplistic workers.properties as shown below


# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

That’s it ! Download and unzip it to, then just click the “xampp_start.exe”. Since this is Apache is ripped out of xampp lite’s install, you may get an error saying “cannot find xampp directory” or “cannot find mysql”. If you are unsure if Apache webserver started, check the Task Manager processes and confirm you see the httpd*.exe is running


image


I also made a convenience tomcat_start and tomcat_stop batch files. You can download the stack from http://sourceforge.net/projects/starstack/ Let me know if you have any suggestions! Enjoy!!

3 comments:

thYp - the hYpe said...

Always waited for a bundle like that!
This is a awesome project keep up the good work !

Akshay Shah said...

Nice work Anang. I know there is so much legacy CF work done everywhere. And I think this is a good way to scale out the existing CF work. and then consolidate all at DB level.

Anonymous said...

this is quite cool! just downloaded installed had a cf program running in under 5 minutes