Single source multiple unique offices

lacktrum wrote on Monday, August 31, 2009:

I have been thinking about allowing one code base allowed across different sites. What I want is to avoid having to maintain a bunch of code trees for many different users.  A user would be a unique office that is in no way related to other users.  The idea I have come up with is in linux create softlinks to a base install for all other users installs.  The files that would not be softlinked are globals.php and sqlconf.php any other site specific files.  Using this method all of the includes for globals.php etc… would be done by placing dirname($_SERVER[‘SCRIPT_FILENAME’])  in front of all the references to force the configs to be the correct ones.

Does anyone see problems with this?  Or a better idea on how to handle this?

Truman

whimmel wrote on Monday, August 31, 2009:

This sounds similar to how Gentoo Linux treats web applications. The package manager, emerge, installs an application into /usr/share/webapps and then *hardlinks* the files into whatever directory you want. Usually /var/www/hostname/htdocs/appname using the webapp-config script.

I don’t think modifying all of the include references would be necessary as long as you set the root correctly in globals.php.

You may find inspiration here:  http://www.gentoo.org/proj/en/webapps/index.xml

sunsetsystems wrote on Monday, August 31, 2009:

Yeah I have a feeling that hard links will work out better.  This will be easier after we get all of the configuration parameters into the database.

Rod
www.sunsetsystems.com

tmccormi wrote on Monday, August 31, 2009:

I have used this technique many times for web apps (with soft links).  It’s very easy to maintain and it even allows you to have custom code in the the directory by NOT linking that one (or set) of files to the master.  

Planning on doing this very soon for our hosted installations.

–Tony

sunsetsystems wrote on Monday, August 31, 2009:

Tony, what method did you use to get around the problem of PHP retrieving included files from the linked-to tree when using soft links?

Rod
www.sunsetsystems.com

lacktrum wrote on Tuesday, September 01, 2009:

I think for now I will look at using hardlinks.  Its pretty easy to hardlink a souce tree with cp -Rl and then I can replace the sqlconf and globals files.

Truman