What I Learned Today: How to run CF7, CF8, and CF9 at the same time
What I Learned Today , ColdFusion , Web Development Add commentsThis is the first post in a series I will call "What I Learned Today". While this post focuses on tech, expect this series to contain lessons learned from all parts of my life.
With my recent issues regarding getting CF8 installed, I decided to learn how to run CF in a multi-server mode using JRun4 to manage it. The goal for me was to have CF7 and CF8 running on my Macbook concurrently and natively. The reason for this is that the production environment for my day job is CF7 (Unix)/SQL Server (Windows) environment. I work full-time from home, and have a local development environment here so I do not need to work over Citrix remote access all day and be bogged down by the oft-times slow netowrk there. Therefore, I need to mimic that environment so I can code with the rest of my team and keep the same environment variables. Up until now, the way I did it was to rely heavily on VMware Fusion and have two separate virtual machines running at the same time, since I never could get CF7 to install and run correctly natively on OS X. This was a huge memory hog, and often I would be pushing my 4GB of memory to the limit. Knocking out one of the VM's would help me greatly.
Through the aid of the House of Fusion folks, I came across a blog post that described how one person used multi-server mode to do exactly this. I combined the knowledge there with this page from Adobe on how to deploy CF9 as an EAR file, and I had my solution. Using Apache for my web server (I use MAMP Pro for super easy creation of multiple virtual hosts) I will have different CF servers running for different virtual domains.
So, here is how I did it all. I won't steal from the blog posts I reference, I will note where I got the steps from though. These directions assume you are using OS X, modify as needed for Windows or Unix.
- Uninstall all CF server instances from OS X.
- Reboot (force of habit, might not be needed but better to be safe).
- Choose which version will be your most often used version of CF. For me it is CF8. This drives the rest of my instructions, change yours accordingly.
- Install CF8 as a multi-server installation. This will install JRun4 as well. *
- Run the ColdFusionLauncher application from the /Applications/JRun4 directory.
- Start the admin server and CF8 server (if not running).
- Open Terminal, and connect to the JRun web server configuration tool with the following command
[code]java -jar /Applications/JRun4/lib/wsconfig.jar[/code] - Connect to your Apache server of choice.
- Select the CF8 server from the JRun server list.
- Enter the directory containing your httpd.conf file in the configuration directory field.
- Check the configure web server for coldfusion applications check box.
- Click on the Advanced button
- Ignore the top three check boxes
- Enter the location of the httpd binary in the server binary field.
- Enter the location of the apachectl binary in the server control script field.
- Click OK to close the window.
- Click OK to commit the settings.
- Make sure Apache and the CF8 server are running, then run the CF8 administrator setup at http://localhost/CFIDE/administrator/. If this runs correctly, you have CF8 and JRun installed properly!
The next steps are to be done for each other version of CF you want to have running.
- Run the installer for CF, choose the create the J2EE files. Choose EAR for file version. I changed the "cfusion" value in the context root option in the installer to "/".
- Find the location of the cfusion.ear file the installer created.
- Go to your /Applications/JRun4/servers directory in finder. Create a new subdirectory called "cf[enter your version number here]".
- Go to the JRun admin console web page (http://localhost:8000/) and create a new server named the same as the new directory name.
- Delete the default-ear directory from the new directory.
- Copy the cfusion.ear file to that new directory.
- Expand the EAR file according to the steps in the Adobe page I referenced.
- Go back to the JRun admin console, and choose the CF server.
- Start the server in JRun, it should do initial setup for you.
- To hook into Apache, make sure that the ProxyService is running. By default it is not. It is found under Services/Active Web Servers. Kee the JRun web server running, you need it for CF administrator access.
- Use the blog post I referenced to hook this CF server directly to the virtual hosts in Apache that you want to use it.
- Connect to the CF administrator using the JRun web server and port it defined for you. This will allow CF to finish it's initial set up.
- Configure CF, and away you go!
Nov 17, 2009 at 11:53 AM Update to this. I decided to nuke the CF8 install (it installed the CFIDE directory in my localhost like a standalone install would, didn't want that), and recreated it as a straight J2EE installation. Now I have them all neatly under the Applications/JRun4/servers directory. Not overly necessary I know, but I like to keep things organized.