Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

cloudnautique/cowbell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Cowbell

What is this?

Cowbell is an experiment to add a Rancher service scale up webhook trigger. Cowbell is launched inside a Rancher stack and is configured to listen for events, and react accordingly.

How to use Cowbell.

Cowbell is meant to be deployed as a service inside your application stack. To deploy cowbell, add a service definition to your docker-compose.yml file:

  ...
  web:
    image: nginx
  ...
  cowbell:
    image: cloudnautique/cowbell:v0.0.5
    ports:
      - 8888:8088 //pick a public port that works for your setup.
    labels:
      io.rancher.container.create_agent: 'true'
      io.rancher.container.agent.role: environment
  ...

Then configure Cowbell through rancher-metadata in the rancher-compose.yml file.

...
cowbell:
  metadata:
    services:
      - name: "web" # name of the service to scale
        increment: 1 # number of containers to add per event
        decrement: 1 # does nothing yet...
        token: "set this to something long and url friendly"
        quietTime: 60 # Number of seconds to wait after scaling up.
...

Once the service is configured, you should now be able to send a POST and have the service scale up by the increment:

`curl -X POST http://(host):(publicport)/v1-scale/services/web?token=reallylongtokenthatshouldbekeptsecret``

You'll get a 202 for accepted, and it will asynchronously scale it up. A 404 will be returned for all other responses. (Instead of unauthorized)

Todo

  • Max ceiling for containers...
  • Add Decrement?? probably a floor

Building

To build cowbell, just run ./scripts/build

About

Webhook listener to scale up a Rancher service

Resources

Stars

Watchers

Forks

Packages

No packages published