Running cronicle on Windows. #579
mikeTWC1984
started this conversation in
General
Replies: 1 comment
-
Amazing !! Thanks a lot for your all your valuable efforts ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After some research turns out that cronicle can run on Windows, with relatively small changes, and you don't even need to have a separate version for it.
Here are steps on how this can be achieved:
Just copy files from node_modules as is. Another good option is bundling. After that cronicle will work (kind of) on Windows - UI will start, the storage engine will function properly (so you can create items). You won't be able to launch jobs though.
UID/GID properties are not applicable for Windows, so using it will cause cronicle crash. Need to wrap it in if/else
Since Windows doesn't support shebang (executable scripts) your need to prepend the interpreter to "executable" property. E.g. instead of
bin/test-plugin.js
usenode bin/test-plugin.js
. Specifying custom parameters is already built into cronicle, so no additional tweaks is needed.Currently, cronicle is using ps command to generate CPU/Memory metrics. Technically, any shell command that would print tab/space separated ppid/pid/cpu/memory would work, even on Windows. Unfortunately,Windows has no good "in-the-box" solution for that. In theory, you can write some ugly batch scripts, but the ones I tried were extremely slow.
The best option I found is to use systeminformation npm module. Its API is the same for Windows and Nix systems, and its performance is good enough. I also noticed some quirks with it when working on Win 10, although on Windows Server it was pretty stable.
After the above steps Test and URL plugins should work. Shell Plugin would still need some tweaking because it uses executable scripts, but windows would require to specify interpreter (unless it's a bat file) and sometimes file extension.
I think a good approach for this is to parse the shebang, and extract the interpreter from there. The default file extension could be .ps1, since powershell would only run scripts with this extension, but most other interpreters (node, python, groovy) are extension agnostic. And finally, in case you just need to run the .bat file, shebang can be omitted.
Obviously, it's trivial to add extra plugin parameters to specify both the interpreter and extension
Custom plugins - should run fine as long as you follow the above guidelines. The only quirk I noticed was with node, when using console.log to print to stdout. For some reason it was missing "\r" character, causing incorrect behavior of plugins. Adding
console.log("\r")
could fix the problem.I implemented the steps above in my experimental fork, you can give it a try. You can check out these release notes to see how to build/use it:
https://github.com/cronicle-edge/cronicle-edge/releases/tag/v1.6.1.1
Shouldn't be a problem to port this to the main cronicle project, perhaps as a separate branch.
Beta Was this translation helpful? Give feedback.
All reactions