ey_info 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ey_info.rb +2 -2
- data/lib/version.rb +3 -0
- metadata +35 -63
- data/README.markdown +0 -72
- data/Rakefile +0 -30
- data/TODO +0 -23
- data/ey_info.gemspec +0 -54
- data/test/ey_info_test.rb +0 -19
- data/test/test_helper.rb +0 -16
data/lib/ey_info.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'rubygems'
|
3
|
+
gem 'engineyard', '1.3.17'
|
3
4
|
require 'engineyard'
|
4
5
|
require 'optparse'
|
5
6
|
require 'erb'
|
6
7
|
require 'pp'
|
8
|
+
require File.expand_path("../version", __FILE__)
|
7
9
|
require File.expand_path("../text_injector", __FILE__)
|
8
10
|
|
9
11
|
module EyInfo
|
10
|
-
Version = "0.1.3"
|
11
|
-
|
12
12
|
class CLI
|
13
13
|
def self.run(args)
|
14
14
|
cli = new(args)
|
data/lib/version.rb
ADDED
metadata
CHANGED
@@ -1,93 +1,65 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_info
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 0.1.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Tung Nguyen
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-12-03 00:00:00.000000000 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: engineyard
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70148229557400 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 3
|
33
|
-
- 11
|
34
|
-
version: 1.3.11
|
19
|
+
requirements:
|
20
|
+
- - =
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.3.17
|
35
23
|
type: :runtime
|
36
|
-
|
37
|
-
|
38
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70148229557400
|
26
|
+
description: Ey Info - Easy way to setup ssh keys for ey cloud servers and also to
|
27
|
+
dynamically pull server information from your ey servers and just it within capistrano.
|
28
|
+
email:
|
39
29
|
- tongueroo@gmail.com
|
40
|
-
executables:
|
30
|
+
executables:
|
41
31
|
- ey_info
|
42
32
|
extensions: []
|
43
|
-
|
44
|
-
|
45
|
-
- README.markdown
|
46
|
-
- TODO
|
47
|
-
files:
|
48
|
-
- README.markdown
|
49
|
-
- Rakefile
|
50
|
-
- TODO
|
51
|
-
- bin/ey_info
|
52
|
-
- ey_info.gemspec
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
53
35
|
- lib/ey_info.rb
|
54
36
|
- lib/templates/default_ssh_config.erb
|
55
37
|
- lib/text_injector.rb
|
56
|
-
-
|
57
|
-
-
|
38
|
+
- lib/version.rb
|
39
|
+
- bin/ey_info
|
58
40
|
has_rdoc: true
|
59
41
|
homepage: http://github.com/tongueroo/ey_info
|
60
42
|
licenses: []
|
61
|
-
|
62
43
|
post_install_message:
|
63
44
|
rdoc_options: []
|
64
|
-
|
65
|
-
require_paths:
|
45
|
+
require_paths:
|
66
46
|
- lib
|
67
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
48
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
|
74
|
-
- 0
|
75
|
-
version: "0"
|
76
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
54
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
segments:
|
83
|
-
- 0
|
84
|
-
version: "0"
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
85
59
|
requirements: []
|
86
|
-
|
87
60
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 1.6.2
|
89
62
|
signing_key:
|
90
63
|
specification_version: 3
|
91
64
|
summary: Ey Info - Easy way to setup ssh keys for ey cloud servers
|
92
65
|
test_files: []
|
93
|
-
|
data/README.markdown
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
Ey Info
|
2
|
-
=======
|
3
|
-
|
4
|
-
Summary
|
5
|
-
-------
|
6
|
-
Quickly set up your ~/.ssh/config shortcuts for your ey cloud servers.
|
7
|
-
|
8
|
-
Install
|
9
|
-
-------
|
10
|
-
|
11
|
-
<pre>
|
12
|
-
gem install --no-ri --no-rdoc ey_info # sudo if you need to
|
13
|
-
</pre>
|
14
|
-
|
15
|
-
Usage Command Line
|
16
|
-
-------
|
17
|
-
|
18
|
-
<pre>
|
19
|
-
# will set up your ~/ssh/config shortcuts.
|
20
|
-
$ ey_info -i "id_rsa" -u "root" # same as defaults
|
21
|
-
$ ey_info # same as above
|
22
|
-
</pre>
|
23
|
-
|
24
|
-
If you're environment in the ey cloud dashboard is called 'production' with an app_master, and 2 app instances.
|
25
|
-
|
26
|
-
<pre>
|
27
|
-
$ ssh production_app_master
|
28
|
-
vs
|
29
|
-
$ ssh -i ~/.ssh/id-rsa root@ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com
|
30
|
-
|
31
|
-
$ ssh production_app1
|
32
|
-
$ ssh production_app2
|
33
|
-
$ ssh production_db_master
|
34
|
-
$ ssh production_db_slave1
|
35
|
-
</pre>
|
36
|
-
|
37
|
-
Usage With Capistrano
|
38
|
-
-------
|
39
|
-
|
40
|
-
I still find capistrano a very useful utility for debugging and still use wanted to use it with EY's cloud.
|
41
|
-
|
42
|
-
<pre>
|
43
|
-
$ cap invoke COMMAND="..." is extremely useful. The engineyard gem provides a
|
44
|
-
"ey ssh 'uptime' --all -e production" command but it loops through the servers one by one instead of running
|
45
|
-
the commands in parallel, which can be slow if you have lots of servers.
|
46
|
-
</pre>
|
47
|
-
|
48
|
-
You can use this gem to dynamically grab the ec2 hosts information from your ey environment and set up your
|
49
|
-
capistrano roles.
|
50
|
-
|
51
|
-
Here are a few examples of how you can use it in your config/deploy.rb:
|
52
|
-
|
53
|
-
<pre>
|
54
|
-
require 'ey_info'
|
55
|
-
task :production do
|
56
|
-
@info = EyInfo::Hosts.new
|
57
|
-
hosts = @info.hosts("production") # parameter is the environment name in EY's gui interface
|
58
|
-
|
59
|
-
role :db, hosts.find {|x| x[:role] == "app_master" }[:ssh_key], :primary => true
|
60
|
-
# app instances
|
61
|
-
hosts.select {|x| x[:role] =~ /app/ }.each do |h|
|
62
|
-
role :web, h[:ssh_key]
|
63
|
-
role :app, h[:ssh_key], :sphinx => true
|
64
|
-
end
|
65
|
-
# utility instances
|
66
|
-
hosts.select {|x| x[:role] =~ /util/ }.each do |h|
|
67
|
-
role :web, h[:ssh_key]
|
68
|
-
role :app, h[:ssh_key], :sphinx => true
|
69
|
-
end
|
70
|
-
end
|
71
|
-
</pre>
|
72
|
-
|
data/Rakefile
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require File.expand_path('../lib/ey_info', __FILE__)
|
2
|
-
begin
|
3
|
-
require 'jeweler'
|
4
|
-
Jeweler::Tasks.new do |gem|
|
5
|
-
gem.version = EyInfo::Version
|
6
|
-
gem.name = "ey_info"
|
7
|
-
gem.executables = %W(ey_info)
|
8
|
-
gem.summary = %Q{Ey Info - Easy way to setup ssh keys for ey cloud servers}
|
9
|
-
gem.description = %Q{Ey Info - Easy way to setup ssh keys for ey cloud servers and also to dynamically pull server information from your ey servers and just it within capistrano.}
|
10
|
-
gem.homepage = "http://github.com/tongueroo/ey_info"
|
11
|
-
gem.email = [ "tongueroo@gmail.com" ]
|
12
|
-
gem.authors = [ "Tung Nguyen" ]
|
13
|
-
gem.add_dependency "engineyard", ">=1.3.11"
|
14
|
-
# gem.add_dependency "net-sftp", ">=2.0.0"
|
15
|
-
# gem.add_development_dependency "mocha", ">= 0"
|
16
|
-
end
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'rake/testtask'
|
22
|
-
Rake::TestTask.new(:test) do |test|
|
23
|
-
test.libs << 'lib' << 'test'
|
24
|
-
test.pattern = 'test/**/*_test.rb'
|
25
|
-
test.verbose = true
|
26
|
-
end
|
27
|
-
|
28
|
-
task :test => :check_dependencies
|
29
|
-
task :default => :test
|
30
|
-
|
data/TODO
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
CloudInfo::Instances outline
|
2
|
-
1. connect to ec2
|
3
|
-
|
4
|
-
2. find instances that are in the ey-env
|
5
|
-
find ey instances from ey-recipes for specific environment
|
6
|
-
grab aws_group from one of the instances in the ey-env
|
7
|
-
instances in group
|
8
|
-
I can simply also just grab the instances from ey-recipes instead of working back from the aws_group..
|
9
|
-
|
10
|
-
3. connect to instances (ssh) and build info
|
11
|
-
connect to servers
|
12
|
-
download json and store in dictionary lookup
|
13
|
-
at this point we have enough data about the servers to build up the info we want
|
14
|
-
|
15
|
-
4. hosts
|
16
|
-
{:prod_app0 => 'xx.xx.xx.xx', :prod_app1 => 'xx.xx.xx.xx'}
|
17
|
-
|
18
|
-
============
|
19
|
-
good stopping point:
|
20
|
-
* figure out a way to test exception from ssh.connect
|
21
|
-
* bad password
|
22
|
-
* timeout
|
23
|
-
|
data/ey_info.gemspec
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{ey_info}
|
8
|
-
s.version = "0.1.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Tung Nguyen"]
|
12
|
-
s.date = %q{2011-01-03}
|
13
|
-
s.default_executable = %q{ey_info}
|
14
|
-
s.description = %q{Ey Info - Easy way to setup ssh keys for ey cloud servers and also to dynamically pull server information from your ey servers and just it within capistrano.}
|
15
|
-
s.email = ["tongueroo@gmail.com"]
|
16
|
-
s.executables = ["ey_info"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"README.markdown",
|
19
|
-
"TODO"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
"README.markdown",
|
23
|
-
"Rakefile",
|
24
|
-
"TODO",
|
25
|
-
"bin/ey_info",
|
26
|
-
"lib/ey_info.rb",
|
27
|
-
"lib/templates/default_ssh_config.erb",
|
28
|
-
"lib/text_injector.rb",
|
29
|
-
"test/ey_info_test.rb",
|
30
|
-
"test/test_helper.rb"
|
31
|
-
]
|
32
|
-
s.homepage = %q{http://github.com/tongueroo/ey_info}
|
33
|
-
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.7}
|
35
|
-
s.summary = %q{Ey Info - Easy way to setup ssh keys for ey cloud servers}
|
36
|
-
s.test_files = [
|
37
|
-
"test/ey_info_test.rb",
|
38
|
-
"test/test_helper.rb"
|
39
|
-
]
|
40
|
-
|
41
|
-
if s.respond_to? :specification_version then
|
42
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
-
s.specification_version = 3
|
44
|
-
|
45
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
-
s.add_runtime_dependency(%q<engineyard>, [">= 1.3.11"])
|
47
|
-
else
|
48
|
-
s.add_dependency(%q<engineyard>, [">= 1.3.11"])
|
49
|
-
end
|
50
|
-
else
|
51
|
-
s.add_dependency(%q<engineyard>, [">= 1.3.11"])
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
data/test/ey_info_test.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require File.expand_path("../test_helper", __FILE__)
|
2
|
-
|
3
|
-
class EyInfoTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
@info = EyInfo::Hosts.new
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_all_hosts_hash
|
9
|
-
# pp @info.all_hosts
|
10
|
-
assert_equal @info.all_hosts.class, Hash
|
11
|
-
assert @info.all_hosts.keys.include?(:beta)
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_hosts_hash
|
15
|
-
pp @info.hosts(:alpha)
|
16
|
-
assert @info.hosts(:alpha).class, Array
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
ENV['RAILS_ENV'] = 'test'
|
4
|
-
|
5
|
-
require 'rubygems'
|
6
|
-
require 'test/unit'
|
7
|
-
require 'mocha'
|
8
|
-
require 'pp'
|
9
|
-
require File.expand_path("../../lib/ey_info", __FILE__)
|
10
|
-
|
11
|
-
module TestExtensions
|
12
|
-
end
|
13
|
-
|
14
|
-
class Test::Unit::TestCase
|
15
|
-
include TestExtensions
|
16
|
-
end
|