Launch sparrowdo scenarios on remote hosts.
Sparrowdo should be installed on the same hosts where sparrowup service gets run.
$ panda install Sparrowdo
$ git clone https://github.com/melezhik/sparrowup.git
$ cd sparrowup
$ carton
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 ...
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:
Path to the directory with sparrowdo scenarios
A directory where reports data will be kept. Should be writable by sparrowup service.
$ bash utils/populate_db.bash
This is a mojo application, thus:
$ carton exec morbo app.pl
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.
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.
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
Setting sparrowdo client parameters.
You may pass additional parameters consuming by sparrowdo client:
Enable verbose mode. Useful when debugging sparrowdo scenarios.
A ssh_user ID
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 /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
All generated reports are accessible via service Web UI:
$ firefox 127.0.0.1:3000