Copy the following files in a directory, for example, is C:\Updates.
- updates.bat
- currentServerState.txt
In ColdFusion (2021 release), there is a package manager to manage the installation/uninstallation of various packages.
In this document, we explain the steps of automating the process of package installation/updates and apply the process to multiple instances of ColdFusion.
Install the required packages in a single instance of a ColdFusion installation.
For example, you have installed the packages: axis, awsdynamodb, and awss3.
The packages administrator and adminapi are pre-installed.
You can now export the server state to a file. We will be using this same file to install/update these packages in all other ColdFusion instances.
You can export the server state in ColdFusion in two ways:
The required file gets downloaded.
The next step is to automate the entire flow. But before that, let's see how you can use the file which was created in the previous step.
The Import command is supported only through the CFPM utility.
The command installs all the required packages (and also apply the server updates, if available),
Now that you can import or export the state of a server, let’s see how you can automate this entire process.
You can use a sample script file (Windows and non-Windows), which you can download from the location below. You can even create your own script file to automate this process.
Laadi alla
Assume that you have the following:
Also, you've installed all required packages in cfusion and have exported the server state.
To apply the server state in the rest of the instances, follow the steps below:
Copy the following files in a directory, for example, is C:\Updates.
Launch a command prompt. From the prompt, run the command:
updates.bat C:\ColdFusion2021 C:\Updates\currentServerState.txt instance1 instance2 instance 3 instance 4
The command will install the packages, axis, awsdynamodb, and awss3 along with the administrator and adminapi packages in all the four instances without any manual intervention.
Assume that you have the following:
Also, you've installed all required packages in cfusion and have exported the server state.
To apply the server state in the rest of the instances, follow the steps below:
Launch a terminal in your <Path to CF Home>/cfusion/bin directory.
Copy the file updates.sh to the directory <Path to CF Home>/cfusion/bin.
On the terminal window opened, run the command:
./updates.sh /opt/ColdFusion2021 <path to>/currentServerState.txt instance1 instance2 instance3 instance4
The command will install the packages, axis, awsdynamodb, and awss3 along with the administrator and adminapi packages in all the four instances without any manual intervention.
If you face any issues when automating this flow, contact us at:
@echo off setlocal enabledelayedexpansion :: USAGE :: update.bat C:\ColdFusion C:\cfpackages.txt instance1 instance2 ...... :: First argument is the ColdFusion home directory :: Second argument is the file which was exported from a server :: From there on are all the instances of CF where you want to apply the updates to set argCount=0 for %%x in (%*) do ( set /A argCount+=1 set argVec[!argCount!]=%%~x ) set pathToExportedFile="!argVec[2]!" set pathToCFHome=!argVec[1]! for /L %%i in (3,1,%argCount%) do ( echo Executing "%pathToCFHome%\!argVec[%%i]!\bin\cfpm.bat" import %pathToExportedFile% call "%pathToCFHome%\!argVec[%%i]!\bin\cfpm.bat" import %pathToExportedFile% ) pause
#!/bin/bash ARGUMENTS=() declare count=1 declare pathToExportedFile='' declare pathToCFHome='' for var in "$@" do if [ $count == 1 ] then pathToCFHome=("$var") elif [ $count == 2 ] then pathToExportedFile=("$var") else ARGUMENTS+=("$var") fi count=$((count+1)) done for i in "${ARGUMENTS[@]}" do SCRIPT_PATH="${pathToCFHome}/${i}/bin/cfpm.sh" echo "Executing: ${SCRIPT_PATH} import ${pathToExportedFile}" . "${SCRIPT_PATH}" "import" "${pathToExportedFile}" done