Methods to automate ColdFusion Administrator settings

Viewed 419

When working with a ColdFusion server you can access the CFIDE/administrator to set config values, which update the cfusion/lib/ xml files (e.g. neo-runtime.xml, neo-mail.xml, etc.)

I'd like to automate a deployment process that includes setting these administrator values so that I don't have to log in and manually set them for each new box that shares settings. I'm unsure of the best way to go about it.

Some thoughts I had are:

  1. Replacing the full files with ones containing my custom settings. I've done this for local development, but it may not be an ideal method due to CF hot-fixes potentially adding/removing/changing attributes.
  2. A script to read the wddx xml file and replace the attribute values. I'm having trouble finding information about how to do this method.

Has anyone done anything like this before? Or does anyone have any recommendations on how to best go about this?

3 Answers

At one company, we checked all the neo-*.xml files into source control, with a set for each environment Devs only had access to the dev settings and we could deploy a local development environment with all the correct settings for new employees quickly.

but it may not be an ideal method due to CF hot-fixes potentially adding/removing/changing attributes.

You have to keep up with those changes and migrate each environment appropriately.

While I was there, we upgraded from 8 to 9, 9 to 11 and from 11 to 2016. Environments would have to be mixed as it took time to verify the applications worked with each new version of CF. Each server got their correct XML files for that environment and scripts would copy updates as needed. We had something like 55 servers in production running 8 instances each, so this scaled well.

There is a very usefull tool developed by Ortus Solutions for this kind of automatizations called cfconfig that can be installed with their commandbox command line utility. This tool isn't only capable of setting configurations of the administrator: It is also capable of exporting/importing settings to a json file (cfconfig.json). It might be what you need.

Here is the link to their docs https://cfconfig.ortusbooks.com/introduction/getting-started-guide

CFConfig worked perfectly for my needs. I marked @AndreasRu answer as accepted for introducing me to that tool! I'm just adding this response with some additional detail for posterity.

  1. Install CommandBox as part of deployment script
  2. Install CFConfig as part of deployment script
  3. Use CFConfig to export a config.json file from an existing box that will share settings with the new deployment. Store this json file in source control for each type/env of box.
  4. Use CFConfig to import the config.json as part of deployment script

Here's a simple example of what this looks like on debian

# Installs CommandBox
curl -fsSl https://downloads.ortussolutions.com/debs/gpg | apt-key add -
echo "deb https://downloads.ortussolutions.com/debs/noarch /" | tee -a /etc/apt/sources.list.d/commandbox.list
apt-get update && apt-get install apt-transport-https commandbox

# Installs CFConfig module
box install commandbox-cfconfig

# Import config settings
box cfconfig import from=/<path-to-config>/config.json to=/opt/ColdFusion/cfusion/ toFormat=adobe@11.0.19
Related