WordPress on Web app for Containers
-
- Azure Database for MySQL : 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 .
- Local Database : You can manually setup your web app to use Local database. This option is not provided from Azure portal for WordPress on Linux template.
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.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 | Use Azure Database for MySQL for database solution |
Using GIT repo for WordPress code
Version 0.3 pulls wordpress code from our GIT repo when you create a when app using this Docker image . If you have custom code on Github as well , you can edit GIT_REPO after the app is created and GIT_BRANCH values in app settings.- Create a Web App for Containers
- Add new App Settings
Name | Default Value |
---|---|
GIT_REPO | https://github.com/azureappserviceoss/wordpress-azure |
GIT_BRANCH | linux_appservice |
- Browse your site
How to configure to use Local Database with web app
- Create a Web App for Containers
- Update App Setting
WEBSITES_ENABLE_APP_SERVICE_STORAGE
= true (If you like to keep you DB after restart.) - Add new App Settings
Name | Default Value |
---|---|
DATABASE_TYPE | local |
DATABASE_USERNAME | wordpress |
DATABASE_PASSWORD | some-string |
- Browse your site
- Complete WordPress install
How to update WordPress core , theme or plugins
- Fork the repo https://github.com/azureappserviceoss/wordpress-azure
- Clone your repo locally and make sure to use ONLY linux-appservice branch
- Download the latest version of WordPress , plugin or theme being used locally
- Commit the latest version bits into local folder of your cloned repo
- Push your changes to the your forked repo
- Login to Azure portal and select your web app
- Click on Application Settings -> App Settings and change GIT_REPO to use your repository from step #1. If you have changed the branch name , you can continue to use linux-apservice . If you wish to use a different branch , update GIT_BRANCH setting as well.
How to turn on Xdebug
- By default Xdebug is turned off as turning it on impacts performance.
- Connect by SSH.
- Go to
/usr/local/php/etc/conf.d
, Updatexdebug.ini
as wish, don't modify the path of below line.zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
- Save
xdebug.ini
, Restart apache by below cmd:apachectl restart
- Xdebug is turned on.
Limitations
- Some unexpected issues may happen after you 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.
- The phpMyAdmin built in this docker image is available only when you use the MariaDB built in this docker image as the database.
- Please Include App Setting
WEBSITES_ENABLE_APP_SERVICE_STORAGE
= true when use built in MariaDB since we need files to be persisted.
Change Log
- Version 0.3
- Use Git to deploy wordpress.
- Update version of PHP/Apache/Mariadb/Phpmyadmin.
- Add Xdebug extenstion of PHP.
- Use supervisord to keep SSHD and Apache.
- This is NOT compatible with tag 0.2 and tag 0.1 for Docker image wordpress-alpine-php
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
- 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 database exists.
- Select the same app service plan in which the current site assigned to.
- If using Azure Database for MySQL , 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
- 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
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.
true
the changes to the file system are not persisted.