engineyard-metadata 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +26 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/engineyard-metadata.gemspec +67 -0
- data/lib/engineyard-metadata.rb +3 -0
- data/lib/engineyard-metadata/amazon_ec2_api.rb +17 -0
- data/lib/engineyard-metadata/chef_dna.rb +90 -0
- data/lib/engineyard-metadata/metadata.rb +50 -0
- data/spec/metadata_spec.rb +65 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/support/dna.json +268 -0
- metadata +139 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Seamus Abshere
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
= engineyard-metadata
|
2
|
+
|
3
|
+
Pulls metadata from EC2 and EngineYard so that your EngineYard Cloud instances know about each other.
|
4
|
+
|
5
|
+
== Quickstart
|
6
|
+
|
7
|
+
This only runs from EngineYard AppCloud instances (running on Amazon EC2).
|
8
|
+
|
9
|
+
>> require 'engineyard-metadata'
|
10
|
+
[...]
|
11
|
+
>> EY::Metadata.db_host
|
12
|
+
=> "external_db_master.compute-1.amazonaws.com"
|
13
|
+
>> EY::Metadata.db_password
|
14
|
+
=> "foobarfoo"
|
15
|
+
>> EY::Metadata.app_servers
|
16
|
+
=> [ 'app_1.compute-1.amazonaws.com' , 'app_master.compute-1.amazonaws.com' ]
|
17
|
+
>> EY::Metadata.db_servers
|
18
|
+
=> [ 'db_master.compute-1.amazonaws.com', 'db_slave_1.compute-1.amazonaws.com' ]
|
19
|
+
|
20
|
+
== History
|
21
|
+
|
22
|
+
This is the second generation of http://rubygems.org/gems/ey_cloud_awareness.
|
23
|
+
|
24
|
+
== Copyright
|
25
|
+
|
26
|
+
Copyright (c) 2010 Seamus Abshere. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "engineyard-metadata"
|
8
|
+
gem.summary = %Q{Make your EngineYard AppCloud (Amazon EC2) instances aware of each other.}
|
9
|
+
gem.description = %Q{Pulls metadata from EC2 and EngineYard so that your EngineYard AppCloud (Amazon EC2) instances know about each other.}
|
10
|
+
gem.email = "seamus@abshere.net"
|
11
|
+
gem.homepage = "http://github.com/seamusabshere/engineyard-metadata"
|
12
|
+
gem.authors = ["Seamus Abshere"]
|
13
|
+
gem.add_dependency 'activesupport', '>=2.3.4'
|
14
|
+
gem.add_development_dependency "fakeweb"
|
15
|
+
gem.add_development_dependency "fakefs"
|
16
|
+
gem.add_development_dependency "rspec", "~>1"
|
17
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
+
end
|
19
|
+
Jeweler::GemcutterTasks.new
|
20
|
+
rescue LoadError
|
21
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
Rake::TestTask.new(:test) do |test|
|
26
|
+
test.libs << 'lib' << 'test'
|
27
|
+
test.pattern = 'test/**/test_*.rb'
|
28
|
+
test.verbose = true
|
29
|
+
end
|
30
|
+
|
31
|
+
begin
|
32
|
+
require 'rcov/rcovtask'
|
33
|
+
Rcov::RcovTask.new do |test|
|
34
|
+
test.libs << 'test'
|
35
|
+
test.pattern = 'test/**/test_*.rb'
|
36
|
+
test.verbose = true
|
37
|
+
end
|
38
|
+
rescue LoadError
|
39
|
+
task :rcov do
|
40
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
task :test => :check_dependencies
|
45
|
+
|
46
|
+
task :default => :test
|
47
|
+
|
48
|
+
require 'rake/rdoctask'
|
49
|
+
Rake::RDocTask.new do |rdoc|
|
50
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
51
|
+
|
52
|
+
rdoc.rdoc_dir = 'rdoc'
|
53
|
+
rdoc.title = "engineyard-metadata #{version}"
|
54
|
+
rdoc.rdoc_files.include('README*')
|
55
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{engineyard-metadata}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Seamus Abshere"]
|
12
|
+
s.date = %q{2010-09-24}
|
13
|
+
s.description = %q{Pulls metadata from EC2 and EngineYard so that your EngineYard AppCloud (Amazon EC2) instances know about each other.}
|
14
|
+
s.email = %q{seamus@abshere.net}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"engineyard-metadata.gemspec",
|
27
|
+
"lib/engineyard-metadata.rb",
|
28
|
+
"lib/engineyard-metadata/amazon_ec2_api.rb",
|
29
|
+
"lib/engineyard-metadata/chef_dna.rb",
|
30
|
+
"lib/engineyard-metadata/metadata.rb",
|
31
|
+
"spec/metadata_spec.rb",
|
32
|
+
"spec/spec_helper.rb",
|
33
|
+
"spec/support/dna.json"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/seamusabshere/engineyard-metadata}
|
36
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.7}
|
39
|
+
s.summary = %q{Make your EngineYard AppCloud (Amazon EC2) instances aware of each other.}
|
40
|
+
s.test_files = [
|
41
|
+
"spec/metadata_spec.rb",
|
42
|
+
"spec/spec_helper.rb"
|
43
|
+
]
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.4"])
|
51
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
52
|
+
s.add_development_dependency(%q<fakefs>, [">= 0"])
|
53
|
+
s.add_development_dependency(%q<rspec>, ["~> 1"])
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.4"])
|
56
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
57
|
+
s.add_dependency(%q<fakefs>, [">= 0"])
|
58
|
+
s.add_dependency(%q<rspec>, ["~> 1"])
|
59
|
+
end
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.4"])
|
62
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
63
|
+
s.add_dependency(%q<fakefs>, [">= 0"])
|
64
|
+
s.add_dependency(%q<rspec>, ["~> 1"])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module EY
|
4
|
+
module Metadata
|
5
|
+
class AmazonEc2Api
|
6
|
+
# The present instance's Amazon Ec2 instance id.
|
7
|
+
def present_instance_id
|
8
|
+
open("http://169.254.169.254/latest/meta-data/instance-id").gets
|
9
|
+
end
|
10
|
+
|
11
|
+
# The present instance's Amazon Ec2 security group.
|
12
|
+
def present_security_group
|
13
|
+
open('http://169.254.169.254/latest/meta-data/security-groups').gets
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'active_support/version'
|
2
|
+
%w{
|
3
|
+
active_support/json/decoding
|
4
|
+
}.each do |active_support_3_requirement|
|
5
|
+
require active_support_3_requirement
|
6
|
+
end if ActiveSupport::VERSION::MAJOR == 3
|
7
|
+
|
8
|
+
module EY
|
9
|
+
module Metadata
|
10
|
+
class ChefDna
|
11
|
+
PATH = '/etc/chef/dna.json'
|
12
|
+
|
13
|
+
def data # :nodoc:
|
14
|
+
@data ||= ActiveSupport::JSON.decode File.read(PATH)
|
15
|
+
end
|
16
|
+
|
17
|
+
# The present instance's public hostname.
|
18
|
+
def present_public_hostname
|
19
|
+
data['engineyard']['environment']['instances'].detect { |i| i['id'] == EY::Metadata.present_instance_id }['public_hostname']
|
20
|
+
end
|
21
|
+
|
22
|
+
# Currently the same as the SSH password.
|
23
|
+
def database_password
|
24
|
+
data['users'][0]['password']
|
25
|
+
end
|
26
|
+
|
27
|
+
# Currently the same as the SSH username.
|
28
|
+
def database_username
|
29
|
+
data['users'][0]['username']
|
30
|
+
end
|
31
|
+
|
32
|
+
# For newly deployed applications, equal to the application name.
|
33
|
+
def database_name
|
34
|
+
data['engineyard']['environment']['apps'][0]['database_name']
|
35
|
+
end
|
36
|
+
|
37
|
+
# Public hostname where you should connect to the database.
|
38
|
+
#
|
39
|
+
# Currently the db master public hostname.
|
40
|
+
def database_host
|
41
|
+
data['db_host']
|
42
|
+
end
|
43
|
+
|
44
|
+
# SSH username.
|
45
|
+
def ssh_username
|
46
|
+
data['engineyard']['environment']['ssh_username']
|
47
|
+
end
|
48
|
+
|
49
|
+
# SSH password.
|
50
|
+
def ssh_password
|
51
|
+
data['engineyard']['environment']['ssh_password']
|
52
|
+
end
|
53
|
+
|
54
|
+
# The public hostnames of all the app servers.
|
55
|
+
#
|
56
|
+
# If you're on a solo app, it counts the solo as an app server.
|
57
|
+
def app_servers
|
58
|
+
data['engineyard']['environment']['instances'].select { |i| %w{ app_master app solo }.include? i['role'] }.map { |i| i['public_hostname'] }.sort
|
59
|
+
end
|
60
|
+
|
61
|
+
# The public hostnames of all the db servers.
|
62
|
+
#
|
63
|
+
# If you're on a solo app, it counts the solo as a db server.
|
64
|
+
def db_servers
|
65
|
+
data['engineyard']['environment']['instances'].select { |i| %w{ db_master db_slave solo }.include? i['role'] }.map { |i| i['public_hostname'] }.sort
|
66
|
+
end
|
67
|
+
|
68
|
+
# The public hostnames of all the utility servers.
|
69
|
+
#
|
70
|
+
# If you're on a solo app, it counts the solo as a utility.
|
71
|
+
def utilities
|
72
|
+
data['engineyard']['environment']['instances'].select { |i| %w{ util solo }.include? i['role'] }.map { |i| i['public_hostname'] }.sort
|
73
|
+
end
|
74
|
+
|
75
|
+
# The public hostname of the app_master.
|
76
|
+
def app_master
|
77
|
+
i = data['engineyard']['environment']['instances'].detect { |i| i['role'] == 'app_master' } ||
|
78
|
+
data['engineyard']['environment']['instances'].detect { |i| i['role'] == 'solo' }
|
79
|
+
i['public_hostname']
|
80
|
+
end
|
81
|
+
|
82
|
+
# The public hostname of the db_master,
|
83
|
+
def db_master
|
84
|
+
i = data['engineyard']['environment']['instances'].detect { |i| i['role'] == 'db_master' } ||
|
85
|
+
data['engineyard']['environment']['instances'].detect { |i| i['role'] == 'solo' }
|
86
|
+
i['public_hostname']
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module EY
|
2
|
+
module Metadata
|
3
|
+
DELEGATED_TO_AMAZON_EC2_API = %w{
|
4
|
+
present_instance_id
|
5
|
+
present_security_group
|
6
|
+
}
|
7
|
+
|
8
|
+
DELEGATED_TO_CHEF_DNA = %w{
|
9
|
+
present_public_hostname
|
10
|
+
database_password
|
11
|
+
database_username
|
12
|
+
database_name
|
13
|
+
database_host
|
14
|
+
ssh_username
|
15
|
+
ssh_password
|
16
|
+
app_servers
|
17
|
+
db_servers
|
18
|
+
utilities
|
19
|
+
app_master
|
20
|
+
db_master
|
21
|
+
}
|
22
|
+
|
23
|
+
DELEGATED_TO_AMAZON_EC2_API.each do |name|
|
24
|
+
EY::Metadata.send :define_method, name do
|
25
|
+
amazon_ec2_api.send name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
DELEGATED_TO_CHEF_DNA.each do |name|
|
30
|
+
EY::Metadata.send :define_method, name do
|
31
|
+
chef_dna.send name
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
extend self
|
36
|
+
|
37
|
+
autoload :ChefDna, 'engineyard-metadata/chef_dna'
|
38
|
+
autoload :AmazonEc2Api, 'engineyard-metadata/amazon_ec2_api'
|
39
|
+
|
40
|
+
# An adapter that reads from the EngineYard AppCloud /etc/chef/dna.json file.
|
41
|
+
def chef_dna
|
42
|
+
@chef_dna ||= EY::Metadata::ChefDna.new
|
43
|
+
end
|
44
|
+
|
45
|
+
# An adapter that reads from Amazon's EC2 API.
|
46
|
+
def amazon_ec2_api
|
47
|
+
@amazon_ec2_api ||= EY::Metadata::AmazonEc2Api.new
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EY do
|
4
|
+
it 'has a dna.json' do
|
5
|
+
File.exist?('/etc/chef/dna.json').should == true
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe EY::Metadata do
|
10
|
+
it 'gets the present instance ID' do
|
11
|
+
EY::Metadata.present_instance_id.should == PRESENT_INSTANCE_ID
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'gets the present public hostname' do
|
15
|
+
EY::Metadata.present_public_hostname.should == PRESENT_PUBLIC_HOSTNAME
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'gets the present security group' do
|
19
|
+
EY::Metadata.present_security_group.should == PRESENT_SECURITY_GROUP
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'gets the database password' do
|
23
|
+
EY::Metadata.database_password.should == 'USERS-0-PASSWORD'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'gets the database username' do
|
27
|
+
EY::Metadata.database_username.should == 'USERS-0-USERNAME'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'gets the database name' do
|
31
|
+
EY::Metadata.database_name.should == 'APPS-0-DATABASE_NAME'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'gets the database host' do
|
35
|
+
EY::Metadata.database_host.should == 'external_db_master.compute-1.amazonaws.com'
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'gets the ssh username' do
|
39
|
+
EY::Metadata.ssh_username.should == 'SSH-USERNAME'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'gets the ssh password' do
|
43
|
+
EY::Metadata.ssh_password.should == 'SSH-PASSWORD'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'gets the app server hostnames' do
|
47
|
+
EY::Metadata.app_servers.should == [ 'app_1.compute-1.amazonaws.com' , 'app_master.compute-1.amazonaws.com' ]
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'gets the db server hostnames' do
|
51
|
+
EY::Metadata.db_servers.should == [ 'db_master.compute-1.amazonaws.com', 'db_slave_1.compute-1.amazonaws.com' ]
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'gets the utilitie hostnames' do
|
55
|
+
EY::Metadata.utilities.should == [ 'util_1.compute-1.amazonaws.com' ]
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'gets the app master hostname' do
|
59
|
+
EY::Metadata.app_master.should == 'app_master.compute-1.amazonaws.com'
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'gets the db master hostname' do
|
63
|
+
EY::Metadata.db_master.should == 'db_master.compute-1.amazonaws.com'
|
64
|
+
end
|
65
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spec'
|
3
|
+
# require 'ruby-debug'
|
4
|
+
# assumes active-support 3
|
5
|
+
require 'active_support/json/encoding'
|
6
|
+
|
7
|
+
PRESENT_PUBLIC_HOSTNAME = 'app_master.compute-1.amazonaws.com'
|
8
|
+
PRESENT_SECURITY_GROUP = 'ey-data1_production-1-2-3'
|
9
|
+
PRESENT_INSTANCE_ID = 'i-deadbeef'
|
10
|
+
|
11
|
+
require 'fakeweb'
|
12
|
+
FakeWeb.allow_net_connect = false
|
13
|
+
# fake call to amazon ec2 api to get present security group
|
14
|
+
FakeWeb.register_uri :get,
|
15
|
+
"http://169.254.169.254/latest/meta-data/security-groups",
|
16
|
+
:status => ["200", "OK"],
|
17
|
+
:body => PRESENT_SECURITY_GROUP
|
18
|
+
|
19
|
+
# fake call to amazon ec2 api to get present instance id
|
20
|
+
FakeWeb.register_uri :get,
|
21
|
+
"http://169.254.169.254/latest/meta-data/instance-id",
|
22
|
+
:status => ["200", "OK"],
|
23
|
+
:body => PRESENT_INSTANCE_ID
|
24
|
+
|
25
|
+
dna_json = File.read File.join(File.dirname(__FILE__), 'support', 'dna.json')
|
26
|
+
require 'fakefs'
|
27
|
+
FileUtils.mkdir_p '/etc/chef'
|
28
|
+
File.open '/etc/chef/dna.json', 'w' do |f|
|
29
|
+
f.write dna_json
|
30
|
+
end
|
31
|
+
|
32
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
33
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
34
|
+
require 'engineyard-metadata'
|
35
|
+
|
36
|
+
# Spec::Runner.configure do |config|
|
37
|
+
# config.before(:all) do
|
38
|
+
#
|
39
|
+
# end
|
40
|
+
# end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
{
|
2
|
+
"db_slaves": [
|
3
|
+
|
4
|
+
],
|
5
|
+
"aws_secret_key": "AWS-SECRET-KEY",
|
6
|
+
"ruby_version": "Ruby 1.8.7",
|
7
|
+
"user_ssh_key": [
|
8
|
+
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-a",
|
9
|
+
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-b",
|
10
|
+
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-c"
|
11
|
+
],
|
12
|
+
"backup_interval": 24,
|
13
|
+
"admin_ssh_key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB ey-cloud-production\n",
|
14
|
+
"internal_ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB \n",
|
15
|
+
"internal_ssh_private_key": "-----BEGIN RSA PRIVATE KEY-----\nPRIVATE-KEY\n-----END RSA PRIVATE KEY-----\n",
|
16
|
+
"utility_instances": [
|
17
|
+
{
|
18
|
+
"name": "APP-NAME_production_util_1",
|
19
|
+
"hostname": "internal_util_1.compute-1.internal"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"instance_role": "app_master",
|
23
|
+
"mailserver": "smtp.engineyard.com",
|
24
|
+
"crons": [
|
25
|
+
|
26
|
+
],
|
27
|
+
"removed_applications": [
|
28
|
+
|
29
|
+
],
|
30
|
+
"backup_window": 10,
|
31
|
+
"members": [
|
32
|
+
"internal_app_master.compute-1.internal"
|
33
|
+
],
|
34
|
+
"alert_email": "ALERT-EMAIL",
|
35
|
+
"gems_to_install": [
|
36
|
+
{
|
37
|
+
"name": "rails",
|
38
|
+
"version": "3.0.0"
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"applications": {
|
42
|
+
"APP-NAME": {
|
43
|
+
"auth": {
|
44
|
+
"active": false
|
45
|
+
},
|
46
|
+
"newrelic": false,
|
47
|
+
"https_bind_port": 443,
|
48
|
+
"repository_name": "APPS-0-REPOSITORY-NAME",
|
49
|
+
"type": "rack",
|
50
|
+
"migration_command": "rake db:migrate",
|
51
|
+
"http_bind_port": 80,
|
52
|
+
"revision": "",
|
53
|
+
"run_deploy": false,
|
54
|
+
"branch": "HEAD",
|
55
|
+
"deploy_key": "-----BEGIN RSA PRIVATE KEY-----\nAPPS-0-DEPLOY-KEY\n-----END RSA PRIVATE KEY-----\n",
|
56
|
+
"deploy_action": "deploy",
|
57
|
+
"run_migrations": false,
|
58
|
+
"services": [
|
59
|
+
{
|
60
|
+
"resource": "mongrel",
|
61
|
+
"mongrel_base_port": 5000,
|
62
|
+
"mongrel_mem_limit": 150,
|
63
|
+
"mongrel_instance_count": 3
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"resource": "memcached",
|
67
|
+
"base_port": 11211,
|
68
|
+
"mem_limit": 128
|
69
|
+
}
|
70
|
+
],
|
71
|
+
"recipes": [
|
72
|
+
"memcached",
|
73
|
+
"monit",
|
74
|
+
"nginx",
|
75
|
+
"nginx-passenger"
|
76
|
+
],
|
77
|
+
"vhosts": [
|
78
|
+
{
|
79
|
+
"name": "_",
|
80
|
+
"role": "APP-NAME_production"
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
},
|
85
|
+
"aws_secret_id": "AWS-SECRET-ID",
|
86
|
+
"users": [
|
87
|
+
{
|
88
|
+
"gid": "1000",
|
89
|
+
"username": "USERS-0-USERNAME",
|
90
|
+
"uid": "1000",
|
91
|
+
"comment": "",
|
92
|
+
"password": "USERS-0-PASSWORD"
|
93
|
+
}
|
94
|
+
],
|
95
|
+
"environment": {
|
96
|
+
"name": "APP-NAME_production",
|
97
|
+
"stack": "nginx_passenger",
|
98
|
+
"framework_env": "production"
|
99
|
+
},
|
100
|
+
"master_app_server": {
|
101
|
+
"private_dns_name": "internal_app_master.compute-1.internal",
|
102
|
+
"public_ip": "external_app_master.compute-1.amazonaws.com"
|
103
|
+
},
|
104
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/abcde",
|
105
|
+
"packages_to_install": [
|
106
|
+
{
|
107
|
+
"name": "dev-libs/oniguruma"
|
108
|
+
}
|
109
|
+
],
|
110
|
+
"db_host": "external_db_master.compute-1.amazonaws.com",
|
111
|
+
"haproxy": {
|
112
|
+
"username": "HAPROXY-USERNAME",
|
113
|
+
"password": "HAPROXY-PASSWORD"
|
114
|
+
},
|
115
|
+
"engineyard": {
|
116
|
+
"environment": {
|
117
|
+
"apps": [
|
118
|
+
{
|
119
|
+
"name": "APP-NAME",
|
120
|
+
"newrelic": false,
|
121
|
+
"components": [
|
122
|
+
|
123
|
+
],
|
124
|
+
"database_name": "APPS-0-DATABASE_NAME",
|
125
|
+
"migration_command": "rake db:migrate",
|
126
|
+
"type": "rack",
|
127
|
+
"repository_name": "APPS-0-REPOSITORY_NAME",
|
128
|
+
"run_deploy": false,
|
129
|
+
"revision": "",
|
130
|
+
"bundled": null,
|
131
|
+
"branch": "HEAD",
|
132
|
+
"run_migrations": false,
|
133
|
+
"deploy_action": "deploy",
|
134
|
+
"deploy_key": "-----BEGIN RSA PRIVATE KEY-----\nAPPS-0-DEPLOY-KEY\n-----END RSA PRIVATE KEY-----\n",
|
135
|
+
"gems": [
|
136
|
+
{
|
137
|
+
"name": "rails",
|
138
|
+
"version": "3.0.0",
|
139
|
+
"source": null
|
140
|
+
}
|
141
|
+
],
|
142
|
+
"vhosts": [
|
143
|
+
{
|
144
|
+
"ssl_cert": null,
|
145
|
+
"domain_name": "_"
|
146
|
+
}
|
147
|
+
],
|
148
|
+
"ebuilds": [
|
149
|
+
{
|
150
|
+
"name": "dev-libs/oniguruma"
|
151
|
+
}
|
152
|
+
]
|
153
|
+
}
|
154
|
+
],
|
155
|
+
"aws_secret_key": "AWS-SECRET-KEY",
|
156
|
+
"name": "APP-NAME_production",
|
157
|
+
"ssh_keys": [
|
158
|
+
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-a",
|
159
|
+
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-b",
|
160
|
+
"ssh-rsa AAAAB3NzaC1yc2EAAAAB key-c"
|
161
|
+
],
|
162
|
+
"instances": [
|
163
|
+
{
|
164
|
+
"name": null,
|
165
|
+
"public_hostname": "app_master.compute-1.amazonaws.com",
|
166
|
+
"components": [
|
167
|
+
{
|
168
|
+
"key": "ssmtp"
|
169
|
+
}
|
170
|
+
],
|
171
|
+
"role": "app_master",
|
172
|
+
"enabled": true,
|
173
|
+
"id": "i-deadbeef",
|
174
|
+
"private_hostname": "internal_app_master.compute-1.internal",
|
175
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/abcde",
|
176
|
+
"awsm_token": "app_master-aws_token"
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"name": null,
|
180
|
+
"public_hostname": "app_1.compute-1.amazonaws.com",
|
181
|
+
"components": [
|
182
|
+
{
|
183
|
+
"key": "ssmtp"
|
184
|
+
}
|
185
|
+
],
|
186
|
+
"role": "app",
|
187
|
+
"enabled": true,
|
188
|
+
"id": "i-app_1",
|
189
|
+
"private_hostname": "internal_app_master.compute-1.internal",
|
190
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/abcde",
|
191
|
+
"awsm_token": "app_1-aws_token"
|
192
|
+
},
|
193
|
+
{
|
194
|
+
"name": null,
|
195
|
+
"public_hostname": "db_master.compute-1.amazonaws.com",
|
196
|
+
"components": [
|
197
|
+
{
|
198
|
+
"key": "ssmtp"
|
199
|
+
}
|
200
|
+
],
|
201
|
+
"role": "db_master",
|
202
|
+
"enabled": true,
|
203
|
+
"id": "i-db_master",
|
204
|
+
"private_hostname": "internal_db_master.compute-1.internal",
|
205
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/abcde",
|
206
|
+
"awsm_token": "db_master-aws_token"
|
207
|
+
},
|
208
|
+
{
|
209
|
+
"name": null,
|
210
|
+
"public_hostname": "db_slave_1.compute-1.amazonaws.com",
|
211
|
+
"components": [
|
212
|
+
{
|
213
|
+
"key": "ssmtp"
|
214
|
+
}
|
215
|
+
],
|
216
|
+
"role": "db_slave",
|
217
|
+
"enabled": true,
|
218
|
+
"id": "i-db_slave_1",
|
219
|
+
"private_hostname": "internal_db_slave_1.compute-1.internal",
|
220
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/abcde",
|
221
|
+
"awsm_token": "db_slave_1-aws_token"
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"name": "foobarfoo",
|
225
|
+
"public_hostname": "util_1.compute-1.amazonaws.com",
|
226
|
+
"components": [
|
227
|
+
{
|
228
|
+
"key": "ssmtp"
|
229
|
+
}
|
230
|
+
],
|
231
|
+
"role": "util",
|
232
|
+
"enabled": true,
|
233
|
+
"id": "i-util_1",
|
234
|
+
"private_hostname": "internal_util_1.compute-1.internal",
|
235
|
+
"reporting_url": "https://cloud.engineyard.com/reporting/abcde",
|
236
|
+
"awsm_token": "util_1-aws_token"
|
237
|
+
}
|
238
|
+
],
|
239
|
+
"stonith_endpoint": "https://cloud.engineyard.com/stonith",
|
240
|
+
"ruby_version": null,
|
241
|
+
"framework_env": "production",
|
242
|
+
"backup_interval": 24,
|
243
|
+
"admin_ssh_key": "ssh-rsa AAAAB3NzaC1 ey-cloud-production\n",
|
244
|
+
"internal_ssh_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB \n",
|
245
|
+
"ssh_username": "SSH-USERNAME",
|
246
|
+
"internal_ssh_private_key": "-----BEGIN RSA PRIVATE KEY-----\nINTERNAL-SSH-PRIVATE-KEY\n-----END RSA PRIVATE KEY-----\n",
|
247
|
+
"mailserver": "smtp.engineyard.com",
|
248
|
+
"components": [
|
249
|
+
{
|
250
|
+
"key": "ruby_187"
|
251
|
+
}
|
252
|
+
],
|
253
|
+
"stats_password": "STATS-PASSWORD",
|
254
|
+
"crons": [
|
255
|
+
|
256
|
+
],
|
257
|
+
"backup_window": 10,
|
258
|
+
"stack_name": "nginx_passenger",
|
259
|
+
"alert_email": "ALERT-EMAIL",
|
260
|
+
"ssh_password": "SSH-PASSWORD",
|
261
|
+
"db_stack_name": "mysql",
|
262
|
+
"aws_secret_id": "AWS-SECRET-ID",
|
263
|
+
"newrelic_key": null,
|
264
|
+
"monitoring": "monit"
|
265
|
+
},
|
266
|
+
"this": "i-deadbeef"
|
267
|
+
}
|
268
|
+
}
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: engineyard-metadata
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Seamus Abshere
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-09-24 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activesupport
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 11
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 3
|
33
|
+
- 4
|
34
|
+
version: 2.3.4
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: fakeweb
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: fakefs
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rspec
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ~>
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 1
|
74
|
+
segments:
|
75
|
+
- 1
|
76
|
+
version: "1"
|
77
|
+
type: :development
|
78
|
+
version_requirements: *id004
|
79
|
+
description: Pulls metadata from EC2 and EngineYard so that your EngineYard AppCloud (Amazon EC2) instances know about each other.
|
80
|
+
email: seamus@abshere.net
|
81
|
+
executables: []
|
82
|
+
|
83
|
+
extensions: []
|
84
|
+
|
85
|
+
extra_rdoc_files:
|
86
|
+
- LICENSE
|
87
|
+
- README.rdoc
|
88
|
+
files:
|
89
|
+
- .document
|
90
|
+
- .gitignore
|
91
|
+
- LICENSE
|
92
|
+
- README.rdoc
|
93
|
+
- Rakefile
|
94
|
+
- VERSION
|
95
|
+
- engineyard-metadata.gemspec
|
96
|
+
- lib/engineyard-metadata.rb
|
97
|
+
- lib/engineyard-metadata/amazon_ec2_api.rb
|
98
|
+
- lib/engineyard-metadata/chef_dna.rb
|
99
|
+
- lib/engineyard-metadata/metadata.rb
|
100
|
+
- spec/metadata_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
- spec/support/dna.json
|
103
|
+
has_rdoc: true
|
104
|
+
homepage: http://github.com/seamusabshere/engineyard-metadata
|
105
|
+
licenses: []
|
106
|
+
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options:
|
109
|
+
- --charset=UTF-8
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
version: "0"
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
version: "0"
|
130
|
+
requirements: []
|
131
|
+
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 1.3.7
|
134
|
+
signing_key:
|
135
|
+
specification_version: 3
|
136
|
+
summary: Make your EngineYard AppCloud (Amazon EC2) instances aware of each other.
|
137
|
+
test_files:
|
138
|
+
- spec/metadata_spec.rb
|
139
|
+
- spec/spec_helper.rb
|