In this tutorial I will walk you through the setup of a load balanced WordPress website setup.
I have a previous video on this setup but in this tutorial I will use the new Object Storage service in Lightsail.
Here is the diagram that we will setup. However the Distribution/CDN will be done in another tutorial so subscribe if you want to see that video:
- Get one instance with WordPress Site setup
Move Database from Local to Database Service
- Create database service
- Export Mysql database (replace parameters appropriate for your setup, if different)
mysqldump -u root -p bitnami_wordpress > database.sql
- Import Mysql database (replace parameters for your setup, if different)
mysql -h [host] -u dbmasteruser -p dbmaster < database.sql
Setup Object Storage
- Create a new Object Storage
- Change permissions to public and Read-only
- Attach instance to the Storage
- Install the S3 Offload plugin
- Setup the plugin
- Test upload
- Update wp-config.php with new database connection string
- Create instance snapshot
- Create instance from snapshot
- Setup Static IP
Setup Load Balancer
- Create Load Balancer service
- Attach both instances.
- Create SSL Certificate
- Update DNS for www. domain
- Attach SSL to Load Balancer
- Enable session persistence setting
- Attach 2nd instance in Object storage
If you have an existng website with many plugins you may have to perform a few extra steps or fix issues that arise with plugins and themes that do not work well in this setup. Also for existing websites I suggest you migrate the website to new instances, instead of making your existing instance setup this way.
Additionally the one thing that I haven’t found how to solve is updating Themes and Plugins. Those files/folders are not shared across the instances so you have to update them manually on each instance. If you have any ideas on how to make that better please let us know in the comments below.
All videos tutorials on the website as well as the YouTube channel aim to provide a simplified process for a specific scenario; there could be many different factors and unique use cases you may have. The tutorials may not cover every situation; so treat is as a starting point or learning concept to apply to your unique situations, and consider this inspiration but not prescription or explicit direction.