Pogo - Run commands on many hosts in a controlled manner
Pogo is a highly scalable system for running arbitrary commands on many hosts in a controlled manner.
It is mostly used for quick mass software deployments on server farms while making sure only an allowed number of nodes are upgraded in parallel to ensure business continuity.
Pogo is hosted on Github at
https://github.com/ytoolshed/pogo
The latest stable version can be found on the master branch. The project is automatically being tested on every commit, using travis-ci's service:
http://travis-ci.org/#!/ytoolshed/pogo
Pogo consists of several components, which can be all running on the same system, or, in order to scale it, be replicated and even be installed on many distributed hosts. Those components are
- Client
-
Users submit jobs to pogo using the client, which in turn contacts the API.
- API
-
Takes requests via HTTP from the client and forwards them to a dispatcher.
- Dispatcher
-
Takes job requests from the API, figures out constraints, and determines single tasks the job consists of. It then assigns tasks to workers, watches their individual completion and keeps track of overall job completion. Dispatchers can be queried by the API to determine the status of a given job.
- Worker
-
Takes a task (like "ssh to a host and run this command") from the dispatcher, executes it and reports back the result. Can handle many tasks concurrently.
To make sure dispatchers and workers communicate over secure channels, and enable them to authenticate each other (is a connecting worker really an authorized worker, or is the dispatcher it's connecting to really an authorized dispatcher?), Pogo uses SSL server and client certs. See Pogo::Security for details.
pogo-one - All-In-One Pogo
$ cat t/cfgs/one.cfg
tag:
# no tags
sequence:
- host3
- host2
- host1
# specify two hosts 1 and 2, but config says to run them in
# reverse order
$ perl -Ilib bin/pogo-one --password --targets host1,host2 \
--config t/cfgs/one.cfg --run-command 'date'
Password: ****
host2: Running target
host2: Success
host1: Running target
host1: Success
pogo-one
is a simple utility that loads all the usually distributed Pogo components into one single process and runs it from the command line. In this way, you can test Pogo functions like constraints and sequences without having to set up the different components of an entire production system. It is mainly used for testing, but also helps with small deployment jobs.
By default, pogo-one
assumes that you have access to the target boxes without having to type your password or your ssh keyring's passphrase. To have pogo-one
collect the password and use it to sign in on the target, use the --password
options
$ pogo-one --password ...
Password: ****
...
--config file
-
Location of configuration file that defineds Pogo tags, sequences, and constraints.
--password
-
If specified, c<pogo-one> will collect the user's target password at a command line prompt, and use it to log into the target machines.
--targets
-
All hosts to run the command on. Order and parallelism is determined by the configuration file.
--run-command
-
The command to run on all hosts.
pogo-schedule - Print out the schedule for a job
$ cat t/cfgs/triple.cfg
# sample configuration file
tag:
colo:
one:
- host1
- host2
- host3
two:
- host4
- host5
- host6
three:
- host7
- host8
- host9
sequence:
foo:
- $colo.one
- $colo.two
bar:
- $colo.three
$ perl -Ilib bin/pogo-schedule t/cfgs/triple.cfg
.--------------------------------------------------------------.
| Schedule |
+------------------+---------------------+---------------------+
| Thread | slot-1 | slot-2 |
+------------------+---------------------+---------------------+
| thread-000000000 | [foo.$colo.one] | [foo.$colo.two] |
| | host3, host2, host1 | host6, host5, host4 |
| thread-000000001 | [bar.$colo.three] | |
| | host9, host8, host7 | |
| unconstrained | [unconstrained] | |
'------------------+---------------------+---------------------'
This utility pretty-prints a schedule for a job, as it would be executed based on a Pogo configuration file. It uses the actual Pogo scheduler in Pogo::Scheduler::Classic and asks it for an execution plan just as if we submitted a Pogo job for all hosts present in the configuration.
Copyright (c) 2010-2012 Yahoo! Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and imitations under the License.
Mike Schilli <[email protected]> Ian Bettinger <[email protected]>
Many thanks to the following folks for implementing the original version of Pogo:
Andrew Sloane <[email protected]>, Michael Fischer <[email protected]>, Nicholas Harteau <[email protected]>, Nick Purvis <[email protected]>, Robert Phan <[email protected]>, Srini Singanallur <[email protected]>, Yogesh Natarajan <[email protected]>