Good points about the single application name. However, it brings into question my entire approach to application variables. Take, for instance, my path to userImages.
When a user visits www.xyz.com, onApplicationStart() runs a query that retrieves, among other variables, the absolute path to those images. Realize, the application that I'm referencing is a "global site manager" (single codebase) for managing site content on multiple sites (each with a separate codebase, as these are custom sites). The end user sites are completely different. I'm using the "global site manager", at this point, to simply provide a single app to supply CRUD functionality to the users for their site content. Even the databases for these sites have little in common. I just decided that instead of building CRUD functionality over-and-over for each site manager, I'd build "one site manager to rule them all." :o) Now, for one site, the userImages path is, say, e:\inetpub\webroot\siteOne\userImages and for another site, the userImages path is e:\inetpub\webroot\siteTwo\userImages The userImages path gets set when the application is first run by onApplicationStart() and a query, qGetApplicationVariables, is run that retrieves info such as the userImages path, or, in this case, qGetApplicationVariables.userImagesPathAbsolute. Then, the query value for the userImages path is cfset to application.userImagesPathAbsolute for use throughout the site. If I have the same application name, wouldn't the userImages path variable be overwritten when another user visits another site using the same site manager codebase and onApplicationStart() is run again? Rick -----Original Message----- From: Sean Corfield [mailto:[email protected]] Sent: Friday, February 18, 2011 1:24 PM To: cf-talk Subject: Re: Feedback on this approach to "many sites, one codebase" (MSOC) On Fri, Feb 18, 2011 at 6:14 AM, Eric Cobb <[email protected]> wrote: > One thing you may want to take into consideration, if you plan on having > many sites run through this codebase, is NOT giving each site a unique > application name. I always take the approach of a single application name - for the reasons Eric presents - and I also typically have one DSN and all sites are in a single multi-tenant schema (and I'll be explaining all this in my Multi-Tenant Architecture talk at cf.Objective() BTW). Re: ?reinit=1 situations - what do you normally need to do that for? Refreshing the cache for a particular site? Design that into your admin system. Refreshing code after pushing a new file? As Eric points out, you need to reinit *every* application in that situation so you'd end up restarting the entire server. With MSOC, you need to consider your DB schema as part of your code too - that "OC" part means "One Schema" too. "OC" really means "One Application" otherwise you're going to be running multiple identical copies of your code and wasting memory. Steve asked "wouldn't it make sense to push it into the server scope?" - that can interfere with running any other applications on the server - and you probably want an admin application running alongside your multiple user applications. Now, you may share code between the admin and the user applications but it will be lower level components, if any, and you typically only have one admin application so you're at most running two copies of your code. You've also got startup issues to think about - if you have multiple applications and need to initialize server scope, there's no safe hook to do that (until we got CF9's onServerStart() / Server.cfc). Some things to think about... If you're at cf.Objective() and want to hear more on this topic, attend my talk and catch me in the bar afterward! If you're not yet registered for cf.Objective()... It'll be a great conference: five tracks this year, lots of awesome topics from great speakers, all packed into three days in a relatively central location (Minneapolis). You've missed the early bird now but it's still great value at under $1k! In addition to my Multi-Tenant Architecture talk, I'm giving an Introduction to Functional Programming session which addresses things like careful management of shared data and why side-effect-free code is easier to test and easier to get right in the first place (amongst many other functional techniques, some of which you can apply directly to CFML and some of which will at least make you think differently about solving problems). -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342442 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

