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

Auto-restart addon when process fails #2

Closed
ciotlosm opened this issue May 10, 2018 · 5 comments
Closed

Auto-restart addon when process fails #2

ciotlosm opened this issue May 10, 2018 · 5 comments

Comments

@ciotlosm
Copy link
Collaborator

There is a bug Koenkk/zigbee2mqtt#29 which seems to be somewhere inside zigbee-shepherd.
This causes the process to fail and the addon just stops.

Find a better way of error handling this inside the library to avoid a total crash of the process.

@ciotlosm
Copy link
Collaborator Author

I think this should be lower priority as this should not trigger once pairing is turned to false.

@ciotlosm
Copy link
Collaborator Author

I talked to a few colleagues and it might be that using pm2 inside the container might do the trick. It's not worth messing with the control outside of the container because the supervisor in hassio is supposed to take care of the lifecycle of the container.

I will have a bit more time this week to continue with testing, and if all works out I'll get all my sensors moved over. I have 7 more sticks on the way to power my dev instance for more work /testing.

@danielwelch
Copy link
Owner

danielwelch commented May 21, 2018

After looking into it I came to the same conclusion. I don’t have much experience with the JS ecosystem but found this and looks like it’d be as easy as changing the start script to something like:

pm2 start npm -- start

@danielwelch danielwelch mentioned this issue May 24, 2018
3 tasks
@danielwelch
Copy link
Owner

Putting this here for my reference:

http://pm2.keymetrics.io/docs/usage/application-declaration/#json-format

May be able to move some of the environment setup/configuration into a pm2 process file, which can be written on start.

@ciotlosm
Copy link
Collaborator Author

@danielwelch i've implemented a simple pm2 implementation in #21. I've avoided to add the pm2 on debug branch, as then you wish stuff to fail and stop. I think we should not change to move options to pm2 as that should just be a safeguard to keep the process up. Ideally we should not need pm2 in the long run if we get everything else stable.

pm2 usually goes int he background so i used pm2-runtime that is recommended for docker. I'll wait for you to give it a go as well and the close the issue.

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