July 2, 2015
Setting up ColdFusion in distributed envionment
Comments
(10)
July 2, 2015
Setting up ColdFusion in distributed envionment
(10)

You might want to set up ColdFusion in a distributed environment where ColdFusion is running on one machine and Web server is running on a different machine.

Following are the set of steps that have to be performed to achieve this (less error-prone):

This applies generally to both ColdFusion 10 and ColdFusion 11 and beyond.

1) Have ColdFusion server installed in a machine (machine 1).

2) On machine with web server (machine 1), download and install VC Runtime if not already installed.

– The version of VC Runtime that you have to install depends on the version of ColdFusion.

Say, ColdFusion 11 needs VC Runtime 2012

(32-bit VC Runtime for 32-bit Web server and 64-bit VC Runtime for 64-bit Web server.

If you are not sure, you can install both)

(https://www.microsoft.com/en-in/download/details.aspx?id=30679)

and ColdFusion 10 needs VC Runtime 2010

3) Copy the following contents from the machine 1 (where ColdFusion is running) to machine 2 (where the Web server is running), and place them in the same location on machine 2.

C:\ColdFusion11\jre (directory)

C:\ColdFusion11\cfusion\runtime\lib\wsconfig.jar

C:\ColdFusion11\cfusion\runtime\conf\server.xml

C:\ColdFusion11\config\instances.xml

C:\ColdFusion11\config\cluster.xml

4) Open a Command prompt on machine 2 and run the CF wsconfig tool:

C:\ColdFusion11\jre\bin\java -jar cfusion\runtime\lib\wsconfig.jar

It will open a configuration window where you have to provide AppServer Host as the ColdFusion Server IP or machine name.

Configure the connector, which will restart the webserver.

Distributed environment is ready for use. Send requests to the Web server’s URL with cfm files under web server root and the same files under ColdFusion’s Webroot.

The web server would redirect these to ColdFusion, which is on some other machine.

10 Comments
2024-07-02 22:22:23
2024-07-02 22:22:23

See also a more recent (but also more brief) blog post from Adobe, here:

https://coldfusion.adobe.com/2022/09/coldfusion-in-distributed-environment-windows/

Like
2021-07-05 21:32:59
2021-07-05 21:32:59

And it should be said that the distributed mode of operation is offered under the presumption that one WANTS or NEEDS to follow the Adobe-recommended approach of using the AJP connector (with its configuration of the web server and in the config/wsconfig files, as well its use of the ajp connector element in the server.xml).

Some may prefer to skip it all and go the route of having their web server act as a reverse proxy to the built-in web/Tomcat server within CF instead, and so just forwarding requests to it (rather than using AJP at all). 

That’s really quite a different approach which deserves its own blog post (whether from Adobe, myself, or someone else). And such a post would need to cover what aspects of connecting a web server to CF via AJP might act differently if instead one just did proxying/forwarding from such a web server to CF WITHOUT AJP. (That would include many things reflected in the wsconfig folder files, like what extensions are allowed or restricted, and it might include support of url-safe URLs, and more.)

In the meantime, those running Apache and nginx and other web servers will find they have long had the ability to reverse-proxy to such a backend web server via their proxypass directive (enabled with mod_proxy in Apache), while in IIS such is possible only if you enable the IIS feature called Application Request Routing or ARR (and then setup url rewrites to do the forwarding).

I leave all that as an “exercise for the reader”, as it’s indeed quite the opposite of the approach discussed in this post, and it’s not FORMALLY supported by Adobe, as far as I know. 🙂

Like
(1)
2021-07-05 21:10:37
2021-07-05 21:10:37

As an update to this post (which is quite old), there is at least one mistake (even for the CF11 timeframe when it was written), and something new needed since CF2016. I also share here an answer to a question below about websocket proxy configuration, and some other tips on this subject of setting up “distributed CF”.

1) First, where the steps indicate to copy the files in the “C:\ColdFusion11\runtime\lib\”, that should be “C:\ColdFusion11\cfusion\runtime\lib\”, so the following (changing the CF folder number for your CF version):

  • C:\ColdFusion11\cfusion\runtime\lib\wsconfig.jar
  • C:\ColdFusion11\cfusion\runtime\conf\server.xml

2) Second, in CF2018 and above, another file should be added to the list:

  • C:\ColdFusion2018\cfusion\runtime\lib\config.properties

Otherwise, you will get an error:

  • Error occured: C:\ColdFusion2018\cfusion\runtime\lib\config.properties (The system cannot find the file specified)

This is related to a new aspect of the CF wsconfig UI (new in 2018) where when adding a new connector, it offers a choice of “website load” of “low”, “medium”, or “high”. The file I point to above has configuration of the default values for those settings. (And the need of this file is not only in CF2018 but also 2021.)

3. As for supporting configuration of the websockets proxying, that calls for bringing over at least one more file (two more if you want to run the exe version). These are found not in the cfusion/runtime folder but instead the cfusion folder:

  • C:\ColdFusion2021\cfusion\lib\wsproxyconfig.jar
  • C:\ColdFusion2021\cfusion\bin\wsproxyconfig.exe
  • C:\ColdFusion2021\cfusion\bin\wsproxyconfig_jvm.config

If you bring just the jar, then run it similar to as is shown in the post above–but again noting its different location, in cfusion/lib rather than cfusion/runtime/lib for the wsconfig.jar. (And while this wsproxyconfig.exe leverages this other file, wsproxyconfig_jvm.config, to help it know where to find the jvm, I don’t find a way to get the cfusion/runtime/bin/wsconfig.exe to work the same way. So unless we find a solution for that, again stick with the approach shown in the post here to run java -jar against that wsconfig.jar.)

There is still more that this post could say but does not.

For example, notice how it has you bring a copy of the instance.xml and cluster.xml. That’s done under the presumption that you may have defined new instances in CF (before making this copy), such that the instances.xml file would have information on the instances (to show in the dialog for adding a connector, where it would offer the instances as options to which a site could be connected), and same for clusters. So if you are using instances or clusters, be sure to have created those first on the CF server before copying these files to the web server machine.

Also, technically the coldfusion\jre folder does not HAVE to be brought over if indeed there is a jvm of the same version already on the web server machine. But it would have to be the same version, of course (to be sure to be a jvm version supported by that CF version), and you’d need to be sure to use that JVM’s java command when running the jar. So it’s indeed simpler to “just copy over the coldfusion/jre”. (And I’ll add that it should matter if you may have changed CF to use another JVM, insofar as whether you should copy THAT jvm. Again, as long as it’s a JVM version that is supported by the CF version you’re working with, that should suffice.)

Finally, FWIW you could also create a folder on the CF server where you prepare/stage all these files (and test that things work) before copying them over to the web server machine. For example, I created a folder called /wsconfigtest  and in that I created these cfusion, config, and jre folders (for the files named above). Then I ran the command pointing to the wsconfig.jar within that, and the UI appeared (and I got the error at first, when I had not yet known I needed to bring in that config.properties file). Of course, I did not then PERFORM an add of a connector using the tool, since the point of running “distributed CF” would be to do that on the web server machine, not the CF server machine.

There are still more tips that could be shared, but I’ll leave at these for now. If others see this and want to chime in, please do.

Like
(3)
(4)
>
Charlie Arehart
's comment
2021-07-05 21:36:27
2021-07-05 21:36:27
>
Charlie Arehart
's comment

Hi Charlie,

This should be in a blog than in the comment .

If I am not mistaken, “config.properties” is part of CF2018 release as we changed the connector setting to auto-apply the Website Load values(Low-Med-High). In CF2016, it is still the old one and we have to manually add these values in connector properties and server.xml.

-Priyank

Like
(1)
>
Priyank Shrivastava
's comment
2021-07-06 03:48:56
2021-07-06 03:48:56
>
Priyank Shrivastava
's comment

OK, Thanks for that. Usually I remember such details well but I slipped in this case. 🙂

And yep, I just started writing and ideas kept flowing. I’d already made a note  to consider a new post. I figured I’d see what kind of feedback or encouragement I got, if any.

So thanks for both. 🙂

Like
(2)
>
Charlie Arehart
's comment
2022-04-13 18:50:28
2022-04-13 18:50:28
>
Charlie Arehart
's comment

Charlie, thank you for your comments.  I found your videos on youtube, and been visiting your site for pointers on CF.  Thank you for being a part of the community!

Like
(1)
>
Goten 13
's comment
2022-04-13 21:38:28
2022-04-13 21:38:28
>
Goten 13
's comment

Thank you, and happy to help.

Like
2017-08-14 12:05:12
2017-08-14 12:05:12

Hello,
Can you update this thread for CF2016? Can you include the tomcat server.xml edit syntax details where the CF instance is remote for vertical cluster?
Thanks, Carl.

Like
2017-03-31 04:33:55
2017-03-31 04:33:55

What part does the VC Runtime 2012 do for ColdFusion 11 with this process?

Like
2016-09-29 17:22:15
2016-09-29 17:22:15

How do you configure ColdFusion 2016 WebSockets in distributed mode when ColdFusion is configured to “Use Proxy” (in IIS or other)?

Like
Add Comment