Phusion Passenger: Error starting web application - Deploying Probot app (NodeJS) with Plesk nginx

dre*_*ekk 1 passenger nginx plesk node.js probot

I'm trying to deploy a GitHub Probot App (NodeJS application) to my webserver running Plesk 18.0.27 U1 with the NodeJS Extension 1.3.6-117. When running the probot app on my local machine, the app starts just fine and is accessible via localhost.

Plesk is apparently using the Phusion Passenger application server to serve NodeJS apps.
When accessing the deployed website, I get the following errror:

Screenshot: Passenger problem location

And in /var/log/nginx/error.log:

[ E 2020-05-30 10:06:31.7393 21506/Th age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/vhosts/example.org/node_root: A timeout occurred while spawning an application process.
  Error ID: 5f02dec5
  Error details saved to: /tmp/passenger-error-y6AeCv.html

[ E 2020-05-30 10:06:31.7466 21506/T5 age/Cor/Con/CheckoutSession.cpp:276 ]: [Client 1-2] Cannot checkout session because a spawning error occurred. The identifier of the error is 5f02dec5. Please see earlier logs for details about the error.
Run Code Online (Sandbox Code Playgroud)


Things I've tested so far

  • I increased the timeout for starting the app in nginx passenger_start_timeout 300;
  • I disabled php and proxy_mode in Plesk for this website (Nginx proxies requests to Apache by default, but passenger is running on nginx only)
  • I wrote a custom startup script to disable passenger autoinstall and set the webserver port in the node dotenv file to PORT="passenger"
#!/usr/bin/env node

const { Probot } = require('Probot')

// @ts-ignore
if (typeof(PhusionPassenger) !== 'undefined') {
    //@ts-ignore
    PhusionPassenger.configure({ autoInstall: false });
}

Probot.run(process.argv)

Run Code Online (Sandbox Code Playgroud)

Starting questions

Is my application failing or is passenger unable to bind the port of the app?

Are there more detailed logs or an option to enable verbose output?

Thanks in advance!

dre*_*ekk 6

经过长时间的研究,我自己弄清楚了。发布我的解决方案,以防有人遇到同样的问题。

  1. 设置乘客日志级别。您可以输入passenger_log_level 7您的 nginx 配置/etc/nginx/conf.d/phusion-passenger.conf(对于 Plesk)

  2. 我将应用程序作为独立的乘客服务器启动,并获得了实际的应用程序标准输出输出。示例:cd在您的节点应用程序根文件夹中并运行passenger start --startup-file lib/startup.js --nodejs /opt/plesk/node/12/bin/node --log-level 3 --app-type node.

此时我发现Probot在上面提到的启动脚本中找不到该模块。因此,我更深入地研究了 Probot 应用程序的实际启动方式,并偶然发现了该probot run命令。默认情况下,probot 应用程序不使用node ./lib/index.jsbut运行probot run ./lib/index.js

  1. 使用自定义乘客应用程序启动命令。我添加了 nginx 选项passenger_app_start_command "/opt/plesk/node/12/bin/npm start";来设置自定义启动命令以使用启动脚本probot run中定义的命令package.json,而不是node ./lib/startup.js乘客的默认命令

我学到了很多关于这些工具的知识,希望这能节省某人的周末:D