Code Monkey home page Code Monkey logo

sparrowup's Introduction

SYNOPSIS

Launch sparrowdo scenarios on remote hosts.

Prerequisites

Sparrowdo should be installed on the same hosts where sparrowup service gets run.

INSTALL

$ panda install Sparrowdo
$ git clone https://github.com/melezhik/sparrowup.git
$ cd sparrowup
$ carton

Configuration

Set up sparrowdo repository

You should checkout some sparrowdo scenarios:

$ git clone $some-remote-repository /path/to/repo

A structure of repository should be:

$ project-foo/sparrowfile
$ project-bar/sparrowfile
$ project-baz/sparrowfile

So on ...

Set up sparrowup service configuration file.

This is should be Mojolicious::Config file placed at /etc/sparrowup.conf path.

$ cat /etc/sparrowup.conf

{
  'repo' => '/home/sparrowup/sparrowup_repo',
  'reports_dir' => '/home/sparrowup/reports'
}

Configuration parameters:

repo

Path to the directory with sparrowdo scenarios

reports_dir

A directory where reports data will be kept. Should be writable by sparrowup service.

Populate database

$ bash utils/populate_db.bash

Run sparrowup service

This is a mojo application, thus:

$ carton exec morbo app.pl

Run job queue

A minion asynchronous job executor should be launched to handle incoming job requests.

For example:

$ carton exec ./app.pl minion worker 

Follow Minion documentation for details on minion job queue.

sparrowup API

All the API is exposed as http service API accessible by 0.0.0.0:3000. A bind address / port number could be changed when running service via morbo, follow morbo documentation.

Schedule a job

POST $server /job/$project

where $server is ip address or hostname, $project is project name ( a proper directory should exist in repository )

Example:

# Checks if nginx is running on 192.168.0.1

$ cat /path/to/repo/nginx/sparrowfile

task_run  %(
  task => 'check my nginx process',
  plugin => 'proc-validate',
  parameters => %(
    pid_file => '/var/run/nginx.pid',
    footprint => 'nginx.*master'
  )
);

$ curl -d 'server=192.168.0.0.1' 127.0.0.1:3000/job/nginx

Advanced usage.

Setting sparrowdo client parameters.

You may pass additional parameters consuming by sparrowdo client:

verbose

Enable verbose mode. Useful when debugging sparrowdo scenarios.

ssh_user

A ssh_user ID

ssh_port

A server ssh port to connect to

Follow sparrowdo documentation to know more about sparrowdo client parameters.

For example:

$ curl -d server=192.168.0.0.1 -d ssh_user=vagrant -d ssh_port=2222  127.0.0.1:3000/check/nginx

Get a server status

GET /status/$server

Once job is scheduled it's queued and eventually will be executed.

For example:

$ curl -d 'server=192.168.0.0.2' 127.0.0.1:3000/job/perl-app
$ sleep 10
$ curl -G -d server=192.168.0.2 127.0.0.1:3000/status?server=192.168.0.2

Reports

All generated reports are accessible via service Web UI:

$ firefox 127.0.0.1:3000

See also

AUTHOR

Alexey Melezhik

sparrowup's People

Contributors

melezhik avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.