martomi / chiadog

A watch dog providing a peace in mind that your Chia farm is running smoothly 24/7.
MIT License
457 stars 121 forks source link

Improve harvester offline handling #164

Closed pieterhelsen closed 3 years ago

pieterhelsen commented 3 years ago

Split up the Windows and Linux/MacOS logic into separate consumers.

Added pygtail for Posix and Windows local consumers to enable better log rotation handling. Pygtail does add an artefact file (debug.log.offset) to the .chia/mainnet/log/ folder. This could potentially be moved to the chiadog folder if that's preferable.

Added retry to catch Pygtail errors and retry

Added has_rotated method for Windows Network consumer which reads log filesize over SSH using Powershell

Log output will look similar to this: [2021-05-21 23:12:45] [ WARNING] --- [WinError 2] The system cannot find the file specified: 'C:\\Users\\PieterHelsen\\workspace\\debug.log', retrying in 2 seconds... (api.py:40)

martomi commented 3 years ago

@ajacobson pinging you here as that might require some changes to Docker. We still need read-only access to the log file itself, but docker should be able to write a file in that same folder (can be temporary, not synced with host machine).

https://github.com/ajacobson/chiadog-docker/blob/22db43bfee611d31a405b570278ac679dfa9e91a/docker-compose.yaml#L9

Edit: @pieterhelsen mentioned this file can be moved to chiadog folder. Maybe that'll be preferable for the docker setup?

martomi commented 3 years ago

Does this resolve https://github.com/martomi/chiadog/issues/72 🤔

pieterhelsen commented 3 years ago

@ajacobson pinging you here as that might require some changes to Docker. We still need read-only access to the log file itself, but docker should be able to write a file in that same folder (can be temporary, not synced with host machine).

https://github.com/ajacobson/chiadog-docker/blob/22db43bfee611d31a405b570278ac679dfa9e91a/docker-compose.yaml#L9

Edit: @pieterhelsen mentioned this file can be moved to chiadog folder. Maybe that'll be preferable for the docker setup?

Added the manual offset to write to within the chiadog root directory. Don't think there's any downsides and might be easier for Docker.

Does this resolve #72 🤔

I sure hope so!

pieterhelsen commented 3 years ago

This closes #134