I'm working on migrating some coldfusion applications from a linux redhat server to openshift. Several of the applications are set up in such a way that they require symlinks, which Tomcat blocks by default. So I need to update the server.xml config file add the attribute to allow symlinks. However, every time I do this, an error occurs on coldfusion startup that is preventing the .car file from loading the cf administrator settings.
What I did was I took the existing server.xml file, added the allowLinking="true" attribute to the resources tag for the /app directory, and loaded the file into a configmap, and then add that configmap into my deployment yaml
Under volumeMounts:
- mountPath: /opt/coldfusion/cfusion/runtime/conf/server.xml
name: volume-my3uz
subPath: server.xml
And under volumes:
- configMap:
defaultMode: 420
name: tomcat-config-q
name: volume-my3uz
This works (to a point)... the server.xml file is replaced, and symlinks work, but the .car file with all of the administrator settings doesn't load. Looking in the startup logs in openshift, I see this:
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Updating webroot to /app
Configuring virtual directories
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
Read-only file system: /opt/coldfusion/cfusion/runtime/conf/server.xml
And then further down there's a coldfusion error - File not found: /ColdFusionDockerStartupScripts/importCAR.cfm
One thing I've noticed is that even if I don't try including the modified server.xml and stick with the default, the timestamp for that file is whenever it is that the pod is starting up. My working theory is that there's something in the initial server.xml file defining the ColdFusionDockerStartupScripts directory, and once it's completed Coldfusion removes that entry (and therefore the file I modified is one that's already been modified by coldfusion and doesn't have that entry). But I'm really just taking guesses at this point and have no idea what I'm doing wrong.
I found the answer thanks to a post on the Adobe forums: https://community.adobe.com/t5/coldfusion/coldfusion-2016-update-17-docker-facing-simlink-issue/m-p/12218493#M189428
Essentially, I was correct that coldfusion is making updates to the server.xml file on startup, and trying to have openshift replace that file seems to interfere with that. This is all happening in a coldfusion startup script at the following location - /opt/startup/start-coldfusion.sh. So the solution is to update that script to add the allowLinking attribute to the xml file rather than updating it directly.
I added the following line to the script:
xmlstarlet ed -P -S -L -i /Server/Service/Engine/Host/Context/Resources -t attr -n "allowLinking" -v "true" /opt/coldfusion/cfusion/runtime/conf/server.xml
Then put the updated file in a configmap and have openshift replace that file rather than the server.xml, which worked.