Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
katjaq opened this issue Mar 8, 2022 · 3 comments

Comments

@katjaq
Copy link
Member

katjaq commented Mar 8, 2022

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
Copy link
Member

ntraut commented Mar 9, 2022

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
Copy link
Member Author

katjaq commented Mar 9, 2022

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
Copy link
Member

ntraut commented Jun 9, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants