Open vajonam opened 3 years ago
Not sure how I missed this before, but here's my own take on creating a systemctl script to control supervisord (be aware that my version links klipper and simulavr together!):
Having said that, I just noticed that a supervisord support was added directly to Moonraker in #548, so I guess we should start using that instead!
Yes, the supervisord provider should be used rather than a wrapper around it. FWIW, I am currently working on some improvements for the supervisord provider, after doing my own testing I realized that the original submission was broken. I anticipate that the linked branch will be merged soon.
I'm not 100% sure we will be able to directly use supervisord in a situation where klipper is being used with simulavr (such as my tests docker image), reason being that when klipper restarts, we also need to restart simulavr, and I believe there is no such out of the box mechanism in supervisord for that (a small script might do the trick though)
Edit: Supervisor Events might be an option too!
Why is it necessary to restart simulavr? When testing against Mainsail's virtual printer container I was able to restart Klipper, but perhaps I'm missing something. TBH I'd like to see a better option than simulavr, I may look into a basic "virtual mcu" that isn't a full simulator. That said, I do think that the events will work for you.
Why is it necessary to restart simulavr?
From my tests and @th33xitus, klipper will not work on restart if we don't restart simulavr before.
When testing against Mainsail's virtual printer container I was able to restart Klipper, but perhaps I'm missing something.
It's the same script as mine, as @th33xitus and I collaborated on this for quite a while! 🙂
TBH I'd like to see a better option than simulavr, I may look into a basic "virtual mcu" that isn't a full simulator.
That makes 2 of us, and the best I have so far come up to is my virtual_pins klipper module.
Since running in a docker container usually doesn't use systemd/systemctl and uses supervisord insteald, I have hacked up a bit of script to simulate the output for systemctl to allow the fluid UI to retain is functionality.
Do you have any interest in adding this to machine.py? I see there is some beginnings of container support in there. I can add one if you think it's useful for others?