Last weekend I moved my blog from SharePoint Online public site to WordPress. The reason for this move is that Microsoft abandoned the SharePoint Online public site. For those who have a public site can use it at least until March 9 2017 (https://support.microsoft.com/en-us/kb/3027254).
So the first thing for me was where to host this? There are multiple options here:
- Self-hosting on my NAS at home
- Hosting in a VM on Azure
- Hosting on Azure website (default template)
- Hosting on Azure website with MySQL in a Docker Linux VM
I choice to host this on Azure website with a MySQL server in a Docker Linux VM. This way I have full performance and it does not cost me anything because I have an MSDN license with Azure credits. The default Azure WordPress template comes with a MySQL database that is hosted by an external partner (ClearDB) witch costs extra and cannot be paid with the Azure credits. There is a free version of a MySQL database at ClearDB but that has a limit of 20 MB database and the performance is low. This solution is great for development. I wanted something for production so I wanted to have more performance than this free database.
Installing the basics
For the installation of WordPress, I used the template that is delivered by Microsoft in the Azure Portal. Search for WordPress in the new Azure Portal where I selected the first one.
After the deployment I used an Azure resource manager template to deploy a Linux VM with MySQL deployed with Docker. For this I used WebAppMySQLDocker by Thiago Almeida. This template deploys a Linux VM with MySQL and a website. Since I already have a website I removed the website part from this resource manager template.
The template file and parameter file can be found here and can be deployed with this command
All the components in Azure
Now that I have a WordPress site with ClearDB database and a Linux VM with MySQL, I can configure WordPress to use the Linux VM as database server instead of ClearDB.
To do this I created a backup of the MySQL database with a tool called MySQL Workbench, it is a free tool to manage a MySQL database like SQL management studio for Microsoft SQL.
After creating the backup I restored it on the Linux VM and the only thing left is to change the configuration file in WordPress to connect to the Linux VM.
The connect is defined in a file called “wp-config.php” that is located in the root of the site and can be changed with any ftp tool or even the Kudo environment on Azure.
The only thing left is to configure your WordPress website to your needs and remove the ClearDB from your Azure tenant.
Just on the Monday after I did this whole move Microsoft has announced that they will release an Azure resource template to create all of this without the manual configuration.
Just announced that there will be another option to run WordPress with Azure and using Azure SQL https://azure.microsoft.com/en-us/blog/project-nami-wordpress-for-azure-sql-database-sql-server/