0
votes

I have an Azure App Service running my own docker image based on PHP (mcr.microsoft.com/appsvc/php:7.4-apache_20201229.1)

Deploying to the service works and the website runs as expected (WEBSITES_ENABLE_APP_SERVICE_STORAGE : false)

I want to be able to use persistent storage to save data from fails / web app restarts ...

I wanted to use the in-built persisted storage and set the application setting WEBSITES_ENABLE_APP_SERVICE_STORAGE to true, use docker compose like that :

version: '3.3'

services:
   back:
     image: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     volumes:
      - ${WEBAPP_STORAGE_HOME}/site/wwwroot:/var/www/html
     ports:
       - "8000:80"
     restart: always

However after changing this setting and stop/start the web app, the container no longer starts successfully and gives no reason why.

The logs I get are below:

2021-06-17T23:49:43.847Z INFO  - Starting container for site
2021-06-17T23:49:43.847Z INFO  - docker run -d -p 8081:80 --name XXXXXXXXXXXXXXX -e WEBSITE_CORS_ALLOWED_ORIGINS=XXXXXXXXX -e WEBSITE_CORS_SUPPORT_CREDENTIALS=True -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=true -e WEBSITE_SITE_NAME=XXXXXXXXXXXXXXXXX -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=XXXXXXXXXXXXXXX -e WEBSITE_INSTANCE_ID=bd0010bcc7f2a648cafc4bcac18f1660692939e3ec29400aeb60d8a3d788c1c3 -e HTTP_LOGGING_ENABLED=1 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  
2021-06-17T23:53:34.572Z ERROR - multi-container unit was not started successfully

What is WEBSITES_ENABLE_APP_SERVICE_STORAGE breaking about my container? I have bash access to the running kudu instance (the ssh break also) and i don't see any file from my application

Are there any logs that would allow me to view what is failing or anything I've not considered with the WEBSITES_ENABLE_APP_SERVICE_STORAGE setting?

Thanks

EDIT :

when putting only WEBSITES_ENABLE_APP_SERVICE_STORAGE = true , and adding -v ${WEBAPP_STORAGE_HOME}/site/wwwroot/storage:/storage in startup command , the content of wwwroot will be deleted and my docker image will be replaced by

2021-06-18T08:07:54.534Z INFO  - docker run -d -p 2301:80 --name XXXXXXXXXXXXXX_0_f194ab38 -e WEBSITE_CORS_ALLOWED_ORIGINS=https://XXXXXXXXXXX.azurewebsites.net -e WEBSITE_CORS_SUPPORT_CREDENTIALS=True -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=true -e WEBSITE_SITE_NAME=XXXXXXXXXXXX -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=XXXXXXXXXXXXXXXXXXXXXXXXXXX.azurewebsites.net -e WEBSITE_INSTANCE_ID=bd0010bcc7f2a648cafc4bcac18f1660692939e3ec29400aeb60d8a3d788c1c3 -e HTTP_LOGGING_ENABLED=1 **IMAGE** -v ${WEBAPP_STORAGE_HOME}/site/wwwroot/storage:/storage 

2021-06-18T08:07:55.414Z INFO  - Starting container for site
2021-06-18T08:07:55.415Z INFO  - docker run -d -p 4849:8081 --name XXXXXXXXXXXXXXXXXX_0_f194ab38_middleware -e WEBSITE_CORS_ALLOWED_ORIGINS=https://XXXXXXXXXXXXXX -e WEBSITE_CORS_SUPPORT_CREDENTIALS=True -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=true -e WEBSITE_SITE_NAME=xXXXXXXXXXXX -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=XXXXXXXXXXXXXX.azurewebsites.net -e WEBSITE_INSTANCE_ID=bd0010bcc7f2a648cafc4bcac18f1660692939e3ec29400aeb60d8a3d788c1c3 -e HTTP_LOGGING_ENABLED=1 appsvc/middleware:1.4.5 /Host.ListenUrl=http://0.0.0.0:8081 /Host.DestinationHostUrl=http://172.16.27.2:80 /Host.UseFileLogging=true 
1

1 Answers

0
votes

The appsetting WEBSITES_ENABLE_APP_SERVICE_STORAGE use to mount a location in Azure Storage to the /home mount point.

WEBAPP_STORAGE_HOME is an environment variable in App Service that is mapped to persistent storage for your app.

https://docs.microsoft.com/en-us/archive/blogs/waws/things-you-should-know-web-apps-and-linux#if-your-site-doesnt-start-check-the-docker-logapplies-to-web-app-for-containers.

You can also make use of app service inbuild "diagnose and solve problems" blade to better understand why container crash or unable to start.