I’m running a pretty vanilla CommandBox server that I use with different server.json files, so I can run various versions of Lucee and ACF.
At the moment it’s running ACF 2018. I just configured and verified several datasources, then did ‘cfconfig export .CFConfig.json’, and the file got updated, but it doesn’t have the new datasources, just one I added a long time ago.
I see the same when I do ‘cfconfig show’.
It looks like ACF 2018 is supported, right? Am I doing something silly?
I’m guessing you’re either in the wrong directory or you have more than one server in that folder. Run
server list --local
to find out. In the absense of a specific CommandBox server name, CommanBox will pick whatever the default server is for that folder. The same one you see here:
Yes, that’s it, thanks. I have server.json-XXX files in that directory for ACF 10, 11, 2016, and 2018, plus Lucee 4 and 5. They all have different server names, and this got me the configs I wanted:
cfconfig export from=servername to=.CFConfig.json
That bumps up against something else I’ve wondered about. When I start one of these servers, then do server list, all the ones on the same port as that one are listed as running.
I’d much rather if I could see which of them was actually running, i.e., which engine and version, or which server.json file. Is there some way to find that out from the cmd line? Or would putting each engine and version on its own port clarify the server list?
If they each were on different ports. would it be ok to run more than one at the same time, even though they’re in the same directory?
The way CommandBox detects if a server is running is by checking to see if the port is bound. It uses the HTTP port, if in use, then the HTTPS port, if in use, then the AJP port if in use, then the stop socket. That’s the best method I’ve found to do it as every other method manages to get out of sync. So if you have two servers configured to use the same ports, then CommandBox can’t tell the difference.
Whether or not you can run two servers on the same port depends on what you have the host set to. As a general networking rule, only a single process can bind to a single port on a given network interface at a time. So two processes can’t bind to port 80 on localhost, but one process could bind on a LAN IP and that would be fine. Or, you could have 10 IPs assigned to the network card and 10 servers could bind to one IP apiece, all on the same port and there is no conflict.
There’s another way to do this as well for local dev. There is a trick where Windows resolves all addresses starting with 127 to localhost and Mac can be coerced to do the same too. If you install the host-updater module and set a different host name for each server (site1.local, site2.local, etc) then you can run them all on the same port. Not only will the hostupdater module edit your hosts file for you automatically (root/admin required) to add these host entries, it will use a different 127 address for each one, so they can all share the same ports if you like with no overlap.
CommandBox is aware of the network address in use when binding to the port so then it won’t confuse two servers since site1.local:80 and site2.local:80 would resolve as an example to 127.127.0.1:80 and 127.127.0.2:80 respectively and those are two totally separate things.