High Availability WordPress with Digital Ocean Load Balancer, GlusterFS, Spaces, Auto Let's Encrypt SSL Renewal, with Cloudflare DNS
I'm trying to create a High Availability WordPress instance. These is what I think I need
- A Digital Ocean Load Balancer
- Two droplets using GlusterFS
- Digital Ocean Spaces mounted to offload the uploads directory
- Digital Ocean's Spaces CDN enabled
- Automatic Let's Encrypt renewal by utilizing the Digital Ocean API
- Cloudflare's DNS
- At least one database.
From what I was reading, Digital Ocean's Load Balancers handle their own failover which is why I don't think I need a floating IP and two load balancers - please correct me if I'm wrong.
In order to keep WordPress's wp-content directory in sync, I need to use GlusterFS, otherwise, how would I keep the theme and plugin files in sync? What happens if I need to add another node?
To make sure that storage isn't an issue, I want to mount Digital Ocean Spaces to the uploads directory, but I'm confused on how this will affect GlusterFS. I planned on doing this with the WordPress plugin. Will there be problems because there are two backend servers potentially writing to the same files?
I was also thinking of using Digital Ocean's CDN but wasn't exactly sure if this was necessary due to CloudFlare.
I want to automatically renew the Let's Encrypt SSL certificate so I don't have to manually do this everytime it is about to expire, but how do I achieve this? I keep reading that the Digital Ocean API can achieve this but I'm a little confused as to where I should generate the cert and then what kind of script I need to run to update the cert on the Load Balancer.
I want to use Cloudflare for security and caching reasons. Will using Cloudflare's proxy/caching mechanism work on Digital Ocean's Load Balancer?
Finally, I'm confused on what happens with the database if both load balanced servers are writing to the same table entry.
Any help would be appreciated on what I need to do to get this all working. I figured I would go in this order
- Create the two droplets with WordPress installed and setup GlusterFS
- Create the database on a separate droplet and connect WordPress to the database
- Prepare the uploads folder to utilize Spaces & turn on the CDN
- Put the Load Balancer in front
- Assign the DNS to point to the Load Balancer IP
- Begin the SSL cert process
- Enable Cloudflare's proxy