HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Vanilla Instance to work with two Projects

We already have a vanilla setup that serves a specific community, and we're exploring the feasibility and the custom architecture of our setup if we can create a second community using the same core code. We're interested heavily in the mono-repo setup and to see how it's possible with Vanilla with the required steps that are required to do so.

Is it possible to create a mono-repo where two sites share the same core code but have different themes, custom features, and separate configurations?

Please note, that the two sites will have the same working functionality:

1) Creating/Updating user account feature

2) Signup/Login feature

3) Creating/Updating/Deleting Discussions

4) Creating/Updating/Deleting Comments on the forum's discussions.

The difference between the two sites is the general theme, content, categories, additional plugins that could be used only for one of the sites, ..etc.

Comments

  • KasparKaspar Moderator

    If it was just content/community you could control it via role priviliges.


    With features/function I'd say go 2 different setups

    mohamadomran
  • R_JR_J Ex-Fanboy Munich Admin
    edited July 31

    Sounds interesting!

    I would start with the following folder structure:

    /server1
    /server1/cache
    /server1/config
    /server1/uploads
    /server1/index.php
     
    /server2
    /server2/cache
    /server2/config
    /server2/uploads
    /server2/index.php
     
    /vanilla
    /vanilla/...
    

    Copy /vanilla/conf/* to /serverX/conf

    The serverX index.php files should declare differing PATH constants for their folders:

    <?php
    define('PATH_CACHE', getcwd() . '/cache');
    define('PATH_CONF', getcwd() . '/conf');
    define('PATH_UPLOADS', getcwd() . '/uploads');
     
    require_once(__DIR__ . '/../vanilla/index.php');
    

    You must "only" take care that your config files in your serverX folders are synched. Install Vanilla, take a close look at the config settings and pick what is indivdual: database settings, installation secret etc. Then write a script that intercept changes to serverX/conf/config.php and apply that setting to the other conf, but with a blacklist of settings which should never be individual for each forum


    mohamadomran
  • R_JR_J Ex-Fanboy Munich Admin

    Second thought: it would be much more robust to work with symlinks.

    You need to have separate cache and uploads folders and separate conf/config.php files everything else can be shared.

    And since Vanilla doesn't take up an awful lot of space, you might directly sync both folders to physically hold all the files themselves, so that there is literally no difference to a normal setup

    Your task will be writing a sync script for the config file, which shouldn't be that hard


  • Thank you @R_J!

  • Hi @R_J! I'm still a bit new to the vanilla-forum world, even though I have this specific task of creating the mono-repo solution for different vanilla instances. Regarding the script file that will be responsible for symlinking the ServerX/ServerY files, should be called inside the bootstrap.before.php?

    I would really appreciate your help or if there are any links that would guide me 😁

    Thank you!

  • R_JR_J Ex-Fanboy Munich Admin

    No, that's no Vanilla problem. Server space is cheap, so simply copy what you can and sync what is needed, that's the most stable solution. After each update, simply copy everything except /cache and /uploads to serverX and serverY. No too fancy script needed.

    You need to set up as much as possible in your /vanilla setup. Then copy that config.php to the serverX and serverY folders. Customise them as much as needed and do a file diff between them and the original /vanilla/conf/config.php

    Hold the lines that are different in two extra files, not readable by the web server. Then, after each update copy those lines at the end of /serverX/conf/config.php and /serverY/conf/config.php files and that's it.

    If you need to change settings, do a before and after diff of the config file where you made the changes (e.g. discussiones per page) and implement them in the two extra files.


    As I said: the only Vanilla related knowledge is which folders cannot be shared and where config files are stored.


Sign In or Register to comment.