##run on PVE1
lvcreate -V 50G -T pve/data -n gluster_brick
mkfs.xfs /dev/pve/gluster_brick
mkdir -p /data/gluster
echo "/dev/pve/gluster_brick /data/gluster xfs defaults 0 0" >> /etc/fstab
mount -a
mkdir -p /data/gluster/git_vol

##run on PVE2
lvcreate -V 50G -T pve-SSD1/data -n gluster_brick
mkfs.xfs /dev/pve-SSD1/gluster_brick
mkdir -p /data/gluster
echo "/dev/pve-SSD1/gluster_brick /data/gluster xfs defaults 0 0" >> /etc/fstab
mount -a
mkdir -p /data/gluster/git_vol

##common tasks - run on both PVE's
apt update && apt install -y glusterfs-server
systemctl enable --now glusterd
systemctl status glusterd

##Connect PVE1 to PVE2
gluster peer probe 172.16.201.106

##Connect PVE1 (and 2 by proxy) to the Pi (Witness)
gluster peer probe 172.16.201.250

#Validate that the peers see each other
gluster peer status

##run on PVE1 to create the replica
gluster volume create git_vol replica 3 arbiter 1 \
  172.16.201.206:/data/gluster/git_vol \
  172.16.201.106:/data/gluster/git_vol \
  172.16.201.250:/data/gluster/witness \
  force

##run on PVE1 to start the volume
gluster volume start git_vol

##final mounts on both PVEs
mkdir -p /mnt/shared/git
echo "localhost:/git_vol /mnt/shared/git glusterfs defaults,_netdev 0 0" >> /etc/fstab
mount -a
df -h /mnt/shared/git

##for any of the LXC's that need access to the gluster fs use this:
nano /etc/pve/lxc/{YOUR_LXC_ID}.conf #replace the {} section with the numerical value
add:
    mp0: /mnt/shared/git,mp=/mnt/git_data
pct stop {YOUR_LXC_ID} && pct start {YOUR_LXC_ID} #restart the lxc - replace the {} section with the numerical value

