How to run server in background?

Hi,

I have installed a development server in AWS and am having hard time to figure out how to run the server in background. “plackup -Ilib -r -D” did not daemonize the process. How should I set up nginx and fastcgi? Is there anything like reset-containers, which I remember made my life easier when using a precompiled VM?

For now I see with “plackup -Ilib -r” the server runs fine at port:5000 with debug information in the terminal window.

Thanks!
JD

I disabled debugging in DBDefs.pm and did (exec plackup -Ilib -r &> /dev/null &). Now I see the sever still running after I closed the terminal window. Is it a right way? What would be disadvantages of it?

You can configure nginx and some sort of init tool to run your server in the background. As an example, here is a possible nginx configuration for the musicbrainz server:

Musicbrainz have traditionally used daemontools to run the application server in the background (http://cr.yp.to/daemontools.html). There is a sample file to start the application in fcgi mode here: https://github.com/metabrainz/musicbrainz-server/blob/62dee4ae7ca65b306b7aeef618037ad4bfcc380c/admin/nginx/service/run

I’ve also had success using supervisor (http://supervisord.org/) to run the server in fcgi mode.

Your way of running the server in the background is definitely a method that will work, but remember that you won’t get any management tools to check the status of the process, or be able to automatically restart the process on reboot or if it crashes.

As we don’t really support any other method other than the virtual machine it’s difficult for us to support these kind of setups because they can differ so much from one to another - it can take a lot of effort for us to understand someone else’s setup so that we can help them, which often uses up time that we don’t have. You’re welcome to use these examples as starting points, but we may not be able to help you with specific fixes to problems that you may have on your infrastructure.

Good luck!

Thanks for great information. I’ll definitely look into nginx/fcgi and supervisor too. Meantime RT_STANDALONE with plackup did not crash, so I think I’m lucky at least for a week, though a long way to go e.g., RT_SLAVE setting, etc. Cheers!