Allow apps to handle signals to shutdown gracefully
The code in pubsweet/cli/server.js handles signals to keep the child process (the xPub app) alive forever.
When the app is hosted in docker this causes issues when using the commands like down
or --force-recreate
as the main process handles the signals without clearing up the children in a safe way.
We need to come up with a way that PubSweet can issue a callback or pass on the signals to its children to shutdown gracefully.