Giter Club home page Giter Club logo

poolsclosed's Introduction

Build Status Master Join the chat at https://gitter.im/poolsclosed/Lobby

poolsclosed

Simple sinatra app that manages a pool of machines via rundeck

Usage

Installing

Using With Docker-Compose

Running poolsclosed in a Docker container is probably the easiest way to get started:

# clone the repo
# edit config file as needed
vim config.yml
# docker-compose up 
docker-compose up --build

Running locally without docker

Clone the repo, install redis, and then
ruby -Ilib bin/poolsclosed

Configuration

In config.yml:

rundeck_url: base url of the rundeck instance you are consuming.      
create_job_uuid: rundeck job ID that creates a vm. The job must take one arg: machineName
delete_job_uuid: rundeck job ID that deletes a vm. The job must take one arg: machineName 
api_token: rundeck api token
environment: sinatra environment parameter. This isn't used currently, so just leave the default as 'development'
sinatra_port: port you want the sinatra instance to listen on 
pool_size: number of VM's you want to have active at once
quarantine_limit: number of failures tolerated before no more vm's are created
redis_endpoint: redis machine name. use the default port 6379 

Endpoints

Claim a machine from the pool
GET /machine
Success Response:
200
{machineRelease: machineName}

Delete a machine that has previously been claimed
DELETE /machine
params:
machineName = [string]
200
{machineDelete: nil}

Get the last error code from the service
GET /status
200
{status: lasterror }

Get a list of quarantines
GET /quarantines
200
{quarantines: {machine1,machine2} }

Quarantines

If there is a failure creating or deleting a machine, poolsclosed will list it as a "quarantine". If the maximum number of quarantines is reached then it will stop creating new machines.

Using With Docker-Compose

Running poolsclosed in a Docker container is probably the easiest way to get started:

# clone the repo
# edit config file as needed
vim config.yml
# docker-compose up 
docker-compose up --build

Note about resetting failed instances

Until I can add more features, clearing out quarantines will require the user to manually go into redis and delete the records. I think this is acceptable at the moment because removing 'quarantined' machines will also take lots of manual intervention.

Use cases

I wrote this originally so I could do TDD with chef cookbooks on windows environments using our on-prem vsphere instance. I needed to be able to provision a new machine and join it to the domain before testing which could take as long as 15 minutes in some circumstances. This service will ensure that we have a set of pre-built machines so our provisioning step takes 0 seconds.

Contributing

Pull requests welcome. If there is a feature you want to see open an issue.

Todo

Make a test-kitchen plugin to call this service.
Publish to docker hub
Add alerting for quarantines via email or a chat plugin.

License

MIT

poolsclosed's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

poolsclosed's Issues

improve logging

Change the logging situation from stdout to something sane. make it sumologic compatible

Need to support machine 'flavors'

Test kitchen supports the idea of platforms where you can specify several different operating systems to run your tests against. We should add the idea of 'flavors' in our configuration so we can have those correspond to platforms. We would want to make a pool for each flavor, but they would share quarantines. Each flavor should get its own create and delete job id.

Thinking about this, it might get out of hand if we have to support 10 different OS's. Luckily I've never had to support 10 different OS's before

Feature Request

Add feature to update config via JSON REST POST.
many thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.