What is best practice to perform a clean shutdown of a Wakanda server via OS X shell scripting?
This would be with a solution currently loaded and operating.
The best practice for the upcoming release 1.1.0 :
applicationWillStop
event on a service to handle app specific closing logic service wakanda stop
for Ubuntu and a normal kill
for Mac OS ( kill -9
should always be the last resort after some kind of timeout but this should not be necessary anymore)The best practice for the current release 1.0.x :
HTTP Request Handler
or another method (make sure to secure this very well and accept connections only from localhost)service wakanda stop
for Ubuntu and a normal kill
for Mac OS ( kill -9
should always be the last resort after some kind of timeout but this should not be necessary anymore)
More details :
We should make a distinction between an HTTP Server like Apache and an application server like Wakanda Server.
For example, when you are using a SharedWorker
in Wakanda, your are creating a separate thread that is going to run some code. Suppose that worker is doing some kind of critical data manipulation. If you let the server close that worker for you, it might cause data incoherence in your application. You should therefore handle any business logic specific "clean" close before the server stops the app.
Starting from version 1.1.0, instead of creating a special HTTP Request Handler
that you can call to prepare the server's stop, you can use a service that handles the event applicationWillStop
.
When the server receives a blockable kill signal ( TERM, QUIT, INT ), it will start the stopping process ( The following is true for version 1.1.x of Wakanda Digital App Factory ) :
applicationWillStop
httpServerWillStop
In the versions prior to 1.1.0 the server asks the workers to close before notifying the services about the closing events. That is why we couldn't rely on the services to do a clean close of the SharedWorkers
.