KenKundert / emborg

Interactive command line interface to Borg Backup
GNU General Public License v3.0
94 stars 8 forks source link

Operate with self-hosted healthchecks.io #45

Closed adhawkins closed 3 years ago

adhawkins commented 3 years ago

Healthchecks.io can be self-hosted. It would be useful if emborg could allow the ping URL for healthchecks.io to be specified, allowing a self-hosted solution to be used.

KenKundert commented 3 years ago

I have added healthchecks_url as a setting. It allows you to override the URL. I have updated the github version, but I have not yet updated the version on PyPI. Please check this version and let me know if it meets your needs. Once it seems okay, I will update PyPI.

adhawkins commented 3 years ago

Had a go with this and can't seem to get it to work. My hosted healthchecks URL is:

https://healthchecks.gently.org.uk:7000/ping/0b0c6bc2-3894-4039-b3ad-3660f35e45ab

I've set:

healthchecks_url = 'https://healthchecks.gently.org.uk:7000/ping/' healthchecks_uuid = '0b0c6bc2-3894-4039-b3ad-3660f35e45ab'

However, it doesn't seem to be working. I've checked that I can run 'curl https://healthchecks.gently.org.uk:7000/ping/0b0c6bc2-3894-4039-b3ad-3660f35e45ab' and this seems to work Ok.

Is there any debugging I can enable to see what URL emborg is using to notify healthchecks?

adhawkins commented 3 years ago

Think I've found an error. The signalling of the completion is:

url = f'{self.URL}/{self.uuid}/{status}'

it should be

url = f'{self.url}/{self.uuid}/{status}'

The signalling of 'start' appears to be correct. It also appears that the trailing '/' on the 'healthchecks_url' might have been causing an issue. I've changed the code as above and it seems to be working now.

adhawkins commented 3 years ago

One other suggestion, when logging in these sections, it might be more helpful to log the full url used (the local url variable) instead of just the UUID.

KenKundert commented 3 years ago

Sorry about that. I think I have fixed the issues you identified. Logging the url is a good idea, and probably would have resulting in me finding the problem before I committed it. Thanks for you help in identifying my mistake.

adhawkins commented 3 years ago

No problem, we all make mistakes! Happy to help.

Tested and appears to be working. Look forward to seeing an 'official' release, will update the Alpine package when it happens.

KenKundert commented 3 years ago

Latest version is now on PyPI. Thanks for your suggestions and help.