Best practice for php application files on multi server deployment

Hi All,

I have installed next cloud on the following:

1 Load Balancer (HA Proxy)
2 Webservers (Apache)
2 Fileservers (glusterfs - replicated volume for data)
1 SQL Server (MySQL - Haven’t looked into db clustering yet)

Now I have my nextcloud data stored in /mnt/data/nextcloud, /mnt/data is the mount point that points to the glusterfs volume

nextcloud php application is installed locally on each apache2 server: /var/www/localhost/htdocs/nextcloud.

All works great, however, I noticed that when changing settings in the admin panel, for example, mail settings, max upload size, etc, that the config file and .htaccess file is written and changed. This is a problem on a multiserver setup as it will only change on the local server, and not every server in the pool of application servers.

I have tried putting the nextcloud php application in glusterfs, along with the data, like follows:
nextcloud php application: /mnt/data/nextcloud-app
nextcloud data dir: /mnt/data/nextcloud-data

This gets around the issue, however, glusterfs is known to slow down php applications hosted from it, and I noticed a massive impact on page load speeds when the application files are stored in the gluster volume.

What is the best way of keeping the application servers in sync with each other? I assume that .htaccess, as well as the config and apps directories can change, so they need to be replicated, in both directions, on all application servers.

Best idea I have come up with is to use unison and a cron script to sync changes on schedule.

Any thoughts?

Thanks

@JasonBayton shared some information about a 3 node cluster he tried to set up.

1 Like

Indeed, some good learnings on the topic and my writeup if you’re interested. You’re welcome to ask followup questions.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.