cknife 0.1.8 → 1.1.0
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.
- checksums.yaml +4 -4
- data/Gemfile +9 -8
- data/Gemfile.lock +106 -87
- data/README.md +74 -38
- data/Rakefile +6 -6
- data/VERSION +1 -1
- data/bin/cknifeaws +2 -502
- data/bin/cknifemon +5 -0
- data/cknife.gemspec +61 -51
- data/cknife.yml.sample +3 -0
- data/doc/remote_ubuntu_machine.md +87 -0
- data/lib/cknife/backgrounded_polling.rb +71 -0
- data/lib/cknife/cknife_aws.rb +572 -0
- data/lib/cknife/cknife_mon.rb +88 -0
- data/lib/cknife/cknife_mysql.rb +0 -1
- data/lib/cknife/cknife_pg.rb +11 -6
- data/lib/cknife/config.rb +2 -1
- data/lib/cknife/monitor.rb +42 -0
- data/lib/cknife/repetition.rb +12 -0
- metadata +84 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 942e64f111eae005180fac6810e16a3edf9c3a84
|
4
|
+
data.tar.gz: c4a46d9f451bb18b8799815c48a1be45d1632e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbe3f929fa330740f8928de67be6b45f5ad3f3088538c79a7cd47bf0a88f4dd4492d7bfcdcd6018e86072c08228f6edf94db28c2c9366526bae39294d9dfca34
|
7
|
+
data.tar.gz: 805af5ed73add5a49fc6f10c4ae97bd6f73e6230625d1becb8b33e1b6303758d55d16ed64cb9d382f3e711bb9752bc1ca8a01dedd0d624990bfd896bcde6b7c8
|
data/Gemfile
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem "rest-client", '>= 1.
|
4
|
-
gem "nokogiri", '>= 1.
|
5
|
-
gem "i18n",
|
6
|
-
gem "activesupport", '~>
|
7
|
-
gem "actionpack", '~>
|
8
|
-
gem "mail", '~> 2.
|
3
|
+
gem "rest-client", '>= 1.8.0', '~> 1'
|
4
|
+
gem "nokogiri", '>= 1.8.2', '~> 1'
|
5
|
+
gem "i18n", '>= 0.6.6'
|
6
|
+
gem "activesupport", '~> 4.2.9'
|
7
|
+
gem "actionpack", '~> 4.2.9'
|
8
|
+
gem "mail", '~> 2.5.5'
|
9
9
|
gem "thor", '>= 0.14', '~> 0'
|
10
10
|
gem "builder", '~> 3.0'
|
11
|
-
gem "fog", '
|
11
|
+
gem "fog-aws", '< 3.0'
|
12
12
|
gem "unf", '>= 0.1', '~> 0'
|
13
|
+
gem "daemons"
|
13
14
|
|
14
15
|
# Add dependencies to develop your gem here.
|
15
16
|
# Include everything needed to run rake, tests, features, etc.
|
16
17
|
group :development do
|
17
18
|
# gem "cknife", :path => "." # this arguably makes it easier to test quickly, locally.
|
18
19
|
gem "bundler", "~> 1.0"
|
19
|
-
gem "jeweler", "~> 2.
|
20
|
+
gem "jeweler", "~> 2.1"
|
20
21
|
end
|
21
22
|
|
22
23
|
|
data/Gemfile.lock
CHANGED
@@ -1,110 +1,128 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionpack (
|
5
|
-
|
6
|
-
activesupport (=
|
7
|
-
|
4
|
+
actionpack (4.2.10)
|
5
|
+
actionview (= 4.2.10)
|
6
|
+
activesupport (= 4.2.10)
|
7
|
+
rack (~> 1.6)
|
8
|
+
rack-test (~> 0.6.2)
|
9
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
10
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
11
|
+
actionview (4.2.10)
|
12
|
+
activesupport (= 4.2.10)
|
13
|
+
builder (~> 3.1)
|
8
14
|
erubis (~> 2.7.0)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
addressable (2.3.6)
|
22
|
-
builder (3.0.4)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
17
|
+
activesupport (4.2.10)
|
18
|
+
i18n (~> 0.7)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
21
|
+
tzinfo (~> 1.1)
|
22
|
+
addressable (2.4.0)
|
23
|
+
builder (3.2.3)
|
24
|
+
concurrent-ruby (1.0.5)
|
25
|
+
crass (1.0.4)
|
26
|
+
daemons (1.2.3)
|
23
27
|
descendants_tracker (0.0.4)
|
24
28
|
thread_safe (~> 0.3, >= 0.3.1)
|
29
|
+
domain_name (0.5.20180417)
|
30
|
+
unf (>= 0.0.5, < 1.0.0)
|
25
31
|
erubis (2.7.0)
|
26
|
-
excon (0.
|
27
|
-
faraday (0.9.
|
32
|
+
excon (0.62.0)
|
33
|
+
faraday (0.9.2)
|
28
34
|
multipart-post (>= 1.2, < 3)
|
29
|
-
fog (
|
35
|
+
fog-aws (2.0.1)
|
36
|
+
fog-core (~> 1.38)
|
37
|
+
fog-json (~> 1.0)
|
38
|
+
fog-xml (~> 0.1)
|
39
|
+
ipaddress (~> 0.8)
|
40
|
+
fog-core (1.45.0)
|
30
41
|
builder
|
31
|
-
excon (~> 0.
|
32
|
-
formatador (~> 0.2
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
formatador (0.2.
|
40
|
-
git (1.
|
41
|
-
github_api (0.
|
42
|
-
addressable (~> 2.
|
42
|
+
excon (~> 0.58)
|
43
|
+
formatador (~> 0.2)
|
44
|
+
fog-json (1.2.0)
|
45
|
+
fog-core
|
46
|
+
multi_json (~> 1.10)
|
47
|
+
fog-xml (0.1.3)
|
48
|
+
fog-core
|
49
|
+
nokogiri (>= 1.5.11, < 2.0.0)
|
50
|
+
formatador (0.2.5)
|
51
|
+
git (1.5.0)
|
52
|
+
github_api (0.16.0)
|
53
|
+
addressable (~> 2.4.0)
|
43
54
|
descendants_tracker (~> 0.0.4)
|
44
55
|
faraday (~> 0.8, < 0.10)
|
45
|
-
hashie (>= 3.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
i18n (0.
|
53
|
-
|
56
|
+
hashie (>= 3.4)
|
57
|
+
mime-types (>= 1.16, < 3.0)
|
58
|
+
oauth2 (~> 1.0)
|
59
|
+
hashie (3.6.0)
|
60
|
+
highline (2.0.0)
|
61
|
+
http-cookie (1.0.3)
|
62
|
+
domain_name (~> 0.5)
|
63
|
+
i18n (0.9.5)
|
64
|
+
concurrent-ruby (~> 1.0)
|
65
|
+
ipaddress (0.8.3)
|
66
|
+
jeweler (2.3.9)
|
54
67
|
builder
|
55
|
-
bundler
|
68
|
+
bundler
|
56
69
|
git (>= 1.2.5)
|
57
|
-
github_api
|
70
|
+
github_api (~> 0.16.0)
|
58
71
|
highline (>= 1.6.15)
|
59
72
|
nokogiri (>= 1.5.10)
|
73
|
+
psych
|
60
74
|
rake
|
61
75
|
rdoc
|
62
|
-
|
63
|
-
jwt (1.
|
64
|
-
|
65
|
-
|
76
|
+
semver2
|
77
|
+
jwt (1.5.6)
|
78
|
+
loofah (2.2.2)
|
79
|
+
crass (~> 1.0.2)
|
80
|
+
nokogiri (>= 1.5.9)
|
81
|
+
mail (2.5.5)
|
66
82
|
mime-types (~> 1.16)
|
67
83
|
treetop (~> 1.4.8)
|
68
|
-
mime-types (1.
|
69
|
-
|
70
|
-
|
71
|
-
|
84
|
+
mime-types (1.25.1)
|
85
|
+
mini_portile2 (2.3.0)
|
86
|
+
minitest (5.11.3)
|
87
|
+
multi_json (1.13.1)
|
88
|
+
multi_xml (0.6.0)
|
72
89
|
multipart-post (2.0.0)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
oauth2 (1.0.0)
|
79
|
-
faraday (>= 0.8, < 0.10)
|
90
|
+
netrc (0.11.0)
|
91
|
+
nokogiri (1.8.5)
|
92
|
+
mini_portile2 (~> 2.3.0)
|
93
|
+
oauth2 (1.4.0)
|
94
|
+
faraday (>= 0.8, < 0.13)
|
80
95
|
jwt (~> 1.0)
|
81
96
|
multi_json (~> 1.3)
|
82
97
|
multi_xml (~> 0.5)
|
83
|
-
rack (
|
98
|
+
rack (>= 1.2, < 3)
|
84
99
|
polyglot (0.3.5)
|
85
|
-
|
86
|
-
rack
|
87
|
-
|
88
|
-
rack-mount (0.8.3)
|
89
|
-
rack (>= 1.0.0)
|
90
|
-
rack-test (0.6.2)
|
100
|
+
psych (3.0.2)
|
101
|
+
rack (1.6.10)
|
102
|
+
rack-test (0.6.3)
|
91
103
|
rack (>= 1.0)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
104
|
+
rails-deprecated_sanitizer (1.0.3)
|
105
|
+
activesupport (>= 4.2.0.alpha)
|
106
|
+
rails-dom-testing (1.0.9)
|
107
|
+
activesupport (>= 4.2.0, < 5.0)
|
108
|
+
nokogiri (~> 1.6)
|
109
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
110
|
+
rails-html-sanitizer (1.0.4)
|
111
|
+
loofah (~> 2.2, >= 2.2.2)
|
112
|
+
rake (12.3.1)
|
113
|
+
rdoc (6.0.4)
|
114
|
+
rest-client (1.8.0)
|
115
|
+
http-cookie (>= 1.0.2, < 2.0)
|
116
|
+
mime-types (>= 1.16, < 3.0)
|
117
|
+
netrc (~> 0.7)
|
118
|
+
semver2 (3.4.2)
|
102
119
|
thor (0.14.6)
|
103
|
-
thread_safe (0.3.
|
104
|
-
tilt (1.4.1)
|
120
|
+
thread_safe (0.3.6)
|
105
121
|
treetop (1.4.15)
|
106
122
|
polyglot
|
107
123
|
polyglot (>= 0.3.1)
|
124
|
+
tzinfo (1.2.5)
|
125
|
+
thread_safe (~> 0.1)
|
108
126
|
unf (0.1.3)
|
109
127
|
unf_ext
|
110
128
|
unf_ext (0.0.6)
|
@@ -113,18 +131,19 @@ PLATFORMS
|
|
113
131
|
ruby
|
114
132
|
|
115
133
|
DEPENDENCIES
|
116
|
-
actionpack (~>
|
117
|
-
activesupport (~>
|
134
|
+
actionpack (~> 4.2.9)
|
135
|
+
activesupport (~> 4.2.9)
|
118
136
|
builder (~> 3.0)
|
119
137
|
bundler (~> 1.0)
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
138
|
+
daemons
|
139
|
+
fog-aws (< 3.0)
|
140
|
+
i18n (>= 0.6.6)
|
141
|
+
jeweler (~> 2.1)
|
142
|
+
mail (~> 2.5.5)
|
143
|
+
nokogiri (~> 1, >= 1.8.2)
|
144
|
+
rest-client (~> 1, >= 1.8.0)
|
126
145
|
thor (~> 0, >= 0.14)
|
127
146
|
unf (~> 0, >= 0.1)
|
128
147
|
|
129
148
|
BUNDLED WITH
|
130
|
-
1.
|
149
|
+
1.16.5
|
data/README.md
CHANGED
@@ -1,36 +1,73 @@
|
|
1
1
|
|
2
|
-
[](http://badge.fury.io/rb/cknife)
|
3
|
-
|
4
2
|
# Overview
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
cknife has command line tools written in Ruby. They're supposed
|
5
|
+
to help with some system administration tasks.
|
6
|
+
|
7
|
+
# Requirements
|
8
|
+
|
9
|
+
Ruby >= 2.1.
|
9
10
|
|
10
11
|
# Installation
|
11
12
|
|
12
|
-
|
13
|
+
Install ruby and possibly bundler:
|
13
14
|
|
14
15
|
> \curl -sSL https://get.rvm.io | bash -s stable --ruby
|
15
|
-
> gem install
|
16
|
+
> gem install bundler
|
17
|
+
|
18
|
+
Create a Gemfile with cknife and its git repository.
|
19
|
+
|
20
|
+
source "http://rubygems.org"
|
21
|
+
|
22
|
+
gem "cknife", :git => "https://github.com/mikedll/cknife.git"
|
23
|
+
|
24
|
+
Run bundle.
|
25
|
+
|
26
|
+
> bundle
|
27
|
+
|
28
|
+
# Monitor
|
29
|
+
|
30
|
+
This sends out a PUT request every fifteen minutes to a server
|
31
|
+
you configure.
|
32
|
+
|
33
|
+
> bundle exec cknifemon
|
34
|
+
Tasks:
|
35
|
+
cknifemon help [TASK] # Describe available tasks or one specific task
|
36
|
+
cknifemon restart # Restart monitor.
|
37
|
+
cknifemon start # Start monitor.
|
38
|
+
cknifemon status # Show status of monitor.
|
39
|
+
cknifemon stop # Stop monitor.
|
40
|
+
|
41
|
+
It is designed to work with M. Rivera CRM, but you can configure the
|
42
|
+
url to be any endpoint for your own monitoring purposes. You can
|
43
|
+
configure alerts on the server that you create as the target endpoint
|
44
|
+
of the monitor.
|
45
|
+
|
46
|
+
The configuration is as follows:
|
47
|
+
|
48
|
+
mon:
|
49
|
+
url: http://some.server.com/monitored_computers/heartbeat
|
50
|
+
api_key: someapikey
|
16
51
|
|
17
52
|
# Amazon Web Services (AWS) Command Line Interface
|
18
53
|
|
19
|
-
> cknifeaws help
|
54
|
+
> bundle exec cknifeaws help
|
20
55
|
Tasks:
|
21
|
-
cknifeaws afew [BUCKET_NAME]
|
22
|
-
cknifeaws create [BUCKET_NAME]
|
23
|
-
cknifeaws create_cloudfront [BUCKET_NAME]
|
24
|
-
cknifeaws delete [BUCKET_NAME]
|
25
|
-
cknifeaws download [BUCKET_NAME]
|
26
|
-
cknifeaws
|
27
|
-
cknifeaws
|
28
|
-
cknifeaws
|
29
|
-
cknifeaws
|
30
|
-
cknifeaws
|
31
|
-
cknifeaws
|
32
|
-
cknifeaws
|
33
|
-
cknifeaws
|
56
|
+
cknifeaws afew [BUCKET_NAME] # Show first 5 files in bucket
|
57
|
+
cknifeaws create [BUCKET_NAME] # Create a bucket
|
58
|
+
cknifeaws create_cloudfront [BUCKET_NAME] # Create a cloudfront distribution (a CDN)
|
59
|
+
cknifeaws delete [BUCKET_NAME] # Destroy a bucket
|
60
|
+
cknifeaws download [BUCKET_NAME] # Download all files in a bucket to CWD. Or one file.
|
61
|
+
cknifeaws fdelete [BUCKET_NAME] [FILE_NAME] # Delete a file in a bucket.
|
62
|
+
cknifeaws fupload [BUCKET_NAME] [LOCAL_FILE] # Upload a file to a bucket. Path to file is ignored.
|
63
|
+
cknifeaws help [TASK] # Describe available tasks or one specific task
|
64
|
+
cknifeaws list # Show all buckets
|
65
|
+
cknifeaws list_cloudfront # List cloudfront distributions (CDNs)
|
66
|
+
cknifeaws list_servers # Show all servers
|
67
|
+
cknifeaws show [BUCKET_NAME] # Show info about bucket
|
68
|
+
cknifeaws start_server [SERVER_ID] # Start a given EC2 server
|
69
|
+
cknifeaws stop_server [SERVER_ID] # Stop a given EC2 server (does not terminate it)
|
70
|
+
cknifeaws upsync [BUCKET_NAME] [DIRECTORY] # Push local files matching glob PATTERN into bucket. Ignore unchanged files.
|
34
71
|
|
35
72
|
### AWS Key and Secret Configuration
|
36
73
|
|
@@ -208,6 +245,10 @@ configuration file:
|
|
208
245
|
username: dbuser
|
209
246
|
password: dbpassword
|
210
247
|
|
248
|
+
**Warning:** do not use a colon in your password, or the password
|
249
|
+
configuration will not work. This is a shortcoming of this project and
|
250
|
+
a consequence of the `.pgpass` file format used by PostgreSQL.
|
251
|
+
|
211
252
|
Then you can capture a snapshot of your database. You can also restore
|
212
253
|
it using this tool.
|
213
254
|
|
@@ -311,8 +352,6 @@ executing once a day at 2am:
|
|
311
352
|
0 2 * * * path/to/script > /dev/null
|
312
353
|
|
313
354
|
|
314
|
-
# Contributing
|
315
|
-
|
316
355
|
### Making a release
|
317
356
|
|
318
357
|
One of the following, like patch. This will create a git commit.
|
@@ -324,22 +363,16 @@ One of the following, like patch. This will create a git commit.
|
|
324
363
|
Create the gem spec.
|
325
364
|
|
326
365
|
bundle exec rake gemspec:generate
|
327
|
-
git
|
328
|
-
git commit -m "Generated gemspec for version 0.1.4"
|
329
|
-
|
330
|
-
Make a gem release. This will generate a commit and a tag for v0.1.2.
|
366
|
+
git commit -am "Generated gemspec for version 0.1.4"
|
331
367
|
|
332
|
-
|
368
|
+
You can `rake release`... I think that deploys
|
369
|
+
the gem to Rubygems.
|
333
370
|
|
334
|
-
You may
|
335
|
-
releasing to Rubygems publically. Use scp
|
336
|
-
to move this .gem file to a machine you want to install
|
337
|
-
on:
|
371
|
+
You may build a local gem:
|
338
372
|
|
339
373
|
bundle exec rake build
|
340
374
|
|
341
|
-
|
342
|
-
something like the following:
|
375
|
+
And remove it:
|
343
376
|
|
344
377
|
rm pkg/cknife-0.1.6.gem
|
345
378
|
|
@@ -347,9 +380,12 @@ something like the following:
|
|
347
380
|
|
348
381
|
You can uncommente the 'gem cknife' line in the Gemfile.
|
349
382
|
|
350
|
-
|
351
|
-
|
383
|
+
Then you can invoke the executables as you work on them.
|
384
|
+
|
385
|
+
Do not generate the .gemspec with this line uncommented, or
|
386
|
+
you'll create a self-dependency in this gem.
|
387
|
+
|
388
|
+
Run bundle after uncommenting the line then use `bundle exec cmd`
|
389
|
+
to invoke a given command named "cmd".
|
352
390
|
|
353
|
-
Don't generate the gemspec with this on, though, or it'll be a self-dependency
|
354
|
-
which isn't really what we want.
|
355
391
|
|
data/Rakefile
CHANGED
@@ -15,12 +15,12 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
17
|
gem.name = "cknife"
|
18
|
-
gem.homepage = "http://github.com/mikedll/
|
19
|
-
gem.license = "
|
20
|
-
gem.summary = "
|
21
|
-
gem.description = "
|
22
|
-
gem.email = "
|
23
|
-
gem.authors = ["
|
18
|
+
gem.homepage = "http://github.com/mikedll/cknife"
|
19
|
+
gem.license = ""
|
20
|
+
gem.summary = "CKnife"
|
21
|
+
gem.description = "A collection of command line tools, especially for popular API services."
|
22
|
+
gem.email = "soymrmike@gmail.com"
|
23
|
+
gem.authors = ["Michael Rivera"]
|
24
24
|
# dependencies defined in Gemfile
|
25
25
|
end
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|