umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.43k stars 2.67k forks source link

Cannot run from package on azure app service #12043

Open p-m-j opened 2 years ago

p-m-j commented 2 years ago

Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9

v9

Bug summary

When deploying to azure app services with WEBSITE_RUN_FROM_PACKAGE enabled, umbraco sites fail to boot.

Imagine there are several instances where assumptions that ContentRoot is writable will take the site down, but for now the immediately obvious one is as follows.

On boot the TempFileCleanup HostedService is instantiated, this calls into IOHelper.GetTempFolders which attempts to ensure the directories exist (umbraco/Data/TEMP/FileUploads), with a read only filesystem this throws exceptions.

This should probably just respect Umbraco:CMS:Hosting:LocalTempStorageLocation.

Specifics

No response

Steps to reproduce

Deploy to azure with WEBSITE_RUN_FROM_PACKAGE set to 1, try to boot site

Expected result / actual result

Site should boot and function.


_This item has been added to our backlog AB#17695_

bielu commented 2 years ago

@p-m-j there was already issue about it https://github.com/umbraco/Umbraco-CMS/issues/11024 and there is no option to change that as long umbraco is using file base cache / search :)

p-m-j commented 2 years ago

I don't see any issues with lucene & nucache + readonly app.

The package is mounted as a readonly filesystem at c:\home\site\wwwroot (assuming windows) and of course this means we cannot write there, but we can write nucache files and lucene indexes elsewhere (in fact assuming the documentation is followed on azure they should already be in a subdirectory of c:\local\Temp)

bielu commented 2 years ago

@p-m-j it will not work on linux :)

p-m-j commented 2 years ago

@p-m-j it will not work on linux :)

Would you be able to explain why?

Setup seems identical, windows app services mount read only app filesytem at c:\home\site\wwwroot linux at /home/site/wwwroot

bielu commented 2 years ago

@p-m-j if I remember correctly the linux webapp doesnt have writable temp storage, but I might be wrong there.

p-m-j commented 2 years ago

Screenshot from 2022-03-04 16-33-41

LGTM

harry-gordon commented 2 years ago

Just ran into this today deploying from Azure Devops to a Windows web app. It seems that if you let Devops choose the deployment method it might choose "Run from Package" which sets WEBSITE_RUN_FROM_PACKAGE to 1 and disaster ensues 😅.

image

What is the official resolution on this issue? As far as I can see:

  1. It needs documenting in the Running Umbraco on Azure Web Apps. I'm writing something up now.
  2. Umbraco should honour Umbraco:CMS:Hosting:LocalTempStorageLocation in this situation - unless I've misunderstood?*****

Edit: based on this comment, maybe WEBSITE_RUN_FROM_PACKAGE just can't be supported.

p-m-j commented 2 years ago

@harry-gordon WEBSITE_RUN_FROM_PACKAGE is not currently supported as Umbraco expects to always be able to write at content root.

You're absolutely right that we could do with a note mentioning that at present it's not currently possible.

The plan moving forwards is to facilitate WEBSITE_RUN_FROM_PACKAGE by ensuring it is possible to configure the application to work with a read only content root (by writing elsewhere for logs, temporary file uploads, any other misc files).

This is not currently scheduled in a sprint but when it is the state/in-sprint label will be added to this issue.