2

I have been looking for many blog and site to deploy the Wordpress website multi-region on cloud platform.

I have go through GCP App Engine and Kubernetes but didn't find much.

How to create a database connection from another region and how to manage WordPress media and sync them across the regions. also i am looking for auto-scaling on website.

For database we can use cross region read replica but how to handle the media data and sync them across all the instances in different regions.

ericcco
  • 741
  • 3
  • 15
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102

2 Answers2

3

To deploy highly available and scalable wordpress architectures on AWS, I would suggest to read this white paper https://aws.amazon.com/blogs/architecture/wordpress-best-practices-on-aws/

The key to multi region deployment is to have a copy of the data in both regions. This comes with a lot of challenges if you do consider to have two database masters, i.e. where the write operations can happen (In wordpress words, a write happens when you author a post or when customers are leaving comments)

Having a cross-region read replica is possible with Amazon RDS since 2013 : https://aws.amazon.com/blogs/aws/cross-region-read-replicas-for-amazon-rds-for-mysql/

For master-master setup, have a look at Amazon Aurora Global Database (compatible with MySQL) : https://aws.amazon.com/rds/aurora/global-database/ But i would seriously question why you want to do that first.

[UPDATE 17 July 2019]

I just found out that the bitnami distribution of Wordpress has a documentation explaining how to use S3 for media files : https://docs.bitnami.com/aws/apps/wordpress-pro/configuration/wordpress-aws-s3/

Sébastien Stormacq
  • 14,301
  • 5
  • 41
  • 64
  • Hello @sébastien-stormacq thankyou for writing an answer and pointing out the cases. i have already checked this infrastructure but this is multi-AZ i think instead of the region?. – Harsh Manvar Jul 11 '19 at 07:09
  • Yes you are right we can use cross region replica for database but what if one author form one region storing media data that will be stored in EBS of particular instance instead of sync to other all instances. – Harsh Manvar Jul 11 '19 at 07:11
  • 1
    Good point, I did not think about media :-) Amazon S3 would be your friend. Instead of storing media on EBS, use a Wordpress plugin to store media on Amazon S3. You can use a shared S3 buckets or replicate the bucket content in multiple regions. I never use such plugin however, curious to learn about your experience. – Sébastien Stormacq Jul 11 '19 at 07:14
  • Thank you so much for writing the answer yes can use the S3 bucket there is one plugin called `wp-stateless` so using that I can sync media to s3.I am also having a question of how to initially start? Manually create two VM across the region and set up the whole WordPress using git etc. what best practices you suggest? – Harsh Manvar Jul 11 '19 at 07:19
  • Can setup one VM and using snapshot create another in diff. region. – Harsh Manvar Jul 11 '19 at 07:22
1

I will post this answer even though there are better answers. This answer provides additional information on one particular design.

I have deployed multi-region WordPress on both AWS and Google Cloud. WordPress is simply not designed for this. Unless you have money to spend and IT talent, choose a company that offers distributed WordPress managed. You will save money and headaches.

For the last project, the company did not require instant updates/synchronization globally but required high traffic loads that could be predicted. We decided upon separate WordPress systems in each region. We wrote software that ran once per hour to synchronize the WordPress content between systems. This involved syncing the file system wp-uploads directory, moving static assets to cloud storage behind a CDN and copying content changes to each MySQL database. If there was a conflict, an email was sent to an admin to manually review. Once per day software ran that compared the newest posts to verify content and synchronization between servers.

The systems in each region were load-balanced and auto-scaled. The database was hosted separately on managed MySQL servers. The WordPress directory was hosted on an NFS share. We used cloud storage + CDN for static assets (css, js, images, downloads). Except for cloud storage, we did not share assets between regions. Each region was independent. Each region has at least two servers running at all times. During forcasted peak loads (marketing releases, events, etc.) we would scale up/down each group based on timezone via a GUI click to prewarm the systems.

John Hanley
  • 74,467
  • 6
  • 95
  • 159
  • thankyou for writing answer and providing end to end information describes very well. Thanks a lot. We drop plan to distribute Wordpress due to the delivery timing issue. We used GCP Wordpress HA template which is similar distribute way but that is not multi region. – Harsh Manvar Oct 08 '19 at 05:09