简体   繁体   English

Azure 应用服务突然停止并出现 PhantomJS 错误

[英]Azure App Service suddenly stopped with PhantomJS error

We have a Restify API running in Azure App Service on Linux for a while now.我们有一个 Restify API 在 Linux 上的 Azure 应用服务中运行一段时间。 Suddenly this app (both test and prod, they run as seperate apps) stopped working.突然,这个应用程序(测试和生产,它们作为单独的应用程序运行)停止工作。 Based on the logs the error is related to a package we are using node-highcharts-exporting which is dependent on PhantomJS.根据日志,错误与 package 有关,我们正在使用依赖于 PhantomJS的 node-highcharts-exporting App Service is using Node 8.1.应用服务正在使用节点 8.1。

We tried re-deploying the code, upgrading node version to 8.12 (do not want to use latest version with out testing) but still no luck.我们尝试重新部署代码,将节点版本升级到 8.12(不想使用未经测试的最新版本)但仍然没有运气。

Deployment Logs: (This part is successful. This is just for reference)部署日志:(此部分成功,仅供参考)

在此处输入图像描述

Container logs: (Startup fails here)容器日志:(此处启动失败)

在此处输入图像描述

Tried to replicate the same environment on-prem and everything works fine.尝试在本地复制相同的环境,一切正常。 Created a new App Service which is also running into same issue.创建了一个新的应用服务,它也遇到了同样的问题。 Any help is much appreciated.任何帮助深表感谢。

Update 1: I think I figured out what is happening.更新1:我想我知道发生了什么。 This is related to font libraries on linux https://github.com/ariya/phantomjs/issues/10904这与 linux https 上的字体库有关://github.com/ariya/phantomjs/issues/10904

I need to install libfontconfig but this is not supported on Azure App Service.我需要安装libfontconfig ,但 Azure 应用服务不支持此功能。

Yes, it is due to sandbox restriction on a App Service.是的,这是由于对应用服务的沙盒限制。 Just to highlight, the standard/native Azure Web Apps run in a secure environment called a sandbox.需要强调的是,标准/原生 Azure Web 应用程序在称为沙箱的安全环境中运行。 Each app runs inside its own sandbox, isolating its execution from other instances on the same machine as well as providing an additional degree of security and privacy which would otherwise not be available.每个应用程序都在自己的沙箱内运行,将其执行与同一台机器上的其他实例隔离开来,并提供额外的安全性和隐私性,否则这些应用程序将无法使用。

Not supported scenarios on standard App Service - PhantomJS (/Selenium): tries to connect to local address, and also uses GDI+.Known issue for all PDF generators based on wkhtmltopdf or phantomjs: custom fonts are not rendered (system-installed font is used instead) because of sandbox GDI API limitations.See App Service GitHub sandbox page.标准应用服务不支持的场景 - PhantomJS (/Selenium):尝试连接到本地地址,并且还使用 GDI+。所有基于 wkhtmltopdf 或 phantomjs 的 PDF 生成器的已知问题:未呈现自定义 fonts而是)因为沙箱 GDI API 限制。请参阅应用服务 GitHub 沙箱页面。

Based on your requirement, however you could use a custom container in App Service (You can use a custom Docker image) that lets you make OS changes that your app needs.但是,根据您的要求,您可以在应用服务中使用自定义容器(您可以使用自定义 Docker 映像),让您可以更改应用所需的操作系统。

Checkout these document for more details on this topic:查看这些文档以获取有关此主题的更多详细信息:

Run a custom Linux container in Azure App Service (You can use a custom Docker image): https://docs.microsoft.com/azure/app-service/containers/quickstart-docker Run a custom Linux container in Azure App Service (You can use a custom Docker image): https://docs.microsoft.com/azure/app-service/containers/quickstart-docker

Run a custom Windows container in Azure (Preview): https://docs.microsoft.com/azure/app-service/app-service-web-get-started-windows-container在 Azure(预览版)中运行自定义 Windows 容器: https://docs.microsoft.com/azure/app-service/app-service-web-get-windows

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM