I am trying to get forever to start up all my microservices
All the services fail the same way
my forever.json looks like (abbreviated)
[
{
"uid": "account-service",
"append": true,
"watch": true,
"script": "app.js",
"sourceDir": "/home/trig/account-service/",
"workingDir": "/home/trig/account-service/",
"logFile": "/home/trig/logs/forever.log",
"outFile": "/home/trig/logs/account_service_out.log",
"errFile": "/home/trig/logs/account_service_err.log"
},
after starting i do
forever list and get (abbreviated)
/home/trig/.forever/lQOi.log STOPPED
if i look at the log
data: account-service:25858 - module.js:471
data: account-service:25858 - throw err;
data: account-service:25858 - ^
data: account-service:25858 - Error: Cannot find module '/home/trig/account-service'
data: account-service:25858 - at Function.Module._resolveFilename (module.js:469:15)
data: account-service:25858 - at Function.Module._load (module.js:417:25)
data: account-service:25858 - at Module.runMain (module.js:604:10)
data: account-service:25858 - at run (bootstrap_node.js:383:7)
data: account-service:25858 - at startup (bootstrap_node.js:149:9)
data: account-service:25858 - at bootstrap_node.js:496:3
data: account-service:25858 - error: Forever detected script exited with code: 1
but if i do
ls -ls /home/trig/account-service
4 -rw-rw-r-- 1308 Dec 28 20:43 app.js
4 drwxrwxr-x 4096 Dec 28 20:43 controllers
4 drwxrwxr-x 4096 Dec 22 05:36 env
4 drwxrwxr-x 4096 Dec 28 20:43 models
4 drwxrwxr-x 154 4096 Dec 28 20:43 node_modules
4 -rw-rw-r-- 1 359 Dec 28 20:43 package.json
4 drwxrwxr-x 2 4096 Dec 28 20:43 utils
I then tried and changed the paths from absolute to relative ( based on comment below )
[
{
"uid": "account-service",
"append": true,
"watch": true,
"script": "app.js",
"sourceDir": "./account-service/",
"workingDir": "./account-service/",
"logFile": "/home/trig/logs/forever.log",
"outFile": "/home/trig/logs/account_service_out.log",
"errFile": "/home/trig/logs/account_service_err.log"
},
then did
forever start account-service ./forever.json
and still see the error
data: account-service:1795 - module.js:471
data: account-service:1795 - throw err;
data: account-service:1795 - ^
data: account-service:1795 - Error: Cannot find module '/home/trig/account-service'
data: account-service:1795 - at Function.Module._resolveFilename (module.js:469:15)
data: account-service:1795 - at Function.Module._load (module.js:417:25)
data: account-service:1795 - at Module.runMain (module.js:604:10)
data: account-service:1795 - at run (bootstrap_node.js:383:7)
data: account-service:1795 - at startup (bootstrap_node.js:149:9)
data: account-service:1795 - at bootstrap_node.js:496:3
data: account-service:1795 - error: Forever detected script exited with code: 1
if move the forever.json file into the dir /home/trig/account-service ( and remove the other services) and leave the sourceDir and workingDir to absolute path it starts correctly
I gave up trying to get forever to work with multiple apps .
I tried http://pm2.keymetrics.io/ and got it working pretty quickly.
so far so good
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.