In the past I've blogged about manually deploying ColdFusion instances on Multiserver JRun and Apache. For a while now I've been meaning to write about the process of doing a complete manual creation of a JRun instance and deploying Adobe ColdFusion Server on that instance.
Why? Well. Its something I do all the time and its actually really easy. But why? Well I broke my JRun admin instance about 18 months ago. I couldn't fix it and no one seemed to be able to help me, so I resorted to manually creating and deploying ColdFusion instances on JRun.
Before Christmas, one of my colleagues had the exact same problem I has with JRun admin as I had. She asked me if I knew how to fix it. Having spent time on it and abandoned it I told her to manually create her instances. Inevitably she asked me if I'd written it down anywhere. Of course, I haven't, so now I'm going to.
I am going to take for granted that you have already done a Multiserver install of ColdFusion, so that you have a JRun folder somewhere on your computer.
Something that I do for myself and for my colleagues is maintain a number of cfusion EAR folders for various versions of Adobe ColdFusion Server. I keep these EARs up to date with the latest updates, hotfixes and security patches. To create these folders you'll need to follow my instructions on my MultiServer Set Up. Specifically, you need to do steps 3 through 7 and step 16 to create a cfusion-ear folder that you can quickly drop into a new JRun instance. Make sure you hang on to the EAR. When there is a updater available from Adobe you can point the updater at the EAR and it will update it for you.
To manually create a new instance under JRun you need an empty folder somewhere, anywhere, but jrun4/servers/ is the usual location. Create a folder named appropriately for your server instance. For this blog post I'm going to use "myinstance" as the server name, so I would create a folder called "myinstance" under jrun4/servers.
Next you need to add some server information for JRun. This comes in the form of a "SERVER-INF" folder that needs to live in your new server folder. If you take a look in the jrun/servers folder you should see a "template.zip" file. Open this up. In there you'll find a "SERVER-INF" folder and a "default-ear" folder. You're going to need to discard the default-ear folder, so don't bother extracting this folder. Drop the "SERVER-INF" folder into your "myinstance" folder. In "SERVER-INF" there are two files that we'll edit shortly; jrun.xml and jndi.properties. Open them up in your text editor of choice. For me its Notepad++ on windows or GEdit on Ubuntu (not that I'm basking in the glory of my newly installed Ubuntu laptop).
In both of these files you need to set port numbers. To start with head into the jndi.properties file. Near the top of the file you will see :
This is the port number that JRun uses to identify individual instances. If you get two JRun instances that try to start with the same provider port number, then the second instance will not start. What I've taken to doing to avoid hitting any port numbers already in use by JRun or the default ColdFusion install is to jump my port numbers up to xx20 to start with and then move up from there. To start with lets set the java.naming.provider.url to be 2920.
Next open up the jrun.xml file. In here you'll need to set two port numbers. The first is the one the webserver port number. Search for "jrun.servlet.http.WebService" and then scroll down to the port attribute. You should see:
In line with my policy of bumping up the port numbers up to xx20, set this port number to 8320. This is the number that you can access the JRun instance from in a browser. When your ColdFusion application is set up you will be able access the ColdFusion administrator. Given a port number of 8320, the cfadmin will be http://localhost:8320/CFIDE/administrator/index.cfm
Scrolling down a little you'll find class="jrun.servlet.jrpp.JRunProxyService". The proxy service is the section that allows you to connect a webserver to the JRun instance. There are two settings you need to change here. The first you will come to is the double negative of deactivated - true. You will need to set this to deactivated - false, so that the proxy port is active. Next set the port number that is a little futher down. The default is 51000; for my example set the proxy port number to 51020.
So now you should have:
- JNDI Port 2920
- WebServer port 8320
- Proxy Server Port 51020
- Proxy Server deactivated set to False
That is the settings for your JRun instance set up so now you need to add the ColdFusion Server application to your instance. Its as simple as this: take a copy of the EAR folder you created earlier and drop it into the "myinstance" folder at the same level as SERVER-INF.
That really is it!
Given that we've done everything else manually here's how you start a ColdFusion instance manually from the command line.
Depending on your operating system.
/opt/jrun4/bin/jrun -start myinstance
c:\jrun4\bin\jrun -start myinstance
I hope this helps someone out.