1

I have a SailsJS app set up on a Webfaction server. Everything works nicely (site can be accessed through browser, console works) when I run the app via any of the following commands, with and without the --prod param:

sails console, sails lift, node app.js

However, when I try to run the app with forever using forever app.js I get a 502 error, as if nodejs server isn't even running. When I run forever list I can see app.js listed among running processes.

How can I have my app run with forever?

Martin Vrkljan
  • 879
  • 10
  • 20

2 Answers2

1

Forever is considered outdated by many in the Node community, and thankfully, has been replaced by several other fantastic (dare I say, better) tools.

If you're running a newer flavor of Ubuntu, you can always install systemd and kick off the application that way. If you're seeking something more streamlined, Phusion Passenger might be your ticket. It has a long track record of successes, and I wouldn't hesitate to toss it into production.

Nicholas Young
  • 233
  • 2
  • 10
  • Thanks Nicolas, I figured out my problem though, the new version of sails uses a migration prompt by default when starting up, so running it with forever just hanged on that prompt without actually starting the server. Thanks for the advice, I'll take a look at those alternatives! – Martin Vrkljan Sep 01 '14 at 20:23
  • 1
    @MartinVrkljan, you can post your discovery as an answer and accept it, since I think it would help others who may encounter the same issue. – sgress454 Sep 02 '14 at 16:08
0

I managed to solve this issue; the problem occurred due to SailsJS migration prompt which shows up when you start the server. Running app.js with forever worked, but the server didn't start because the script hanged waiting for a prompt reply. If you encounter this issue just make sure you have your migrate option set in model config to avoid running into migration prompt.

Martin Vrkljan
  • 879
  • 10
  • 20