octo 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/README.md +147 -0
  4. data/lib/octo.rb +1 -0
  5. data/octo.gemspec +1 -1
  6. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66cd0851a525e692cddaf445ca74381c3011f17e
4
- data.tar.gz: 3b3783deb28a2b5fcc0f4f025f41e98900592ace
3
+ metadata.gz: 8e0412e178a3f4b84e9531dd384eef0bba48166a
4
+ data.tar.gz: 14b26e319ebf58809ada1146d7515e8d2eceaa1a
5
5
  SHA512:
6
- metadata.gz: 800b24ed76d1b544f2713b25b838fa119e157d60e12b3a3ec34c39e69cb0fb093f9bd47fdc09b8956b710f3beadc2ab5d516f820babfab194056ee1e7180af1b
7
- data.tar.gz: 6d7c3717ff39dd39b67a036fa6191160c6291304bd1a0e56b4f9e17c07c1ffae386d85472421353d72172f8a5b4033ccae99dc8c0a4ca8c433ab58ce151e28ff
6
+ metadata.gz: 74e5c77cc3be4f4527735c195bb97e95491a342e885c20ce2310618e5ca9b6134fbc83b1908e55013db146cf14d9d982ae21c1a722c3e3321c5b5da8087799a9
7
+ data.tar.gz: 2c2406df124d0b505a31f3087c3945544ef944140e93b2238da76be9860e564e59c6aaa7d980834ba11e208b3e5c3e4f1c352909f754e926651a9e7756ddf9da
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Nan Zhong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,147 @@
1
+ #octo
2
+
3
+ A lightweight tool for running commands on multiple hosts at the same time.
4
+
5
+ I found myself getting increasingly frustrated while working with clusters of remote servers. Things like tailing a log on every server, or wanted to grep for something on the entire cluster was very tedious to do.
6
+
7
+ I tried using pssh (and family) but it was difficult to manage multiple host groups, and small annoyances like leaving commands running on the remote server when pssh was interrupted/killed made them not so much fun to use. So, I created this tool as a quick way for me to be able to manage clusters of similar servers.
8
+
9
+ ## Features
10
+
11
+ - Support for Parallel SSH commands [currently only support public key auth, username:password coming)
12
+ - Support for Parallel MySQL commands [working, but needs more testing]
13
+ - Profile/Server cluster management
14
+ - Option for output to files based on remote server [Future]
15
+ - Graceful error handling [Future]
16
+ - Support for timeouts [Future]
17
+
18
+ ## Requirements
19
+
20
+ Since octo currently only support public key auth, it relies on your user having his ssh keys properly configured and loaded.
21
+
22
+ ## Installation
23
+
24
+ gem install octo
25
+
26
+ ## Configuration
27
+
28
+ octo looks for a `.octorc` file in your home directory. It's a simple yaml file and the best way to explain it would be to give an example
29
+
30
+ ---
31
+ ssh:
32
+ test:
33
+ - root@test.server.com
34
+ stage:
35
+ - root@server1.stage.server.com
36
+ - root@server2.stage.server.com
37
+ prod:
38
+ - root@server1.server.com
39
+ - root@server2.server.com
40
+ - root@server3.server.com
41
+ prod_db:
42
+ - root@db1.server.com
43
+ - root@db2.server.com
44
+ mysql:
45
+ test:
46
+ - test:password@test.server.com/db_test
47
+ staging:
48
+ - stage:password@db1.staging.server.com/db_stage
49
+ prod_central:
50
+ - prod_user:superpassword@central.server.com/db_central
51
+ prod_shards:
52
+ - prod_user:superpassword@shard1.server.com/db_shard_1
53
+ - prod_user:superpassword@shard2.server.com/db_shard_2
54
+
55
+ This file can also be managed on the command line
56
+
57
+ $ octo profile <command>
58
+
59
+ NAME
60
+ profile - Manage profiles
61
+
62
+ SYNOPSIS
63
+ octo [global options] profile add profile server
64
+ octo [global options] profile list [profile]
65
+ octo [global options] profile rm profile server
66
+
67
+ DESCRIPTION
68
+ Manage profile that will be used to run commands. Each profile consists of a set of servers.
69
+
70
+ COMMANDS
71
+ add - Add a host to a profile
72
+ list - List all profiles
73
+ rm - Remove a host from a profile
74
+
75
+ ## Using
76
+
77
+ Running a parallel command in octo is pretty simple, once you have your profiles configured
78
+
79
+ octo run <profile> <command>
80
+
81
+ For example
82
+
83
+ $ octo run prod 'tail -n 3 /var/log/messages'
84
+ [root@server1.server.com] Oct 22 03:49:01 server8 auditd[2519]: Audit daemon rotating log files
85
+ [root@server1.server.com] Oct 22 14:57:09 server8 auditd[2519]: Audit daemon rotating log files
86
+ [root@server1.server.com] Oct 23 03:29:01 server8 auditd[2519]: Audit daemon rotating log files
87
+ [root@server2.server.com] Oct 22 07:48:01 server11 auditd[2400]: Audit daemon rotating log files
88
+ [root@server2.server.com] Oct 22 21:10:01 server11 auditd[2400]: Audit daemon rotating log files
89
+ [root@server2.server.com] Oct 23 12:50:01 server11 auditd[2400]: Audit daemon rotating log files
90
+ [root@server3.server.com] Oct 20 11:40:11 server12 kernel: possible SYN flooding on port 9000. Sending cookies.
91
+ [root@server3.server.com] Oct 21 11:55:49 server12 auditd[2645]: Audit daemon rotating log files
92
+ [root@server3.server.com] Oct 22 12:53:01 server12 auditd[2645]: Audit daemon rotating log files
93
+
94
+ Of course you can also do things like
95
+
96
+ $ octo run prod 'tail -f /var/log/nginx/error.log | grep search' # piping on the remote boxes
97
+
98
+ $ octo run prod 'tail -f /var/log/nginx/error.log' | grep string # also works locally, but obviously slower
99
+
100
+ $ octo run prod 'ruby script.rb' > stdout.log 2> stderr.log # stdout and stderr are preserved
101
+
102
+ Octo also has experimental support for running queries in parallel
103
+
104
+ $ octo -m mysql run prod_shards 'select username, email, first_name, last_name from users where username like "nan.%"'
105
+
106
+ Running query on prod_user:superpassword@shard1.server.com/db_shard_1... 1 results
107
+ +-------------+-------------------------+------------+--------------+
108
+ | username | email | first_name | last_name |
109
+ +-------------+-------------------------+------------+--------------+
110
+ | nan.test | nan.test@mailinator.com | New | Test User |
111
+ +-------------+-------------------------+------------+--------------+
112
+ Running query on prod_user:superpassword@shard2.server.com/db_shard_2... 3 results
113
+ +------------+---------------------------+------------+-----------+
114
+ | username | email | first_name | last_name |
115
+ +------------+---------------------------+------------+-----------+
116
+ | nan.814 | nan.814@mailinator.com | bla | bla |
117
+ | nan.leigh | | | |
118
+ | nan.manley | nan.manley@mailinator.com | bla | bla |
119
+ +------------+---------------------------+------------+-----------+
120
+
121
+ ## Contribute
122
+
123
+ Feel free to submit issues and I will try my best to get to them. If you are interested, pull requests are highly welcome. :)
124
+
125
+ ## License
126
+
127
+ The MIT License (MIT)
128
+
129
+ Copyright (c) 2013 Nan Zhong
130
+
131
+ Permission is hereby granted, free of charge, to any person obtaining a copy
132
+ of this software and associated documentation files (the "Software"), to deal
133
+ in the Software without restriction, including without limitation the rights
134
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
135
+ copies of the Software, and to permit persons to whom the Software is
136
+ furnished to do so, subject to the following conditions:
137
+
138
+ The above copyright notice and this permission notice shall be included in
139
+ all copies or substantial portions of the Software.
140
+
141
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
142
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
143
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
144
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
145
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
146
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
147
+ THE SOFTWARE.
@@ -29,6 +29,7 @@ class Octo
29
29
  data.each_line do |line|
30
30
  stream.puts "[#{green(ch.properties[:server].to_s)}] #{line}"
31
31
  end
32
+ stream.flush
32
33
  end
33
34
  session.loop
34
35
  end
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.name = 'octo'
3
3
  s.summary = 'Run commands in parallel on multiple hosts'
4
4
  s.description = 'A lightweight script that allows you to run commands in parallel on multiple hosts'
5
- s.version = '0.0.7'
5
+ s.version = '0.0.8'
6
6
  s.author = 'Nan Zhong'
7
7
  s.email = 'nan@nine27.com'
8
8
  s.homepage = 'https://github.com/nanzhong/octo'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nan Zhong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-23 00:00:00.000000000 Z
11
+ date: 2014-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh-multi
@@ -89,6 +89,8 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - ".gitignore"
92
+ - LICENSE
93
+ - README.md
92
94
  - bin/octo
93
95
  - lib/octo.rb
94
96
  - lib/octo/profile.rb
@@ -113,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
115
  version: '0'
114
116
  requirements: []
115
117
  rubyforge_project:
116
- rubygems_version: 2.0.3
118
+ rubygems_version: 2.2.0
117
119
  signing_key:
118
120
  specification_version: 4
119
121
  summary: Run commands in parallel on multiple hosts