• A valid XenForo Licence validation token will be required to complete signup and purchasing.
    This may retrieve this from the XenForo Customer Area.
  • All XenForo 2.3+ add-ons require at least php 8.0, recommend php 8.2+
    All XenForo 2.2+ add-ons require at least php 7.2, recommend php 8.x
    All XenForo 2.0-2.1 add-ons require at least php 5.6, recommend php 7.x.
    The Standard Library add-on is also required.
    Older php versions are not supported, and add-ons will either refuse to install or fail to function.
  • Automatic discounts are applied for orders above $100 USD (10%) or for early renewals (5%)

Csync2 Wrapper

Share-nothing XenForo application file clustering

Overview Releases (13)

Provides a csync2:// stream for synchronous replication (https://github.com/LINBIT/csync2).

Notifications of Deletes/Writes to this stream are pushed to Csync2 to distribute to pre-configured Csync2 config.

Requires:
  • php 7.4+
  • XenForo 2.2+
  • Csync2 2.0
  • Security configuration of csync2;
    • Set the uid bit (chmod 6755 /usr/sbin/csync2) set on the csync2 binary
    • OR
      • Csync2's key file for the group used in syncing must be read/writeable by the user php is running under.
      • Csync2's sqlite database folder (/var/lib/csync2/) must be writeable by the user php is running under, OR the
      • php-user also requires access to the key file for the group sync config.
  • Don't sync the sqlite database!

Assumes the following csync2 groups are setup:
  • www_code
  • www_data
  • www_templates
(can be set via config.php)

Add-on activation instructions

This add-on comes in two parts;
  • The modification of the file adapters
  • The add-on itself

The add-on provides integration to-do bulk file operations rather than individual operations. This mostly matters when rebuilding config


XF2 config section:
PHP:
$enableCsync = true;
\SV\CsyncWrapper\CsyncConfig::init($enableCsync, [
    'groups' => [
        'code'      => 'www_code',
        'data'      => 'www_data',
        'templates' => 'www_templates',
        'others'    => [],
    ]
]);
$config['fsAdapters']['code-cache'] = function () use ($enableCsync) {
    $fa = new \SV\CsyncWrapper\FileAdapter('internal_data/code_cache');
    $fa->setBypassMode(!$enableCsync);
    return $fa;
};
$config['fsAdapters']['data'] = function () use ($enableCsync) {
    $fa = new \SV\CsyncWrapper\FileAdapter('data');
    $fa->setBypassMode(!$enableCsync);
    return $fa;
};
$config['fsAdapters']['internal-data'] = function () use ($enableCsync) {
    $fa = new \SV\CsyncWrapper\FileAdapter('internal_data');
    $fa->setBypassMode(!$enableCsync);
    return $fa;
};
$config['internalDataUrl'] = '/internal_data';

Csync2 install instructions

Docs; https://github.com/LINBIT/csync2/blob/master/doc/csync2.adoc

Code:
yum install -y epel-release
yum groupinstall -y "Development Tools"
yum install -y librsync-devel gnutls-devel sqlite-devel
wget https://github.com/xon/csync2/archive/csync2-2.0.zip
unzip csync2-2.0.zip
cd csync2-csync2-2.0
aclocal
autoheader
automake --add-missing --copy
autoconf
./configure  --prefix=/usr --sysconfdir=/etc/csync2 --localstatedir=/var
make
make install

Add /etc/xinetd.d/csync2
Code:
# default: off
# description: csync2
service csync2
{
    disable = no
    flags       = REUSE
    socket_type = stream
    wait        = no
    user        = root
    group       = root
    server      = /usr/sbin/csync2
    server_args = -i
    port        = 30865
    type        = UNLISTED
    #log_on_failure += USERID
    disable     = no
    # only_from = 192.168.199.3 192.168.199.4
}
Install xinetd:
Code:
yum install -y yum install xinetd
systemctl enable xinetd
systemctl start xinetd
TODO - convert to socket systemd activation


Adjust firewalling (adjust IP as need);
Code:
sudo iptables -A INPUT -p tcp -s 127.0.0.1 --dport 30865 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables-save > /etc/sysconfig/iptables

Csync2 config

csync2 file ownership

Code:
chown php-user:php-user /var/lib/csync2
chmod g+w+s /var/lib/csync2

csync2 -k /etc/csync2/csync2-xf2.key
chmod 640 /etc/csync2/csync2-xf2.key
chown root:php-user /etc/csync2/csync2-xf2.key

config suggestions

Code:
group www_code
{
    host NODE01;
    host NODE02;
    host NODE03;

    key /etc/csync2/csync2-xf2.key;
    auto younger;

    include /var/www/html;
    include /var/www/html;
    exclude /var/www/html/internal_data;
    exclude /var/www/html/data;
    include /var/www/html/internal_data/code_cache;
    include /var/www/html/internal_data/code_cache/phrase_groups;
    include /var/www/html/internal_data/code_cache/templates;
}

group www_data
{
    host NODE01;
    host NODE02;
    host NODE03;

    key /etc/csync2/csync2-xf2.key;
    auto younger;

    include /var/www/html/data;
    include /var/www/html/internal_data;
    exclude /var/www/html/internal_data/temp;
    exclude /var/www/html/internal_data/code_cache;
}


group www_templates
{
    host NODE01;
    host NODE02;
    host NODE03;


    key /etc/csync2/csync2-xf2.key;
    auto younger;

    include /var/www/html/internal_data/code_cache/phrase_groups;
    include /var/www/html/internal_data/code_cache/templates;
}

To adjust which groups are used, edit config.php
PHP:
\SV\CsyncWrapper\CsyncConfig::init(true, [
    'groups' => [
        'code'      => 'www_code_xf2',
        'data'      => 'www_data_xf2',
        'templates' => 'www_templates_xf2',
        'others'    => [],
    ]
]);

Product Information

csync2 linux php 7.4+ XenForo 2.2+
Seller
Atelier Aphelion
Release date
Last update
Customer rating
0.00 star(s) 0 ratings

Pricing information

12 Months
$60.00
Renewal cost
$40.00

Share this product

Back
Top