Skip to content
This repository has been archived by the owner on Aug 17, 2021. It is now read-only.

08 Webhooks

satrapu edited this page Oct 14, 2017 · 5 revisions

This page details how to use webhooks in order to have a running instance of Rancher server respond to outside world events.
A webhook is an endpoint publicly available, so whenever Rancher should take a specific action, notify it by posting a request with no body to a specific endpoint.

More information can be found here.

  1. Create stack my-stack, as documented here: Create and Destroy Stack and Services Using Rancher CLI

  2. Go to Rancher UI

  3. Go to menu → API → Webhooks

  4. Click the "Add Receiver" button

  5. Fill in the fields appropriately, then click the "Create" button

    1. Name: scale-my-stack
    2. Kind: Scale a service
    3. Action: Scale Up
    4. Target Service: alpine-3-5 from stack my-stack
    5. By: 1
    6. Minimum Scale: 1
    7. Maximum Scale: 100

  6. See the newly added webhook

  7. Copy the trigger URL

  8. Open a terminal and run the following command 3 times

    curl -X POST "http://192.168.99.103:8080/v1-webhooks/endpoint?key=qIgRKbKri2MEUMoKU3hUC5uieK9DWYqbApw9VgGT&projectId=1a7"

    Please make sure the URL above is put inside double quotes!

  9. Go to Rancher UI and you should see that my-stack contains 4 containers (the default one + 3 added by calling the webhook)

Clone this wiki locally