Reputation: 5684
I'm trying to build an autoscaled infrastructure for a WordPress site on Google Compute Engine. For WordPress, I want to use the LEMP(Ubuntu-18, Nginx, Mysql, PHP) stack but with a separate Cloud SQL instance as Database.
Here's my plan:
But, I'm really confused at the first step, how I should set up for WordPress site to create an Instance Template, I don't know how can we set up our Apps on Custom Image OR Boot Disk.
Is the approach above is the right one? How can I set up my WordPress site to use in an Instance Template?
Help me, please!
Thanks in advance!
Upvotes: 0
Views: 398
Reputation: 3537
Autoscaling feature of managed instance groups is usually applicable to stateless VM instances. An autoscaler adds or removes instances from a managed instance group. Therefore, any data stored on root disks of VMs can be lost.
As you specified in your plan, the stateful component of your LEMP stack (Databases) has to be implemented outside of the managed instance group.
To create a template for the managed instance group, you can take the following steps:
Create a custom image from the VM's disk
gcloud compute images create [IMAGE_NAME] --source-disk [SOURCE_DISK] --source-disk-zone [ZONE]
Use this custom image to create an instance template for your managed instance group
These steps can be done by using gcloud
command or Google Cloud Console.
Upvotes: 1