Azure App Service Team Blog

How the App Service team functions

Create WordPress using Web Apps on Linux

Web Apps on Linux(Preview) allows running web apps natively on Linux. WordPress is popular blogging platform primarily used on Linux distributions.  Today we have released WordPress for App Service on Linux in the Azure marketplace that helps you quickly create a WordPress application on Web apps (Linux) .

wplinux3

This docker image enables you to run a WordPress site on Azure Web App on Linux  using either :

    1. ClearDB : It is Microsoft Partner solution for a fully integrated MySQL service on Azure. Purchasing a paid MySQL database may require a credit card be associated with your Azure subscription.
    2. Azure Database for MySQL(Preview) : It is a Microsoft solution for MySQL service on Azure that provides a managed database service for app development and deployment that allows you to stand up a MySQL database in minutes and scale on the fly .

We are temporarily removing support for MySQL in-app with WordPress on Linux Template in the Azure portal.This is due to a bug that was identified last week where the WordPress installation never starts. If you already have created a WordPress on Linux with MySQL in-app database provider and still seeing this issue , please follow the following steps to workaround the issue  :

  1. FTP to your Linux web app
  2. Delete mysql folder under \home\data folder
  3. Restart your web app in Azure portal.

 

Before you begin

If you don’t have an Azure subscription, create a free account before you begin.

Deploy from Marketplace

Log in to the Azure portal.Click here to create the WordPress application.wordpress-linux

Name Description
App Name
Enter a unique app name for your **Web App Name**. This name is used as part of the default DNS name for your app <app_name>.azurewebsites.net, so it needs to be unique across all apps in Azure. You can later map a custom domain name to your app before you expose it to your users
Subscription Select a Subscription. If you have multiple subscriptions, choose the appropriate subscription.
Resource group
Enter a resource group. A resource group is a logical container into which Azure resources like web apps, databases that is deployed and managed. You can create a resource group or use an existing one
App Service Plan
App Service plans represent the collection of physical resources used to host your apps. Select the Location and the Pricing tier. For more information on pricing, see App service pricing tier 
Database Provider Select one of the three options for MySQL : ClearDB or Azure Database for MySQL (Preview) . Complete the Database configuration based on your choice.

This will deploy a WordPress custom image on to Web Apps on Linux . Note there might be cold start for the first request to the site created.

Local database connection information

All the database information is stored in your web app application settings. The password, database name are auto generated . You can find this information in the Azure portal , select your web app -> Application settings -> app settings

Name Default Value
DATABASE_HOST 127.0.0.1
DATABASE_NAME <auto-generated string>
DATBASE_USERNAME wpadmin
DATABASE_PASSWORD <auto-generated string>
TABLE_NAME_PREFIX wp_
PHPMYADMIN_USERNAME phpmyadmin
PHPMYADMIN_PASSWORD <auto-generated string>

Connect to local MariaDB database

If you’re using the builtin MariaDB, you can access the builtin phpMyAdmin site with a URL like below:  http://hostname[:port]/phpmyadmin

Manage ClearDB or Azure Service for MySQL(Preview) database

If you’re using the Azure Service for MySQL(Preview) , you can manage your database with MySQL workbench or MySQL utilities.

Connect to local redis cache

If you’re using the builtin MariaDB, you can leverage the builtin redis cache server with WordPress cache plugins to speed up your web application. This is applicable if your site is a small website and does not need scalability feature for App Service and the database. For example, the Redis Object Cache. The builtin Redis cache server uses port 6379. It is recommend to use Azure Redis cache for production site.

Limitations

There are some limitations with using this image on Web Apps on Linux.  These are components included with this image .

  1. PHP 7.1.2
  2. Apache HTTPD 2.4.25
  3. MariaDB 10.0+
  4. Redis3.2.8
  5. phpMyAdmin 4.6.6

Keep this in mind when using the template with your application when using MySQL in-app (Local Database)

  • You CANNOT scale out your site to multiple instances, if you deploy a WordPress site on Azure with this docker image and use the MariaDB built in this docker image as the database. Since the database is local , the solution ONLY supports running on ONE instance. 
  • The Redis cache built in this docker image is available only when you use the MariaDB built in this docker image as the database. Since redis cache is local , this should be used only with local MariaDB database on a single isntance web app.
  • The phpMyAdmin built in this docker image is available only when you use the MariaDB built in this docker image as the database.

Migrating an existing WordPress site

This image creates a new WordPress application every time it is deployed. If you are migrating your application to this site , please follow directions to export and import as mentioned on WordPress Codex.

If you have a complex WordPress application where the above mentioned export and import options are not effective, Web Apps on Linux supports git deployment and you use FTP  or GIT deployment to replace the file system on the site created with this template to bring your own content. You can use PHPmyadmin available with this solution to import your application database content.

Troubleshooting

The docker image has been updated from this  docker image  to using a new format where the docker image only contains the server components. The application code for WordPress is deployed via GIT from  github repo .

Update your application to use the new image appsvc/apps:apache-php-mysql-0.1

  • If you have an existing application created using the WordPress image , check the Application setting to verfiy which image is being used with DOCKER_CUSTOM_IMAGE setting .
  • If the setting value is apache-php-mysql-0.1 , no changes needed .
  • If the value is wordpress-0.2 or wordpress-0.1 or wordpress  and  follow the steps below based on the database being used :
    • Azure Database for MySQL (Preview) / ClearDB
      • Create a new web app with WordPress  from the Azure marketplace.
      • Select “Existing resource group”  and choose the resource group in which your Azure Database for MySQL (Preview) or ClearDB database exists.
      • Select the same app service plan in which the current site assigned to.
      • If using Azure Database for MySQL (Preview) or ClearDB  , select your existing database that is being used by your web app.   Test the new site to make sure it is working as expected before deleting the older app.
    • Local database
      • Backup your web app and database manually.
      • Create a new web app with WordPress  from the Azure marketplace and choose Azure database for MySQL (Preview) or ClearDB
      • Migrate your database to the new database and your files to newly created web app.
      • Note : There is bug with Local database causing the application to break once the app is  provisioned which will be fixed in early August 2017 . If you wish to use Local database , wait until Local database is support for WordPress template next month.