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) .
This docker image enables you to run a WordPress site on Azure Web App on Linux using either :
- 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.
- 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 .
Before you begin
If you don’t have an Azure subscription, create a free account before you begin.
Deploy from Marketplace
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.|
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
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
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.
There are some limitations with using this image on Web Apps on Linux. These are components included with this image .
- PHP 7.1.2
- Apache HTTPD 2.4.25
- MariaDB 10.0+
- 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.
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.
- Azure Database for MySQL (Preview) / ClearDB
If you using a web app that was created from Azure marketplace for Web App on Linux using WordPress , Drupal , Mediawiki and Joomla , please add the following app setting
WEBSITES_ENABLE_APP_SERVICE_STORAGE app setting to
true to continue using App service Storage (platform SMB share i.e /home/ folder ) . Use the platform file storage in these two scenarios :
- When you scale out using the autoscale feature in Web app for Linux.
- If your application modifies the the files system and you need this new changes to the file system to be persistent . For example , with a WordPress app if you install a plugin , WordPress adds a few files to the files system for the plugin and modifies the database. If you scale up or the instance your app is running on is recycled you will loose the plugin files which can break your production application. Hence in such cases it is recommended to set the app setting to true.
truethe changes to the file system are not persisted.