Hook for upgrading a service, what am I doing wrong?

After struggling a bit I’m happy to develop a complete stack of service which runs very well. For me the next piece of puzzle was to upgrade the service when new image is published. So I followed the docs and created a receiver hook like this:

I’ve already put the same label under my service. So now I expect when the ‘latest’ tag changes in repository, service should be auto-upgraded, right? But it doesn’t. Any ideas?

I also tried using trigger URL, but it gives 404 error. (Another question: is it necessary to trigger this URL for upgrading service? won’t the upgrade happen in background?)

Additional details:
I just triggered the URL provided with empty POST, and here’s the response I received:

{
“actions”: {},
“links”: {
“self”: “https://try.rancher.com/v1-webhooks/endpoint
},
“message”: “Error No Payload recevied from Docker Hub webhook in executing driver for serviceUpgrade”,
“status”: “Server Error”,
“statusCode”: 400,
“type”: “error”
}

I am using AWS ECR for this service and to keep it authenticated I run “objectpartners/rancher-ecr-credentials” as another service on host.

There are couple of things you need to do in order to get this webhook to work. Here is a link to the documentation: http://docs.rancher.com/rancher/v1.5/en/cattle/webhook-service/. Please read the entire section on Upgrading a Service Based on Docker Hub Webhooks.

2 Likes

Oh, I ignored the last part on that page earlier - that answers it. Thanks!

So I am using AWS to host my docker repo as well. How did you get docker to call your webhook? I can’t seem to figure out a good way to do this.

I have tested the webhook manually and it works as a post with the correct body, but I’m not sure how to get docker to call it to make it fully automated.

In hub.docker.com, go to your repository. You will see a tab to Webhooks, go to that and create a webhook. Add the rancher webhook URL.

docker hub:
image