I have a code set which I would like to use on multiple websites. The code set defines a platform which will be used on multiple subjects. I want to force each website instance to automatically synchronize with this source so they always remain on the same version of code. It gets a little tricky become some website instances will not be a full version of the source code.
For example:
The source code consists of:
component A
component B
component C
component D
component E
Website Instance 1 consists of:
component A
component B
component C
component D
component E
Website instance 2 consists of just:
component A
component D
component E
Website instance 3 consists of just:
component A
component B
component C
Each instance may not have the same arrangement of components as the other, but the common goal is to retrieve the necessary components from the source code when an update occurs. My current approach involves running an update script which knows the configuration/make-up of each individual instance. It then replaces the entire website instance code with a copy of the newly updated code from the source. This works, but it seems to be messy an error prone. Is there a better approach for managing version synchronization across multiple instance using a single code source?
All the websites are on one server. The source code is currently on a different development server. However, the source code could be stored on the same server as the websites without much difficulty.
Each component has the same source code. The only difference between implementation is contained within a config file. The config file contains all of the dynamic data, this includes meta information, email address, site name, database connection (each instance of each component has its own database).
Website 1 Component A will equal Website 2 Component B minus the differences defined in the config file for Component A. However, Website 1 is not required to have Component A, it may only have Components B and C.
I hope this makes sense. If not let me know and I’ll try to explain it better.
www/
/lib/
/core/
/components/
/a/
/b/
/c/
/site-a/
/www/
/lib/
/core/<-- Symlink to /www/lib/core/
/components/
/a/ <-- Symlink to /www/lib/components/a/
/site-b/
/www/
/lib/
/core/<-- Symlink to /www/lib/core/
/components/
/a/ <-- Symlink to /www/lib/components/a/
/c/ <-- Symlink to /www/lib/components/c/
/site-c/
/www/
/lib/
/core/<-- Symlink to /www/lib/core/
/components/
/b/ <-- Symlink to /www/lib/components/b/
All the actual files are located in /www/lib/ and the other sites mearly use a symlink to the required core and components. Adding a new component is as simple as adding a new symlink to the source folder.
This way, you can update everything in /www/lib and every folder linking to it will automatically receive the new source.
/site-a/
/www/
/lib/
config.file
/core/<– Symlink to /www/lib/core/
/site-b/
/www/
/lib/
config.file
/core/<!-- Symlink to /www/lib/core/
In this example, will config.file interact with the contents of /www/lib/core/ the same way it would interact if it was directly in the /www/lib/core/ directory?
If I remove config.file from this location entirely and require /site-a/ and /site-b/ to contain the config file as seen in the first quote. Would this work? If not, any suggestions on how to get this idea to work?