I going to try creating a NFS server and have Prestashop server point to it to serve the files, if this is successful it could be a way to share files between multiple Prestashop servers. If anyone has done anything like this or has any advice please chime in. I could really use the help.
NFS has a simple client-server architecture that allows a server to export a directory to one or more clients, which can mount it as a local file system. This makes it easy to set up and manage shared storage for PrestaShop's files, such as product images, cache, and logs.
Procedure
Step 1: Install the NFS server package
Connect to the Ubuntu server as root via SSH or the console.
Update the package index & Install the NFS server package:
sudo apt update
sudo apt install nfs-kernel-server
Step 2: Create a shared directory
Create a directory to serve as the shared directory for PrestaShop's files:
sudo mkdir /var/nfs/share
Grant read and write access to the directory for the NFS clients:
sudo chown nobody:nogroup /var/nfs/share sudo chmod 777 /var/nfs/share
Step 3: Configure the NFS server
Edit the /etc/exports file:
sudo nano /etc/exports
Add the following line to the end of the file to export the shared directory to the NFS clients:
/var/nfs/share *(rw,sync,no_subtree_check,no_root_squash)
This line specifies that the directory /var/nfs/share should be exported to all clients with read-write permissions (rw), synchronous mode (sync), without checking for subtree changes (no_subtree_check), and without mapping the root user (no_root_squash).
Step 4: Restart the NFS server
Restart the NFS server to apply the changes:
sudo systemctl restart nfs-kernel-server
Step 5: Test the NFS server
Connect to each PrestaShop VM as root via SSH or the console.
Install the NFS client package:
sudo apt update sudo apt install nfs-common
Mount the shared directory on the VM:
sudo mount <nfs-server-ip>:/var/nfs/share /path/to/prestashop/folder
Replace <nfs-server-ip> with the IP address of the NFS server, and /path/to/prestashop/folder with the path to the folder where PrestaShop is installed on the VM. This command mounts the shared directory on the VM as a local file system, allowing PrestaShop to access the files in the shared directory as if they were stored locally.
To make the mount permanent, add the following line to the /etc/fstab file on the VM:
<nfs-server-ip>:/var/nfs/share /path/to/prestashop/folder nfs defaults 0 0
This line specifies that the NFS server should be mounted at boot time with default options.
Test the shared directory by creating a file in the directory on one PrestaShop VM and verifying that it appears on all other PrestaShop VMs that have mounted the directory.
Crossing my figners if this works