We are considering moving our ColdFusion servers to AKS, and have been messing around with a test deployment to see how things work. To handle scaling of the CF servers we would like to setup a Redis pod to handle session management for the CF cluster.
Following the instructions I've found at https://helpx.adobe.com/coldfusion/using/docker-images-coldfusion.html and https://github.com/kubernetes/examples/blob/master/staging/storage/redis/redis-master.yaml, modified as I was getting errors with straight copy/paste, I've come up with the following yaml file:
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: cfsample
spec:
replicas: 1
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
minReadySeconds: 5
template:
metadata:
labels:
app: cfsample
spec:
containers:
- name: cfsample
image: cftest.azurecr.io/coldfusion:v1
ports:
- containerPort: 8500
volumeMounts:
- name: code
mountPath: /app
resources:
requests:
cpu: 250m
limits:
cpu: 500m
env:
- name: acceptEULA
value: "YES"
- name: password
value: "testCF321"
- name: configureExternalSessions
value: "true"
- name: externalSessionsHost
value: "cfredis"
- name: externalSessionsPort
value: "6379"
- name: cfredis
image: redis:latest
ports:
- containerPort: 6379
volumeMounts:
- name: redis
mountPath: /redis-master-data
imagePullSecrets:
- name: registrycreds
volumes:
- name: code
azureFile:
secretName: azure-secret
shareName: code
readOnly: false
- name: redis
azureFile:
secretName: azure-secret
shareName: redis
readOnly: false
---
apiVersion: v1
kind: Service
metadata:
name: cfsample
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8500
selector:
app: cfsample
When I hit a test page (any of my test pages) I have on this server in my browser, it does work and will even set a session variable and dump the session scope. However, the next page I try to hit reports an error:
Message coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Runtime service is not available.
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
javax.servlet.ServletException: coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Runtime service is not available.
coldfusion.bootstrap.ClassloaderHelper.initServletClass(ClassloaderHelper.java:129)
coldfusion.bootstrap.BootstrapServlet.init(BootstrapServlet.java:111)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:764)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1388)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.base/java.lang.Thread.run(Thread.java:834)
I would normally check the CF logs at this point, but I don't know how to access them within a pod. In any case, it looks to me like ColdFusion is crashing, likely because of some incorrect settings in the yaml when setting up Redis as a session datastore (since I just cobbled this yaml together via trial and error). Unfortunately, searching Google for "kubernetes yaml redis coldfusion" returns a staggering 7 results.
What is the correct way to define a Redis container within the yaml and have ColdFusion use it as a session datastore?