neuroanatomy / BrainBox

BrainBox is a web application that lets you annotate and segment 3D brain imaging data in real time, collaboratively.
https://brainbox.pasteur.fr
Other
96 stars 46 forks source link

BrainBox falls back to old wrong version of node after restart, and crashes #331

Open katjaq opened 2 years ago

katjaq commented 2 years ago

For some reason, BrainBox restarted and went back to using the wrong version of node. This causes a complete crash of BrainBox (service unavailable).

Can we make sure that in case of restart BrainBox automatically uses the correct version of node? @ntraut @dhovart

error log:

0|brainbox | 2022-03-08 10:57:33.533: /var/www/html/brainbox/node_modules/neuroweblab/accessControl/AccessControlService.js:8
0|brainbox | 2022-03-08 10:57:33.533:   static #hasAccess(accessType, requestedAccessLevel, project, userId) {
0|brainbox | 2022-03-08 10:57:33.533:                    ^
0|brainbox | 2022-03-08 10:57:33.533: 
0|brainbox | 2022-03-08 10:57:33.533: SyntaxError: Unexpected token '('
0|brainbox | 2022-03-08 10:57:33.533:     at Module._compile (internal/modules/cjs/loader.js:895:18)
0|brainbox | 2022-03-08 10:57:33.533:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
0|brainbox | 2022-03-08 10:57:33.533:     at Module.load (internal/modules/cjs/loader.js:815:32)
0|brainbox | 2022-03-08 10:57:33.533:     at Function.Module._load (internal/modules/cjs/loader.js:727:14)
0|brainbox | 2022-03-08 10:57:33.533:     at Module.require (internal/modules/cjs/loader.js:852:19)
0|brainbox | 2022-03-08 10:57:33.533:     at Module.Hook._require.Module.require (/home/rto/.npm-global/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
0|brainbox | 2022-03-08 10:57:33.533:     at require (internal/modules/cjs/helpers.js:74:18)
0|brainbox | 2022-03-08 10:57:33.533:     at Object.<anonymous> (/var/www/html/brainbox/node_modules/neuroweblab/accessControl/index.js:3:30)
0|brainbox | 2022-03-08 10:57:33.533:     at Module._compile (internal/modules/cjs/loader.js:959:30)
0|brainbox | 2022-03-08 10:57:33.533:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
ntraut commented 2 years ago

The problem was due to pm2 save done on the previous node version, so it was trying to run on it after a system reboot. If we want to rely on pm2 save to be able to automatically start brainbox at system boot, I don’t think there is another way than rerunning pm2 save after having changed the location of node. Another solution would be to instead use a custom startup script to do the job.

katjaq commented 2 years ago

Thank you ! Both sounds good to me. For now , it worked fine just to install the new node and restart using the updated environment. But by the time we change to the next updated node we will need to remember to run those steps again if we don't make the custom startup script... 😇 Thanks!

ntraut commented 2 years ago

ok, if we update node but continue to use it in the same path (currently it is a .n installation), rerunning pm2 save should not be required though.