simple_deploy 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -13,9 +13,7 @@ Create a file **~/.simple_deploy.yml** and include within it:
13
13
 
14
14
  ```
15
15
  deploy:
16
- gateway: ADMIN_IP_TO_YOUR_VPC
17
- user: SSH_USER_TO_GATEWAY_AND_INSTANCES
18
- key: PRIVATE_SSH_KEYFILE_FOR_USER
16
+ script: /opt/intu/admin/bin/configure.sh
19
17
  artifacts:
20
18
  - name: live_community_chef_repo
21
19
  bucket_prefix: intu-lc
@@ -29,7 +27,6 @@ deploy:
29
27
  bucket_prefix: intu-artifacts
30
28
  variable: COOKBOOKS_URL
31
29
  cloud_formation_url: CookbooksURL
32
- script: /opt/intu/admin/bin/configure.sh
33
30
 
34
31
  environments:
35
32
  preprod_shared_us_west_1:
@@ -71,3 +68,10 @@ simple_deploy create -t ~/my-template.json -e my-env -n test-stack -a arg1=val1
71
68
  ```
72
69
 
73
70
  For more information, run simple_deploy -h.
71
+
72
+ Deploying
73
+ ---------
74
+
75
+ By default simple deploy will use your user name and id_rsa key for deployments. To override either these, set the **SIMPLE_DEPLOY_SSH_USER** & **SIMPLE_DEPLOY_SSH_KEY** respectively.
76
+
77
+ The deployment gateway is ready from the **ssh_gateway** attribute for that stack.
@@ -2,7 +2,7 @@ module SimpleDeploy
2
2
  module CLI
3
3
  def self.attributes
4
4
  attrs = []
5
- puts "Read the following attributes:"
5
+ puts "\nRead the following attributes:\n\n"
6
6
  read_attributes.each do |attribs|
7
7
  key = attribs.split('=').first.gsub(/\s+/, "")
8
8
  value = attribs.gsub(/^.+?=/, '')
@@ -77,7 +77,6 @@ EOS
77
77
  puts "#{@opts[:name]} destroyed."
78
78
  when 'deploy'
79
79
  @stack.deploy
80
- puts "#{@opts[:name]} deployed."
81
80
  when 'environments'
82
81
  Config.new.environments.keys.each { |e| puts e }
83
82
  when 'update'
@@ -24,18 +24,6 @@ module SimpleDeploy
24
24
  config['environments']
25
25
  end
26
26
 
27
- def gateway(name)
28
- environments[name]['gateway']
29
- end
30
-
31
- def key(name)
32
- environments[name]['key'] ||= "#{env_home}/.ssh/id_rsa"
33
- end
34
-
35
- def user(name)
36
- environments[name]['user'] ||= "#{env_user}"
37
- end
38
-
39
27
  def environment(name)
40
28
  environments[name]
41
29
  end
@@ -6,6 +6,9 @@ module SimpleDeploy
6
6
  def initialize(args)
7
7
  @config = args[:config]
8
8
  @instances = args[:instances]
9
+ @ssh_gateway = args[:ssh_gateway]
10
+ @ssh_user = args[:ssh_user] ||= "#{env_user}"
11
+ @ssh_key = args[:ssh_key] ||= "#{env_home}/.ssh/id_rsa"
9
12
  @environment = args[:environment]
10
13
  @attributes = args[:attributes]
11
14
  @logger = @config.logger
@@ -18,8 +21,9 @@ module SimpleDeploy
18
21
  end
19
22
 
20
23
  def execute
21
- @logger.info 'Starting Deployment.'
24
+ @logger.info 'Starting deployment.'
22
25
  @deployment.simpledeploy
26
+ @logger.info 'Deployment complete.'
23
27
  end
24
28
 
25
29
  private
@@ -56,32 +60,45 @@ module SimpleDeploy
56
60
  end
57
61
 
58
62
  def ssh_options
59
- @logger.info "Setting key to #{@config.key(@environment)}."
63
+ @logger.info "Setting key to #{@ssh_key}."
60
64
  {
61
- :keys => @config.key(@environment),
65
+ :keys => @ssh_key,
62
66
  :paranoid => false
63
67
  }
64
68
  end
65
69
 
66
70
  def create_deployment
67
71
  @deployment = Capistrano::Configuration.new
68
- if @config.user(@environment)
69
- @logger.info "Setting user to #{@config.user(@environment)}."
70
- @deployment.set :user, @config.user(@environment)
72
+ if @ssh_user
73
+ @logger.info "Setting user to #{@ssh_user}."
74
+ @deployment.set :user, @ssh_user
71
75
  end
72
76
 
73
- if @config.gateway(@environment)
74
- @deployment.set :gateway, @config.gateway(@environment)
77
+ if @ssh_gateway
78
+ @deployment.set :gateway, @ssh_gateway
79
+ @logger.info "Proxying via gateway #{@ssh_gateway}."
80
+ else
81
+ @logger.info "Not using an ssh gateway."
75
82
  end
76
83
 
77
84
  @deployment.variables[:ssh_options] = ssh_options
78
- @logger.info "Proxying via gateway #{@config.gateway(@environment)}."
79
85
 
80
86
  @instances.each do |i|
81
87
  @logger.info "Adding instance #{i}."
82
88
  @deployment.server i, :instances
83
89
  end
84
90
  end
91
+
92
+ private
93
+
94
+ def env_home
95
+ ENV['HOME']
96
+ end
97
+
98
+ def env_user
99
+ ENV['USER']
100
+ end
101
+
85
102
  end
86
103
  end
87
104
 
@@ -33,10 +33,13 @@ module SimpleDeploy
33
33
  end
34
34
 
35
35
  def deploy
36
- deployment = Deployment.new :config => @config,
36
+ deployment = Deployment.new :config => @config,
37
37
  :environment => @environment,
38
- :instances => instances,
39
- :attributes => attributes
38
+ :instances => instances,
39
+ :attributes => attributes,
40
+ :ssh_gateway => stack.attributes['ssh_gateway'],
41
+ :ssh_user => ENV['SIMPLE_DEPLOY_SSH_USER'],
42
+ :ssh_key => ENV['SIMPLE_DEPLOY_SSH_KEY']
40
43
  deployment.execute
41
44
  end
42
45
 
@@ -85,7 +88,8 @@ module SimpleDeploy
85
88
  def stack
86
89
  @stack ||= Stackster::Stack.new :environment => @environment,
87
90
  :name => @name,
88
- :config => @config.environment(@environment)
91
+ :config => @config.environment(@environment),
92
+ :logger => @config.logger
89
93
  end
90
94
 
91
95
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleDeploy
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-25 00:00:00.000000000 Z
12
+ date: 2012-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70297023524640 !ruby/object:Gem::Requirement
16
+ requirement: &70329905934420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70297023524640
24
+ version_requirements: *70329905934420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: capistrano
27
- requirement: &70297023523820 !ruby/object:Gem::Requirement
27
+ requirement: &70329905903420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70297023523820
35
+ version_requirements: *70329905903420
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: stackster
38
- requirement: &70297023523260 !ruby/object:Gem::Requirement
38
+ requirement: &70329905902740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.2.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70297023523260
46
+ version_requirements: *70329905902740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: trollop
49
- requirement: &70297023522820 !ruby/object:Gem::Requirement
49
+ requirement: &70329905902000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70297023522820
57
+ version_requirements: *70329905902000
58
58
  description: I am designed to deploy artifacts uploaded by Heirloom
59
59
  email:
60
60
  - brett@weav.net
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: -4243280396597296498
103
+ hash: 2141148440395606588
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: -4243280396597296498
112
+ hash: 2141148440395606588
113
113
  requirements: []
114
114
  rubyforge_project: simple_deploy
115
115
  rubygems_version: 1.8.16