All about TemplateEditor plugin

  • @flames


    How template are stored in db (overview)


    Edit: DB schema outdated. I'll update screenshot in time.

    Files

    • schema.png

      (255.68 kB, downloaded 211 times, last: )

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Some info about implementation

    First, what's that TemplateEditor plugin?


    It's a plugin which must allow the administrator to create customized and persistent versions of i-MSCP service templates (Bind9, Apache2, Postfix, Dovecot...) and assign them to resellers. To resume, the admin will access an interface which will allow to create new versions of a specific template, either, from the default templates, or from a custom version previously created...


    Here, persistent means that even on update, the custom versions will not be overridden, which will solve remaining problems about templates which are overriden on update or reconfiguration, and many other things such as usage of i-MSCP in a private LAN, specific DNS server names...


    Template definition


    Here, a template can be:

    • A single template
    • A group of templates (For instance, when creating a new DNS zone file, i-MSCP is using more than one template)


    Template assignment


    Template scope can be either system-wide or site-wide. For instance, the named.conf template scope is system-wide while the scope for the db.tpl template is site-wide. Only templates which are site-wide can be assigned to resellers.


    Those templates will be stored in database. Each time a template will be loaded, the TemplateEditor plugin will override it if needed, using version assigned to the reseller of the customer.


    Performances


    The plugin will use memcached server (OPTIONAL) on both side (FronTend and Backend), this to avoid:

    • Too many secrets (OUCH, no, that, it's in a movie...) :D
    • Too many SQL queries
    • Too many IO operations


    The plugin will load its own templates through an event listener which will listen the onLoadTemplate event, which is triggered in i-MSCP core. If the template is overridden, the default template will not be loaded.


    I let you now imagine what you'll be able to achieve with that plugin and the gain in term of performance...


    NOTE 1: First version will be provided for the Bind Server implementation only. Support for other server implementation will be added in later version. Also, in near future, I'll add support for customer level assignment.


    NOTE 2: The onLoadTemplate event will be available in i-MSCP version 1.1.1. Listeners of this event will receive the following parameters:

    • Server implementation name
    • Template name
    • Scalar reference which allow to override default template
    • Hash reference containing data as provided by server implementation

    For instance, on proftpd installation, the event will be triggered as this:


    Perl
    1. my $cfgTpl;
    2. my $rs = $self->{'hooksManager'}->trigger(
    3. 'onLoadTemplate', 'proftpd', 'proftpd.conf', \$cfgTpl, {}
    4. );
    5. return $rs if $rs;


    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Updated: Added some info about the event which will be listened by this plugin.
    onLoadTemplate event added in stable branch See https://github.com/i-MSCP/imsc…e315abdd57e986ea518300bb6

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • A little preview of the admin interface (grid here)

    Files

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Second screeshot

    Files

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Another screenshot:

    Files

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Hi @ all
    I get to the install the following error message appears.


    Ein unerwarteter Fehler ist aufgetreten:


    Plugin installation has failed: Unable to create database schema: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'group_service_name' in 'field list'


    what is the name of the calling for the sql correctly.

    my System :

    - Distribution: Debian | Release: 9.13 | Codename: wheezy
    - i-MSCP Version: i-MSCP 1.5.3| Build: 20181208 | Codename: Ennio Morricone
    - Plugins installed: ClamAV (v. 1.3.0), Mailgraph (v 1.1.1), OpenDKIM (v 2.0.0), SpamAssassin (v 2.0.1)
    - LetsEncrypt (v3.3.0), PhpSwitcher (v 5.0.5), RoundcubePlugins (v 2.0.2)YubiKeyAuth 1.1.0

  • @Speddy


    HOW TO EXPLAIN?


    THAT PLUGIN IS STILL UNDER DEVELOPMENT AND iS NOT READY TO USE AT ALL.


    To resume, you must remove it manually right now. ;)

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • ok

    my System :

    - Distribution: Debian | Release: 9.13 | Codename: wheezy
    - i-MSCP Version: i-MSCP 1.5.3| Build: 20181208 | Codename: Ennio Morricone
    - Plugins installed: ClamAV (v. 1.3.0), Mailgraph (v 1.1.1), OpenDKIM (v 2.0.0), SpamAssassin (v 2.0.1)
    - LetsEncrypt (v3.3.0), PhpSwitcher (v 5.0.5), RoundcubePlugins (v 2.0.2)YubiKeyAuth 1.1.0