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

Support for Webhooks #9

Open
nblackburn opened this issue Aug 11, 2017 · 8 comments
Open

Support for Webhooks #9

nblackburn opened this issue Aug 11, 2017 · 8 comments

Comments

@nblackburn
Copy link

Instead of polling on a given interval, it might be more efficient to use webhooks instead so when a release is published, it would send a request to a endpoint which will update it's cache.

https://github.com/:user/:repo/settings/hooks/new

@leo
Copy link
Contributor

leo commented Aug 11, 2017

The reason why we have chosen not to go with webhooks (like Nuts, for example) is that they simply don't scale that well:

Assuming that you have 10 instances of Hazel up and running, only one instance of those will retrieve the notice that a new release was created over the webhook. In turn, only that single instance will get the new application update.

That's why we're polling. 😊

If you want your updates to be delivered faster, you can decrease your interval to 2 minutes or so.

@leo leo closed this as completed Aug 11, 2017
@nblackburn
Copy link
Author

nblackburn commented Aug 11, 2017

I feel that is more a problem with how this server is implemented that one inherited from the use of webhooks.

If you wanted something more scalable, then you would have a master service which receives the ping and then notifys each of the platform nodes of the update.

That being said, i respect what you have chosen, though i do consider it inefficient and perhaps a little evasive in the pursuit to a real solution to a scalability problem.

@leo
Copy link
Contributor

leo commented Aug 11, 2017

Talking about Now's way of scaling deployments, instances are completely separated from each other and therefore not able to determine whether or not other ones exist, where they exist and what their status is.

Since I don't think that this will change in the near future and we're basically focused on making it work perfectly on Now first, it doesn't make sense to introduce webhooks.

@nblackburn
Copy link
Author

nblackburn commented Aug 11, 2017

I fully understand and appreciate that, i was just stating in general independent of platform.

@leo leo changed the title Webooks Support for Webhooks Aug 11, 2017
@leo leo reopened this Aug 11, 2017
@leo
Copy link
Contributor

leo commented Aug 11, 2017

Actually we only need to run this when a certain path (let's say /refresh) is accessed. In addition, we need a new environment variable for a secret to compare with the secret contained in the payload.

The path should only be enabled if the SECRET env variable is defined, otherwise the request should be handled by the final request handler.

@nblackburn
Copy link
Author

nblackburn commented Aug 11, 2017

@leo indeed you do, i wasn't suggesting this blindly (there was reason behind it) 😄

The biggest reason i suggested it is if enough people started using this with multiple instances, you are basically a DDOS attack waiting to happen (it's happened before), with this, you only ever do something when needed (making it way more efficient).

@leo
Copy link
Contributor

leo commented Aug 11, 2017

That's not completely correct. With the interval mechanism, Hazel respects the limits of GitHub's API and that's far away from a possible DDoS attack (even when scaled to multiple instances).

What I just proposed only makes sense when Hazel is running on a single instance, so there won't be many use cases. But still, it's worth implementing.

@nblackburn
Copy link
Author

@leo Ah, so it does, my apologies. Yes, it's not something everyone will use but it makes your tool more flexible to a wider array of cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants