Skip to content

Commit a5e0d72

Browse files
committed
Use updated local storage container
1 parent ac0ef0c commit a5e0d72

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,29 @@ None.
2424
* WP-Cron is setup to run via task/cron scheduler every 10 minutes. Set `PHP_CRON` environment variable to a valid [cron formated](https://en.wikipedia.org/wiki/Cron) schedule to change from the default execute interval. Be sure to apply the `define('DISABLE_WP_CRON', true);` setting in wp-config.php, so that WP-Cron does not slowdown your page loads. The last WP-Cron task run is logged to `/home/site/cron.log`
2525
* Run `setup-wp-cron` from SSH shell to copy `cron.sh` to `/home/site` directory, if it does not exist already.
2626

27+
## Container storage for site
28+
29+
With the update to v1.2 of this container, the web server now serves the site from a local copy of the site that is synchronized from the durable storage. The container runs a synchronization service that will synchronize the `/home/site/` with `/var/www/vhosts/site-local/` bidirectionally. It monitors the `/home/site` directory for changes, if it detects changes it runs the synchronization. If it does not detect any changes, it will run a synchronization every two hours.
30+
31+
### Commands
32+
33+
These are supported commands that you can manually execute from the Azure App Service's SSH shell.
34+
35+
* `sync-now` - Start a synchronization task immediately.
36+
* `clean-sync` - Initiates a fresh clean copy from durable to local
37+
* Clears out local site's wwwroot directory
38+
* Clears folder's synchronization state
39+
* Copies sync maintenance template to local site
40+
* Copies site content from `/home/site/wwwroot` to `/var/www/vhosts/site-local/wwwroot`
41+
42+
### Maintenance template
43+
44+
When a fresh container is deployed or a container is regenerated from an updated docker image, the initial local site's wwwroot directory is empty. To minimize showing a *404* or *500* error while the site copies from durable to local storage, a `sync_maintenance.html` template file is copied to the root of the local site. If this file and the maintenance `.htaccess` exists, it will always be displayed to any browser accessing the site.
45+
46+
#### Custom maintenance template
47+
48+
You can place a `sync_maintenance.html` file with your own custom HTML within the `/home/site` directory in the durable storage. This would be the `/site` directory if uploading from FTP.
49+
2750
## Deployment
2851

2952
### Database

build.bat

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
docker build . -t johnwcarew/azure-app-service-openlitespeed-wordpress:latest
22
docker build . --build-arg PHP_VERSION=lsphp74 -t johnwcarew/azure-app-service-openlitespeed-wordpress:1.6.18-lsphp74
3-
docker build . --build-arg PHP_VERSION=lsphp73 -t johnwcarew/azure-app-service-openlitespeed-wordpress:1.6.18-lsphp73
3+
docker build . --build-arg PHP_VERSION=lsphp73 -t johnwcarew/azure-app-service-openlitespeed-wordpress:1.6.18-lsphp73
4+
5+
rem docker build . --build-arg LS_VERSION=dev --build-arg PHP_VERSION=sync -t johnwcarew/azure-app-service-openlitespeed-wordpress:dev-sync
6+
rem --rm
7+
rem docker run -it --name dev-sync-wp -p "80:80" -p "22:2222" -p "7080:7080" --env-file .env -v "C:\home:/home" johnwcarew/azure-app-service-openlitespeed-wordpress:dev-sync

wordpress-entrypoint.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ PHP version : `php -v | head -n 1 | cut -d ' ' -f 2`
1717
EOL
1818
cat /etc/motd
1919

20+
echo >&2 "Initializing PHP environment..."
21+
init-php-env
2022
set -euo pipefail
2123

2224
# usage: file_env VAR [DEFAULT]
@@ -251,15 +253,8 @@ for e in "${envs[@]}"; do
251253
unset "$e"
252254
done
253255

254-
if [ -z ${PHP_CRON+x} ]; then
255-
export PHP_CRON='*/10 * * * *'
256-
fi
257-
258-
cat >/etc/cron.d/phpcron <<EOL
259-
${PHP_CRON} root cd /home/site/; if [ -e cron.sh ]; then /home/site/cron.sh > /home/site/cron.log 2>&1; fi; date > /home/site/cron-last-run
260-
EOL
261-
chmod 600 /etc/cron.d/php
262-
chmod 600 /etc/cron.d/phpcron
256+
# Sync site-local with site
257+
sync-now &
263258

264259
service ssh start
265260
service cron start

wp-container-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0
1+
1.1

0 commit comments

Comments
 (0)