1

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!

3 Answers 3

1

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.

1
  • I will look into this. The ordered-overlay system is exactly what I was envisioning and having trouble describing. Thanks. Feb 26, 2013 at 18:04
0

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.

2
  • 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. Feb 26, 2013 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... Feb 26, 2013 at 20:24
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .