We have a Coldfusion server that hosts multiple applications, all in their own subfolder. Something like:
- /webrootfolder/applicationA
- /webrootfolder/applicationB
Furthermore, on the development server, we have a copy of a given application per developer, each being a Subversion working copy:
- /webrootfolder/applicationA_dev1
- /webrootfolder/applicationA_dev2
- /webrootfolder/applicationA_dev3
Since we are running Coldfusion 7 (with major resistance to upgrading), I find myself stuck as I want to use CFCs in packages. Here are the various issues, attempted solutions and issues with these too:
- Using a relative component name only works if there is a single package, which would make a mess of components in a single folder.
- Using sub-packages works as long as you never reference components in parent packages, which seems to easily happen when extending, instanciating or using a component as a cfargument type.
- Using a full CFC path starting from the root doesn't work with our multiple copies per developer. ** Using a dynamic path with a variable was my solution as of now... until I realized it doesn't work with extends or cfargument type... ** Using server mappings doesn't work in development as we would have one alias per developer copy. I expect the code to be folder-independant. ** Using application specific mappings (defined in Application.cfc) doesn't work because CF7 and not CF8+.
- Creating local dummy copies of needed CFCs and cfinclude-ing the content of the actual CFCs (with relative paths "../../") was my previous solution. It works, but it's so messy having these clones all over. ** Very recently, I have discovered this solution does not always work. Coldfusion gets confused by same-named functions being included in various CFCs apparently.
- Using development Coldfusion servers on each developer's machine, allowing for the application path to always be
/webrootfolder/applicationA
(suggested by Mark A Kruger). ** Main issue here would be to convince the computer team to let us install this. It might take a long time, which I fear I don't have. ** There may be other issues with network configuration (giving access to DB maybe, I'm not sure) which will also have to go through the network team and take a while, if it's even allowed.
One website per application / folder - Changing the root
I have taken time to explore the way the websites/applications are configured in IIS 6. After some research, I found out it's possible to create bindings just like what I was used to under Unix/Apache. At the moment, all applications are in their own subfolder of the web root. Aliases are configured, making "domain.com/appA" point to the "/webrootfolder/applicationA" folder, for example. But it is still a single IIS website with lots of sub paths. The Coldfusion root (for CFC and includes) is thus based on the root of that one website (/webrootfolder).
I made a quick test and managed to have a second IIS website on the server, bound to port 8080 (instead of the default 80). I made this one point directly to /webrootfolder/applicationA/cfm (which is really the root of the app). With this, Coldfusion recognizes that folder as the root and instanciating the "Object" CFC looks for it as /webrootfolder/applicationA/cfm/Object.cfc
.
This is exactly what we had in my previous job and it worked really well. That said, it was a small company and I fear this solution may have issues. Mostly: how do I point people to this website? Using port binding isn't very user friendly (our users are not techies). Having a specific domain for each application sounds nice but might be costly, especially if HTTPS is involved (or so I've heard). Subdomains might be another solution but seems to have similar issues.
So...
Have I missed anything? Am I stuck with one of the "messy" solutions?
I have access to the Coldfusion admin panel and possibly the IIS configuration, though I'll most likely be limited if a solution affects the paths or URLs of other applications on the server.