Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a LAMP-based website/application and I'm preparing to start serving clients. With my current system, each client would need a full website instance (full folder structure from web-root up). I would like to separate out the core application while only creating the necessary customized files for each client.

Here's what I'm looking for: A way to say "if the file exists in the client folder, use that one. Otherwise, use the file from the core application folder." A sort of conditional or prioritized symlink, but working for a whole folder tree. That way I won't have to change code throughout the framework, and the separation can happen transparently to the application.

Does this functionality exist in Linux, or is it something I'd need to implement myself in the web server?

Thanks!

share|improve this question
add comment

3 Answers

You can use a union filesystem like aufs or UnionFS to overlay directories on top of each other. Accessing a file involves checking the overlays in a specific order until the file is found.

share|improve this answer
    
I will look into this. The ordered-overlay system is exactly what I was envisioning and having trouble describing. Thanks. –  user1259576 Feb 26 '13 at 18:04
add comment

What you describe is usually accomplished through versions. The most used versioning systems lately are Subversion and Git.

If you set up a base repository you can branch it for every customer installation and provide patchs and diffs as necessary to modify the sources. Since you will have diferent branches of the main application you will have to test the patches applied on the base application for every branch, but there's really no other way around this.

Since you are using Linux and both SCM are provided with all the major distros you will not have much hassle setting up any of them.

share|improve this answer
add comment

The common method to this is to use a folder structure for your app that supports this, like /app for the common code and /config for the local config. You then symlink /app to a common source code directory and have an actual directory for /config. This is easy to reproduce and effective. Among other things, it allows for a very easy update option as you just have to replace one common directory.

I would consider this as a very basic quality criterion and suggest to fix your app to allow this.

Beside this, the functionality you originally asked for doesn't exist.

share|improve this answer
    
I tried this approach first, however at the core is a pretty bloated CMS (I realize the downsides of this, a separate discussion...) that is really going to be a bear to recode for this. I may keep implementing this method, but it just seemed like there might be an easy way to handle it beneath the application. –  user1259576 Feb 26 '13 at 16:20
    
Doing this with Drupal took all of two symlinks. Maybe it was three. I don't remember, but it is in git... –  Michael Hampton Feb 26 '13 at 20:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.