ethanbeyer

Sharing Modules Within MultiSite Setup

Recommended Posts

I have a question about Multiple Site implementation, and how to possible "share" modules between them.

First, required reading: https://processwire.com/api/modules/multi-site-support/  I'm dealing with Option #1.
The way this works is that in the root directory of a site, there is an index.config.php file that denotes what domain is mapped to which site-*/ directory.

The project I am working on has three site-*/ directories, each with their own site-*/modules/ directory.
What has happened is that a lot of the modules from site to site are the same.

I was wondering if there was any way to "share" modules between sites in the Multiple Site setup, via symlink or alias, or potentially if there was some roadmapped feature that @ryan has planned to solve this issue.

Either way, any help/pointers would be appreciated!

Share this post


Link to post
Share on other sites

Symlinks will surely work, but really if you're separating them in different sites, why couple them together via modules? I can see the appeal, but really it's a bit more initial work for more freedom later. Also multi site setups are rather rarely used, so I'm not sure if there will be much of a roadmap for the feature.

Share this post


Link to post
Share on other sites

Not saying it's a good idea because I have no idea how stable it would be, but if you wanted to share all the modules between the sites you could do something like this in each /site/config.php:

$config->paths->siteModules = $config->paths->root . 'shared/modules/';
$config->urls->siteModules = $config->urls->root . 'shared/modules/';

 

  • Like 1

Share this post


Link to post
Share on other sites
17 hours ago, Robin S said:

Not saying it's a good idea because I have no idea how stable it would be, but if you wanted to share all the modules between the sites you could do something like this in each /site/config.php:


$config->paths->siteModules = $config->paths->root . 'shared/modules/';
$config->urls->siteModules = $config->urls->root . 'shared/modules/';

 

Interesting solution. On my local/dev setup I use Symlinks as I need to easily test my modules in different PW installs. 

  • Like 1

Share this post


Link to post
Share on other sites

Had to report back and say that in a multi-site environment, where all the sites are using the same ProcessWire core, it is possible to "share" modules by the method listed above, with no need for symlinks!

$config->paths->siteModules = $config->paths->root . 'shared/modules/';
$config->urls->siteModules = $config->urls->root . 'shared/modules/';

 

  • Like 2

Share this post


Link to post
Share on other sites

Interestingly, this doesn't seem to work for AdminThemeUIKit.

Never mind! I had already consolidated my modules under a base installation rather than a shared location.

Edited by gornycreative
NEVER Mind

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Guy Verville
      I know it is possible to have a different domain name for each language of a site. For exemple:
      monsite.com (for French) mysite.com (for English) I know also that we can have several sites in one installation with the help of Soma's Multisite module.
      I have a company who has four independent sites (four different companies under a same umbrella). The new design and structure of those sites will be practically identical. There will be different administrators for each site, but a lot of data will be shared, so using Soma's module seems to be a good idea. The problem is that those 4 sites have different names for the French and English version.
      compagnieUn.com (for French) companyOne.com (for English) compagnieDeux.com (for French) companyTwo.com (for English) etc. Will we shoot ourselves in our feet to develop with just one installation? Would it be preferable to make those sites able to talk to each other instead?
      Your input would be very much welcome!
    • By J_Szwarga
      What is the best practice for having a form (only accessible to a logged in user) save the user's progress between sections of the form? Fieldsets? Multiple forms?
      Use case: I have a very long application form that would take 30 minutes for the applicant to fill out and I would hate for all progress to be lost due to user error. The progress needs to be logged into the user's page.
      Thanks!
    • By Jimmie Bragdon
      Wondering if anyone can help me get past a sticking point.  
      I'm setting up a Processwire instance in a multiple site setup (using Soma's multisite) to run several related websites.  I am getting stuck on the tagging system that I am using (adapted from a standalone PW site I'm running).  I have the tags themselves set up as Pages, and the Tags field on the related pages is and ASMselect field that populates based on the pages underneath /tags/ in the tree.  This system works fine on the standalone site.
      Where I am running into issues, is with trying to use them with the multisite setup.  Specifically, choosing the proper subset of pages for tags on the ASMselect input tab.  I want to choose only the tag pages for the site in question.  
      My tree is laid out like this:
      Multisite / 
                | site1.com
                     | subsections
                | site2.com
                     | subsections
                | Tags
                     | site1.com
                          | tagA
                          | tagB
                     | site2.com
                           | tagC
      So far, the best I've been able to do is to use  'parent.has_parent=/tags/' in the Custom Find or Selector String portion of the Selectable Pages section of the input.  This gives me the options of choosing tagA, tagB, or tagC on a page under site1.com.  What I'd like to find is a selector that allows me to only see tagA, tagB as options from a page under site1.com and only tagC on a page under site2.com.
      Elsewhere in my php templates, I'm using $page->rootParent->title to set the proper scope and URLs for things, but I have not found a way to get that to work in this field input setup.  I am trying to avoid creating specific fields and templates for each site, as unified templates were part of the purpose of going with a multisite install.
       
      Thanks in advance for any ideas.
    • By ryanC
      Hi, I have created a new install of Processwire 3.0.98, (local machine) and I am unable to install any modules from within Processwire itself. I go to Modules/Site/Add New/ then under "Module Class Name" I enter the name. The module appears, I hit "Download and Install", but I always get an error. For example: 
      "File could not be downloaded (https://github.com/adrianbj/TracyDebugger/archive/master.zip) 2: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version, 2: fsockopen(): Failed to enable crypto, 2: fsockopen(): unable to connect to ssl://github.com:443 (Unknown error) (tried: curl, fopen, socket)"
      I have been able to track down some of the modules and just upload the zip file manually, but this is happening with every module that I had previously installed in another installation with no problems. Any ideas? 
      Thanks!
    • By cosmicsafari
      Hi all,
      Just a quick question, when using the multisite module is there anything different that needs to be done in order to setup HTTPS for each of the domains its serving?
      Would a single SSL certificate for the main domain be enough to cover the others aswell or would you need multiple ceritficates one for each domain the mutlisite setup uses?