Note: When you deploy it first time, Sometimes need to check wp-config.php. RM it and re-config DB information is necessary.
Note: Before restart web app, need to store your changes by "git push", it will be pulled again after restart.
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
Note: We create a database "azurelocaldb" when using local mysql . Hence use this name when setting up the app
Note: Phpmyadmin site is deployed when using local mysql. Please go to
http://[website]/phpmyadmin, and login with DATABASE_USERNAME and DATABASE_PASSWORD.
Browse your site
Complete WordPress install
Note: Do not use the app setting DATABASE_TYPE=local if using Azure database for MySQL
By default Xdebug is turned off as turning it on impacts performance.
Connect by SSH.
Go to /usr/local/etc/php/conf.d, Update xdebug.ini as wish, don't modify the path of below line.
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
Save xdebug.ini,
Restart php-fpm by below cmd:
# find gid of php-fpm
ps aux
# Kill master process of php-fpm
kill -INT <gid>
# start php-fpm again
php-fpm -D && chmod 777 /var/run/php/php7.0-fpm.sock
By default, log rotate is disabled if deploy this images to web app for containers of azure. It's enabled if you use this image by "docker run".
Log rotate is managed by crond, you can start it with below cmd, it will check logs files in the /home/LogFiles/nginx every minute, and rotate them if bigger than 1M. Old files are stored in /home/LogFiles/olddir, keep 20 backup files by default setting.
crond
Please keep an eye on the log files, the performance will be going down if it's too big.
If you don't like to start crond service to triage log rotate every minute, you also can manually triage it by below cmd as your wish, it will talk a while if these log files have already been too big.
If WEBSITES_ENABLE_APP_SERVICE_STORAGE = false ( which is the default setting ) , we recommend you DO NOT update the WordPress core version , themes or files from WordPress admin dashboard.
Choose either one option to updated your files :
There is a tradeoff between file server stability and file persistence . Since we are using local storage for better stability for the web app , you will not get file persistence. In this case , we recommend to follow these steps to update WordPress Core or a theme or a Plugins version :
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.
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.
Set permalink as "Day and Name" by default. Peformance issue may happen with customized permalink. If like to use customized permalink, need to modify nginx configuration and remove lines of set_permalink() in wp-settings.php.
If you have feedback please create an issue but do not send Pull requests to these images since any changes to the images needs to tested before it is pushed to production.