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.
passenger_start_timeout 300;
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)
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!
After long research I figured it out myself. Posting my solution in case anyone is dealing with the same problem.
Setting the passenger log level. You can put passenger_log_level 7
in your nginx configuration /etc/nginx/conf.d/phusion-passenger.conf
(for Plesk)
I started the app as a standalone passenger server and got the actual application stdout output. Example: cd
in your node app root-folder and run passenger start --startup-file lib/startup.js --nodejs /opt/plesk/node/12/bin/node --log-level 3 --app-type node
.
At this point I saw the module Probot
couldn't be found in my above mentioned startup script. So I dug a little deeper how a probot app is actually started and stumbled upon the probot run
command. By default a probot app isn't run with node ./lib/index.js
but probot run ./lib/index.js
.
passenger_app_start_command "/opt/plesk/node/12/bin/npm start";
to set the custom start command to use the probot run
command defined in the package.json
start script instead of the default node ./lib/startup.js
from passengerI learned a lot about these tools and hope this will save someones weekend :D