• 3 min read

WordPress on Azure App Service backed by MySQL virtual machines

Deploy a hybrid solution template for WordPress that combines the best of Azure App Service and Azure virtual machines for a scalable, highly available WordPress app.
UPDATE: This template has been removed temporarily. To workaround, you can deploy this template from herePlease check this blog post for future updates.

 

Based on customer feedback, we built a hybrid Azure Resource Manager (ARM) template to automate creating WordPress applications running on Azure App Service Web Apps, backed by a MySQL database cluster, running on Azure virtual machines. We are excited to announce the launch of this template in the Azure Marketplace.

Here are properties of this template:

  • CentOS 6.6 is used for Azure virtual machines to host MySQL 5.6 server
  • GTID-based replication is configured and tested
  • Provisions a two-node MySQL master slave configuration in an Azure VNet where each has two data disks striped into Raid0; both standard and premium storage are supported
  • A load balancer is provisioned in front of the two VMs so the VMs are not directly exposed to the internet; MySQL and SSH ports are exposed through the load balancer using Network Security Group rules
  • Configures a HTTP-based health probe for each MySQL instance that can be used to monitor MySQL health

The following diagram illustrates the deployment architecture on Azure for this solution template.

If you are looking for a fast approach to bring open source-based data solutions to market, check out our free trial and explore the various solutions in the Azure Marketplace.

Step 1

Click here to deploy, or you can go to the Azure portal and search for “WordPress using MySQL replication cluster” in the Marketplace.

Step 2

After clicking “Create” on the offer cover page, fill in the parameters on the “Basics” page. You may choose an existing resource group or a new resource group. When you choose a location, pick a location where premium storage is available. Please note, premium storage is not yet available in all datacenters so you might need to use DS series VMs in order to use premium storage.

Step 3

On the WordPress information page, select the Web Site SKU as per the pricing tier available. This template supports Basic, Standard and Premium pricing tiers. You need to also select the Website instance size for the web app and WordPress database user credentials. Use a strong password for your WordPress database user.

Step 4

In the “Database cluster information” section, specify the virtual machine size and storage account type.

  • Choose a unique name for MySQL server. The full DNS name will be in this format: ..cloudapp.azure.com
  • Select the size for the virtual machine nodes. Review pricing for virtual machines here.
  • Specify a unique Azure storage name and follow the naming conventions of Azure storage. Select the Azure storage account type. If you choose the DS series VMs for database nodes, it is recommended to select Premium-LRS as the storage account type instead of the default Standard-LRS to fully leverage the performance of premium storage.
  • Enter the user credentials to access VM images and the MySQL server.

Step 5

Enter the virtual network information. You can use an existing virtual network or create a new virtual network.

Step 6

Review the summary of all the data entered for the template.

Note: Website name, storage name and domain name for MySQL must be UNIQUE.

Step 7

Review the privacy policy and terms of use. You will be charged for web app and Azure virtual machines as per the pricing tier selected. For example, if you select web app tier S2 (Standard, Medium size) and D2 virtual machines, your estimated cost will be $565. Please use the pricing calculator to evaluate the cost before clicking Create.

Please share your feedback to improve this template for Azure App Service here.

Troubleshooting

If the deployment fails, navigate to the resource group used in Step 1 and click on the failed deployment. Expand the failure, and scroll down to the oldest event that caused the failure to see the detailed error messages.

 

If the error appears to be transient, or if it’s caused by invalid parameters, you can delete the entire resource group if it does not contain other resources and deploy again.

How to access MySQL

You can access your MySQL server with the public DNS name. By default, the master server can be accessed at port 3306 and the slave server at 3307. By default also, a user admin is created with all privileges to access from remote hosts. For example, access the master with the following command:

mysql -h mysqldnsname.eastus.cloudapp.azure.com -u admin –p 

If your MySQL server is mysqldnsname.eastus.cloudapp.azure.com, then you can access the database using MySQL command line. You can also access the database using MySQL workbench. You can access the virtual machines through SSH. By default, public SSH ports are 64001 and 64002 for the two VMs. Within the VM you can check your MySQL health probe by running the following command, and it should return 200 to indicate that MySQL is healthy.

wget 
wget 

How to monitor MySQL health

MySQL health can be checked by issuing HTTP query to the MySQL probes and verify that the query returns a 200 status code. Replace the following command with your own DNS name and location.

wget 
wget 

Find additional templates on our GitHub repository.