Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Out of the box, Couch does not support native multi-site installations.

However, if you have several websites, you can have *some* features managed from one place. Share your real-life experience here. Maybe we can figure out the way to improve on current situation.

What we already have is:
a. tool to store changes in database - 'db_persist' tag.
b. tool to get information passed to a page - 'gpc' tag.

Let's say, you need to do something (what is your need? - share!).
- Then we first, follow a link to login in remote Couch isntallation.
- Second, pass information to be updated (like approve all comments in blog, update picture, create a new page, update text, etc..) to the page it is stored on.
- Third, a special script reads all the incoming info (it executes if logged-in admin) and does the dirty job.

This is it.
Came across this topic in my search and just wanted to bump this and see if anyone may have a solution to our scenario.

Basically we're going to be managing multiple client's websites using Couch. What I'm trying to wrap my head around is a way to use a single set of couch files for multiple installs. Each client would have their own separate config file in order to connect to the DB, but then I'd like to use a single code base for the rest of the couch files.

This would allow for easier updates, and only needing to maintain a single base of code, vs needing to go in and update every single client's file base when/if we need to make changes.

Any ideas on how this could work?
There are several components to do what you might like.
Main idea is to organize code so that distribution can be automated without complications.

Part I - CMS-related code management - I keep my code in one place. I have a private offline repository of code, which consists of modded tags, new tags, functions, admin-panel customizations etc. Modifications, validators, shortcodes etc - all is kept in separate files and autoloaded from their subfolders and is stored in main folder '/couch/addons/community-mods'. Physically it is inside /couch/addons folder, so it is safe there. I never modify couch native files, because it is not recommended practice and custom code should not get overwritten if couch is updated on github.

folders.png
folders.png (36.65 KiB) Viewed 1440 times


I also moved /couch/config.php and /couch/addons/kfunctions.php to the site's root for quick access - '_config.php' and '_kfunctions.php'. Couch doesn't overwrite them but still it helps. I also created symlinks to /couch/addons in '/mysnippets' folder which helps for faster access, because I work mostly with snippets. And I have /config-local, /config-server folders, as well as /htaccess-local, /htaccess-server folders because the settings are different between VPS and local PC.

Part II - I need to only update embeddable snippets of code. See http://docs.couchcms.com/miscellaneous/smart_embed.html I never touch main php files, which are dropped in site's root. 100% of my php template files contain the following structure -
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title="Index" clonable='1' nested_pages='0' gallery='0' dynamic_folders='1' order='0010' routable='0'>
    <cms:smart_embed 'template_editables' />
    <cms:smart_embed 'template_config' />
    <cms:smart_embed 'template_routes' />
</cms:template><cms:ignore>
/*

    Index..

*/
</cms:ignore>
<cms:set my_debug='0' />
<cms:smart_embed debug=my_debug 'html_afore' />
<!DOCTYPE html>
<html lang="<cms:show k_lang />">
    <cms:smart_embed debug=my_debug 'html_headers' />
<body>
    <cms:smart_embed debug=my_debug 'html_hero' />
    <cms:smart_embed debug=my_debug 'html_master' />
    <cms:smart_embed debug=my_debug 'html_trail' />
</body>
</html>
<?php  COUCH::invoke(); ?>
<?php //COUCH::invoke( K_IGNORE_CONTEXT ); ?>


Snippets, especially smartly-embedded snippets are the best way to maintain code in chunks, possibly updating it with perfect precision, only those parts that need attention. (If site's footer for page-view is updated, I replace file on server 'html_trail/index-page.trail' (according to my naming structure) and that's it. Same reasoning applies to template editable fields and their configs, they are kept in snippets to the most comfotable work with code and with updates). Smart embed allows any extension, so when I work in code editor I can immediately see which file I need, editable fields are 'index.fields', home-view code is 'index-home.master', configuration of template and fields is 'index.config' etc.

Part III - is a more deeper level of code-chunking, aka snippet inheritance via cms:block-cms:extends tags, which enables us to avoid editing and overwritting any snippets, but just drop a new file that will be automatically picked as most relevant (similar to smart-embed tag, but works with smaller and granular pieces of code) - viewtopic.php?f=5&t=10984

There are possibly other moments that I forgot to mention. All these work environment improvements were done incrementally over the 4 years span since OP. This process never stops. I am sure you probably have some more ideas and plans about managing websites from single place. We can discuss those as well. If this post is not what you wanted, PM me, I can help.

P.S. That repo mentioned is not online or on git, it is a bunch of zip files (I am not a github fan). For each new installation I take what I need and fking unzip them in one click. Every zip already contains the proper folder structure, so the pieces go like a lego. Today it looks like this (probably I should add a couple of files from this week's work).

Attachments

3 posts Page 1 of 1