Multi region wordpress deployment on cloud - wordpress

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.

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/

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.

Related

How best to instantiate multiple clone sites and maintain them?

Context:
We have a WordPress/Woocommerce site that has a wide range of custom-tailored features that solve for a specific marketing need.
We want to have variants of this same site (around 80% of the code would be the same) for different domains hosted on completely different servers.
Question:
What would be the best approach to instantiate and maintain the clone sites?
Additional Details
We don't track (git) WordPress core files.
We track (git) only vital plugins for the site, the remaining are ignored.
The difference between sites would be mainly branding, but still content AND code related.
The idea is to set up a new "clone" site in a short period and still be able to migrate new features in future.
Deployment Specs
We use Laravel Forge to provision AWS servers.
We use Bash script for installing all dependencies, downloading WP core, restoring a sample DB.
We use composer for dependency management.

How to make changes in wordpress data and files from single place when I have 2 aws instance with auto scalling

I'm not a server guy, but for my website I have started learning about aws because I have migrated my website from godaddy to aws.
I have searched for my problem in many tutorials, documentation, youtube and stackoverflow as well but could not find it. I'm struggling with this for 1 week.
I have installed wordpress on my aws using bitnami. My website was running with 1 instance i.e free created using bitnami and I have added more than 22k records on my wordpress site so My site started loading very slow because of heavy data in the database which was causing 100% cpu usages so often then I did the following
added load balancer and attached existing instance with elb
created image of existing instance (bitnami wordpress instance)
created the launch configuration under auto scaling
created auto scaling group
now 1 more instance started showing
I have added this new instance to load balancer as well
now website is loading very fast because the load is divided into 2 servers
Now the prob is
both servers have the different database I need to add more data, how I can add data? do I need to add data to both server database individually?
As both servers are different so both have different files and I need to make lot of changes in the files because website is under development. do I need to make changes in both server files always?
is there a way that both servers serve the same database and same files so I don't need to make changes in 2 different places everytime
I will be really thankful if anyone can get me out of here. I believe this is a common problem many people should have faced but I did not find anything like this anywhere which could help me.
Thanks,
You need to take your database out of the Auto Scaling Group and put other materials in a shared storage. You could use Amazon RDS as your database and Amazon S3 as a shared storage. Both of these services are scalable so you don't need to worry about scaling in/out in the future. Also refer to this tutorial for deploying a high availability WordPress website.
I got it resolved by moving to RDS and it works like a charm. now my files and database are hosting in different servers and website loading speed also improved.
I have tested website with some load testing tools and it can handle some huge number of traffic now.
Note: I have shut down the old instance now website is working on 1 instance only and its working beter than before.
Thanks #mahdi your answer helped me.

Azure app service (paas) + Storage + WordPress

I would like to run multiple WordPress instances using Azure Application Service and have a dedicated VM running their MySQL databases.
Let's say each Wordpress site was a gig in size (uploaded files not database) and my App Service plan comes with 50gig storage. This means I could theoretically run a max of 50 WordPress sites on that
plan.
Is it possible to link a blob storage plan to my paas plan and have all WordPress sites stored on the additional storage plan?
I know there is an outdated WordPress plugin that supposedly stores uploaded media on Azure storage plans. I'm not interested in that. I want all WordPress files stored and served from a separate storage plan.
If I was to spin up a VM running IIS I imagine I could do this by simply pointing each IIS site to each WordPress install on a storage plan data disk. Just wondering if I can do the same using Paas?
Technically App Service is already doing this. Your 50GB of space is in Blob Storage. But as you suspect, you have no control over this yourself. If you want/need that level of control, then you need to switch to a VM as you suggested.
This is exactly why the storage plugins were built, to move the uploaded media files into Blob Storage to maximize available space and improve performance.
Another way to save "local" space would be to run as a multisite if possible. Then you would only need one copy of WP and any plugins in common for the various sites.

google cloud and wordpress

I have just started playing with Google cloud. I used to work on normal servers so I need advice.
I created my first instance and deployed Wordpress. I installed woocommerce plugin. The shop is quite fast and I am happy (with the lowest settings) but now:
I wanted edit function.php but I can't. The attributes are read only so How can I change it?
How to get access to my all files I can't see them in storage cloud. How to set up ftp?
What about database for my shop? I understand I can create new data base but where to access to current data base of my wordpress.
What should I deploy more to work comfortable with my wordpress?
About ssl
SNI SSL certificate slots are offered for no additional charge for
accounts that have billing activated. Free accounts are limited to 5
certificates.
I have no experience with ssl but I plan run shop so what it means. Free certificates for 5 instances or 5 deployement ? How many certificates do I need to run one shop?
I know there are many questions but I wanted to go further and all advise on internet is outdated because are for older versions of google cloud. Please help me to understand this all.
I assume you're attempting to use WordPress on Google App Engine.
GAE has no real filesystem, so you cannot write to it (unless you juggle with the API GAE offers). Editing happens locally using the GAE SDK development server and you deploy your changes to the App Engine ecosystem using the SDK interface (GUI or CLI). All application writes should go to Google Cloud Storage (which is similar to Amazon S3 and the like).
I'm not certain whether the Google Cloud Storage can be accessed via traditional FTP. There might be some middleware required. You can see and browse the contents of your buckets in the developer project console (https://console.developers.google.com/).
The databases are on a separate "server" when using GAE. MySQL instances are spawned into the Google Cloud SQL ecosystem, which are available for App Engine and Compute Engine instances (and why not other places too). You can define the GCSQL address and port to wp-config.php like normally. You need to create a local MySQL database for your local installation. More: https://cloud.google.com/appengine/docs/php/cloud-sql/
When working with Google App Engine you should deploy the whole WordPress installation (wp-config.php, wp-includes/, wp-admin/, wp-content/, etc.) in order for it to work in the GAE system. For a "better" deployment system you should do some searching or ask a new question dedicated for that issue.
The certificates themselves on GAE are not free, but the "slots" you put the certificates into are. Free projects (no billing enabled) offer 5 free slots where you can put your purchased certificates. SSL SNI means that you can use multiple different domain/host certificates under a single listening IP address (which some years back was not that simple to do). What this all means that GCP offers a way to use certificates with their services, but you still need to get the certificates themselves elsewhere.
Have you seen the GAE starter project offered by Google: https://googlecloudplatform.github.io/appengine-php-wordpress-starter-project/ ? It makes your live a bit easier when developing WP sites for Google App Engine.
If you're working with Google Compute Engine instances, then they should operate just like regular VPS machines, with some Google restrictions applied. I have not used them so I do not know the specifics.

How to scale a document storage system?

I maintain a web application (ASP.NET/IIS7/SQL2K8/Win2K8) that needs to access documents, actually hundreds of thousands of documents, and growing. Currently, they are all on a Windows 2K8 Server fileshare, being accessed by UNC path (SMB). The files are in a single flat directory and I'm trying to plan how to best improve this solution. I don't want to use the SQL Filestream attribute as it would be significant effort to migrate it all into that, and would really lock in to SQL Server. I also need to find a way to replicate the data for disaster recovery, so perhaps a solution can help with that too.
Options could be:
Segment files into multiple directories?
Application would add metadata for which directory it's on (or segment by other means)
Segment files into separate servers? (virtualize)
Backup becomes more complicated.
Application would add metadata for which server it's on
NAS Storage
SAN Storage
Put a service (WCF) in front of the files and have the app talk to the service
bonus of being reusable across many applications
Assuming I'm going to store on filesystem and not in database (I've read those disccusions here), which would be a more scalable solution?
You've got a couple issues:
- managing a large volume of (static?) files
- preparing for backups and disaster recovery of said files
I'll throw this out there, even though I'm not a fan of the answer, but you might poke around with the free SharePoint 2010 Foundation that's included with server 2k8. If you're having issues with finding the documents you need (either by search, taxonomy via tagging or other metadata) as well as document expiration and you don't want to buy a full blown document management system, this might be a solution. Of course it introduces new problems...
If your only desire is to have these files available to spit out on the web, then the file store like you're using now really is the simplest solution. For DR/redundancy purposes, I'd look at a) running them on a raid/SAN of some sort and b) auto-syncing them with the cloud (either azure or amazon). For b) you can get apps that make the cloud appear as a mapped drive and then use an rsync type software to keep the cloud up to date.
If you want to build something new and cool, you might think about moving the entire file archive into the cloud and just write a table in a db to manage the file name, old location, new cloud location and a redirector code that can provide the access tokens to requestors.
3 different approaches... your choice.

Resources