With a little side of applesauce...

Thursday, February 1, 2007

HOW-TO setup Apache 2 with a Coldfusion 7 Cluster on Debian

I am currently setting up ColdFusion MX 7 on Debian Sarge. The setup looks like:

Apache2 - front-end machine - 192.168.208.30
2-ColdFusion MX 7 machines clustered - 192.168.208.40/192.168.208.41

The cluster name is “webcf”.

I installed and setup the ColdFusion MX 7 cluster on two Debian Sarge machines with no problem, (ok, some problems, but it has been a month, so I don’t remember exactly what they were). Clustering was more of a pain, (come on Adobe… Let’s get more documentation on running ColdFusion clusters on JRun 4 servers). I’ll try to remember how I did it, so I can document that as well.

Finally, when I went to setup Apache2 with mod_jrun20.so, I ended up copying all of the /opt/jrun4 directory to the Apache2 machine. Therefore,

$ ls /opt/jrun4

$ jre/bin/java -jar lib/wsconfig.jar -host 192.168.208.40 -cluster webcf -apxs
> -ws apache -dir /etc/apache2/ -v -coldfusion -bin /usr/sbin/apache2 
> -script /usr/sbin/apache2ctl

(Watch out that apache-dev is not installed… It is not needed for building mod_jrun20.so).

The java command above will probably generate the following error:

Found JRun cluster webcf at 192.168.208.40:2902
Found JRun server cfusion at 192.168.208.40:2902
Found JRun server admin at 192.168.208.40:2910
Found JRun server samples at 192.168.208.40:2918
Deleted directory /opt/jrun4/lib/wsconfig/1
Using Apache binary /usr/sbin/apache2
Using Apache control script /usr/sbin/apache2ctl
Parsing Apache configuration file /export/web/apache2/httpd.conf
Exec'ing chmod 777 /opt/jrun4/lib/wsconfig/1
Set permission to 777 on /opt/jrun4/lib/wsconfig/1
Server version: Apache/2.0.54
Exec'ing chmod +x /opt/jrun4/lib/wsconfig/1/build_jrun20
Set permission to execute on /opt/jrun4/lib/wsconfig/1/build_jrun20
Could not find the required apxs (Apache Extension Tool) binary /usr/sbin/apxs.
Could not build A pache2 web server connector from source. 
Use build script /opt/jrun4/lib/wsconfig/1/build_jrun20 .

This is ok. Now:

$ cd /opt/jrun4/lib/wsconfig/1/

Open build_jrun20 in your favourite editor:

$ emacs build_jrun20

And change all instances of /usr/bin/apxs to /usr/bin/apxs2. Once this is complete, save the file and run:

$ ./build_jrun20
/usr/bin/libtool --silent --mode=compile gcc -prefer-pic -pipe
-I/usr/include/xmltok -I/usr/inclu de/openssl -Wall -O2 
-DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 
-D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -pipe -I/usr/include/xmltok 
-I/usr/include/openssl -Wa ll -O2 -pthread -I/usr/include/apache2 
-I/usr/include/apr-0 -I/usr/include/apr-0 -I/usr/includ e -w -c 
-o /opt/jrun4/lib/wsconfig/1/mod_jrun20.lo
...
cp /opt/jrun4/lib/wsconfig/1/.libs/mod_jrun20.so /opt/jrun4/lib/wsconfig/1//mod_jrun20.so
cp /opt/jrun4/lib/wsconfig/1/.libs/mod_jrun20.lai /opt/jrun4/lib/wsconfig/1//mod_jrun20.la
cp /opt/jrun4/lib/wsconfig/1/.libs/mod_jrun20.a /opt/jrun4/lib/wsconfig/1//mod_jrun20.a
ranlib /opt/jrun4/lib/wsconfig/1//mod_jrun20.a
chmod 644 /opt/jrun4/lib/wsconfig/1//mod_jrun20.a
libtool: install: warning: remember to run `libtool --finish /usr/lib/apache2/modules'
chmod 644 /opt/jrun4/lib/wsconfig/1//mod_jrun20.so

Now, I symlink the new so to /usr/lib/apache2/modules:

$ ln -s /opt/jrun4/lib/wsconfig/1/mod_jrun20.so /usr/lib/apache2/modules/mod_jrun20.so

Generate the load file to work with the Debian Apache2 package:

$ cat > /etc/apache2/mods-available/cfm.load
LoadModule jrun_module /usr/lib/apache2/modules/mod_jrun20.so
Control-d to quit and save the cfm.load file.
(Or, use your favourite editor and put the following line in /etc/apache2/mods-available/cfm.load:
LoadModule jrun_module /usr/lib/apache2/modules/mod_jrun20.so

).

Now, enable your module:

$ a2enmod cfm

Restart Apache2:

$ /etc/init.d/apache2 restart ( or force-reload )

No comments: