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

Added refresh endpoint w/ token #128

Closed
wants to merge 1 commit into from

Conversation

joeherm
Copy link

@joeherm joeherm commented Dec 17, 2021

  • Add /refresh?token=specified_token endpoint that sends SIGHUP

@joeherm joeherm closed this Dec 17, 2021
@joeherm
Copy link
Author

joeherm commented Dec 17, 2021

Apologies- meant to open this on our fork.

@brendan-ward
Copy link
Collaborator

@joeherm we're open to considering something like this in the base repo too; there was some discussion on the related filesystem-based reloader.

However, using SIGHUP from an API endpoint feels a little awkward ("hey server please restart yourself"). Instead, I think I'd want to implement something that sets a mutex (so multiple calls to /reload in separate threads don't collide), then uses something similar to what we're doing here to rescan the registered directories and re-add those that exist.

This could also be extended to take a service ID and reload just that, which would likely be nice for certain cases too.

We didn't (yet) have those specific use cases, so I haven't put further thought into supporting a reload HTTP API. One thing that we didn't work out was how to handle authentication for this:

  • shared secret (your token); which is nice and lightweight but also risky, it could get logged as plaintext anywhere in between caller and mbtileserver and potentially used to do a DOS attack
  • HTTP Basic Auth based on credentials provided at server startup
  • something else?

@joeherm
Copy link
Author

joeherm commented Jan 3, 2022

Apologies for the late response! I meant to respond earlier and it got a bit lost in the holiday shuffle. I agree with what you're saying here about the awkwardness of the having the server restart itself, though we did implement the above (with slight changes) as a workaround for our short-term needs.

If there is interest in having that merged happy to do so, otherwise perhaps I should file an issue? If I get some downtime it's something I would be happy to work on and contribute back :) .

@brendan-ward
Copy link
Collaborator

Added #133 for this idea

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

Successfully merging this pull request may close these issues.

2 participants