Commandbox with Apache and Docker

We have a really old vagrant/chef local development setup that we’re trying to replace with docker. I really want to use CB and CFConfig (which is crazy awesome cool) for this. Many years ago I got our management to consider Railo and when they had agreed, we started down that path. Well, the whole Railo thing blew up and since then, there is zero interest in Lucee. The powers that be want to get this moved over to PHP, but it is simply too large and we don’t have enough people to throw at it, so we need to continue maintaining it, as-is. I figured if I can get this running under CB, I can easily enough try Lucee with our code or, at the very least, get us to a newer version of ACF. Personally, I would love to see us using Lucee/nginx all the way to production with docker, but i have to start here, with CF11 and apache.

Our current setup is using CF11 w/apache for local, test, and production. We have ~400 apache rewrite rules, changing those to be compliant with tuckey and the built-in commandbox web server is not going to happen. I did, thanks to Samuel Knowlton on slack, get his sample docker setup using CF and nginix running, but then am stuck with the rewrite issues, and ultimately, not having local match test and production.

I tried dropping apache into my docker-compose file to replace nginx, but i’m missing something, possibly with the ports/reverse proxy stuff, that I can’t get passed. It always runs the built-in CB web server. It has been quite a few years since I last worked with CF and am vaguely familiar of wsconfig. Is there any way to run that after the container is spun up to get the proper connection to CF and apache working? I have also started down the path of a full CF11 install with apache, but thanks to CFConfig and how easily you can swap out engines in CB, i would really like to avoid this and stick with CB.

If anyone can steer me towards a working CB/apache setup I can probably work from there, but I just haven’t been able to find any decent references or ideas using google. I am asking here versus slack because if a solution can be found, it might help the next person searching google who is crazy enough to want to use CB with apache. :slight_smile:

Thanks!
Paul

That’s a real shame that the Lucee fork scared off your managers. Lucee is still managed by the same developer and quite active for years now. Really the biggest thing that changed was the name. Make sure to remind your superiors that CF11 has been out of support since April of last year and is no longer receiving any sort of security patches. SImply updating to a current engine is a much better idea than a rewrite in PHP!

I would focus in on how you’re connecting Apache to the CF server (really doesn’t matter if it’s ComandBox or not). I assume you are using a reverse proxy. I’m not even sure if wsconfig applies to a war installation.

Based on your message I’m not actually sure what you specific issue is, but this is what a basic HTTP reverse proxy looks like in an Apache virtual host

ProxyPreserveHost On
ProxyPassMatch ^/(.+.cf[cm])(/.)?$ http://127.0.0.1:8888/$1$2
ProxyPassMatch ^/(.+.cfchart)(/.
)?$ http://127.0.0.1:8888/$1$2
ProxyPassMatch ^/(.+.cfml)(/.*)?$ http://127.0.0.1:8888/$1$2

optional mappings

#ProxyPassMatch ^/flex2gateway/(.)$ http://127.0.0.1:8888/flex2gateway/$1
#ProxyPassMatch ^/messagebroker/(.
)$ http://127.0.0.1:8888/messagebroker/$1
#ProxyPassMatch ^/flashservices/gateway(.)$ http://127.0.0.1:8888/flashservices/gateway$1
#ProxyPassMatch ^/openamf/gateway/(.
)$ http://127.0.0.1:8888/openamf/gateway/$1
#ProxyPassMatch ^/rest/(.*)$ http://127.0.0.1:8888/rest/$1
ProxyPassReverse / http://127.0.0.1:8888/

Adjust port 8888 to match whatever HTTP port CommandBox is listening on. I haven’t used Apache in a while so I don’t have any actual servers to look at. All our stuff in Nginx these days and a lot of the Apache proxy examples on the internet use AJP, which you can use if you like. You just need to configure CommandBox to listen on an AJP port.

You’re preaching to the choir, haha. We know about CF11 and hence the push to get this going because only a few devs, with all the old configs, are still able to do anything.

Your suggestion was perfect and I am now passing through apache as the rewrite rules are firing, many thanks! However when using docker, it was necessary to use the docker container name instead of localhost IP or it threw apache 503.

ProxyPassMatch ^/(.+.cf[cm])(/.*)?$ http://my-commandbox-container-name:8888/$1$2

Thanks again, Brad!

Paul