Quote from: jrg at Dec 20, 2010, 01:29 PM
First, this is the Multi-site setup I want (and set up):
- The core "code" and associated files are shared among the sites.
- Each site is in fact a separate site with its own domain name (i.e. not subdomains and not directories in a single domain). They are, however, hosted on the same service provider and under the same account. That gives (program, but not web browser) access to files outside the web roots.
- Each site is independent of the others and simply shares the core code.
It would be nice to be able to share the connectors and manager code as well — perhaps that feature will be arriving in the future.
The two things:
- The cache is located in the core directory, so it is necessary to avoid having one site over-write or accidentally pick up another site’s cached file
- There is a configuration file located in the core directory (.../core/config/config.inc.php). Since it is particular to a given site, there need to be distinguishable versions of this file for each site.
Both these things are accomplished using a "Configuration key" associated with the site. This key can be set during the installation process, but I ran into a problem that I had to fix — perhaps because of starting out with a "traditional" install. In any case, you can try using setup and if you have issues, here is what the final setup needs to be.
Indeed, traditional is not meant for these kinds of advanced configurations (especially moving the core), thus we have the advanced distribution to avoid these manual steps. Traditional is really meant for shared hosting environments that have limited access (e.g. FTP only, no SSH).
That said, even though having multiple configurations, each with their own database, manager, connectors, etc. is possible already, since components have to be installed into each configuration, this is still not recommended until we introduce the concept of multiple workspaces. Workspaces will basically just provide a way to isolate a set of configuration specific component packages and related items. At the moment you would have to install the components manually into each configuration and make sure they were all using the same versions of specific components since the files shared in your assets/components and core/components directories would all need to be in sync across every site.
Quote from: jrg at Dec 20, 2010, 01:29 PM
Pick a Configuration key for your site. I suggest making it short and reflecting the name of your site. It will be used as a directory name and also as part of a file name, so stick to lower case letters with no punctuation. I used "wccr" for the site I have been experimenting with (it stands for "Women’s Club of Costa Rica").
1) Change the three configuration files in your site’s <site-root> directory:
a) <site-root>/config.core.php
b) <site-root>/manager/config.core.php
c) <site-root>/connectors/config.core.php
by changing the Configuration key. Using my example (in which I am using "wccr" as the key), the define for the Configuration key becomes:
define(’MODX_CONFIG_KEY’, ’wccr’);
2) In .../core/config/ change the name of the configuration file from "config.inc.php" to "wccr.inc.php" (i.e. substitute your Configuration key for the "config" part of the file name). You don’t need to change the contents of the file as you did that when you moved the core directory.
3) Delete everything (except the hidden .gitignore file) in ".../core/cache". Create a directory with the same name as your Configuration key (i.e. I created one called ".../core/cache/wccr"). Make sure it is writable.
Advanced setup handles all of this for you. None of these steps are necessary using the advanced distribution. Actually, if you were not moving the core/, traditional setup does handle a change to the MODX_CONFIG_KEY, which you can choose in the first step of the setup process. But again, multiple configurations on a single core is possible, just not recommended yet.
You could accomplish this with Contexts and Access Permissions using a single configuration though, and then the component packages would be shared across the sites via a single installation.