capistrano-opsworks 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +1 -0
- data/capistrano-opsworks.gemspec +24 -0
- data/lib/capistrano/opsworks.rb +2 -0
- data/lib/capistrano/opsworks/version.rb +5 -0
- data/lib/capistrano/recipes/deploy/strategy/opsworks.rb +89 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTg2NzkxMjlmN2UyMTU4ZGRkOGJhMmVjMTlhZTMwZjQ5MjIxYTY3NQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NmZiOWQ1ODhhZjBkNTQyMTViOGZlYjc0ZmFkYjc3MTQxMzQzZWRkMg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTM5YzFjNWEyYzE3Mzc3ZGRiNWMyMDk3NDRjYmZlMTAwNWEwYzRlZjZkZTRj
|
10
|
+
M2VjNjRmYzQ5NjUzOWI3ZGEzZDRmNGIyNWEzMzJiMDNhZDAzMTY0MzY0OTIw
|
11
|
+
MzI4ZWZjZjUyOTllYWQ5NDk2MmJmMTdmODQzYTRjZjI0NmQ1NDU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDdhOTg2MTNmMDBlMDE3YTg1NDFiOGRlMzE5M2ZiZGJkYTE1ZTlkZGFmNzI1
|
14
|
+
MmMyYTIzMWYwNjU2MjBmZDVhMmJjNmU1ODc0NTY5MTNjOGFiOThmZjFlNjc4
|
15
|
+
YzJjNzFhNDc3YTgzNzNkNzhhMjA3NGQyMzk4NmFmZmM5ODE4ODQ=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Brian Muse
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Capistrano Opsworks
|
2
|
+
|
3
|
+
This gem allows you to trigger opsworks deployments from a remote capistrano project
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'capistrano-opsworks'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install capistrano-opsworks
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Add the following to your deploy script:
|
22
|
+
```Ruby
|
23
|
+
set :deploy_via, :opsworks
|
24
|
+
require 'capistrano/opsworks'
|
25
|
+
```
|
26
|
+
|
27
|
+
The opsworks strategy overwrites the built in deployment tasks, so you should only `require 'capistrano/opsworks'` if you are using the opsworks deployment strategy.
|
28
|
+
|
29
|
+
The following options are allowed:
|
30
|
+
```Ruby
|
31
|
+
set :aws_key_id, '[string]' #required
|
32
|
+
set :aws_secret_key, '[string]' #required
|
33
|
+
set :app_id, '[string]' #required
|
34
|
+
set :command_name, '[string]' #required (eg. 'deploy')
|
35
|
+
set :stack_id, '[string]' #required
|
36
|
+
|
37
|
+
set :instance_ids, '[array]' #optional
|
38
|
+
set :command_args, '[hash]' #optional
|
39
|
+
set :comment, '[string]' #optional
|
40
|
+
set :custom_json, '[string]' #optional
|
41
|
+
```
|
42
|
+
|
43
|
+
## Contributors
|
44
|
+
* [Brian Muse](https://github.com/brianmuse)
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capistrano/opsworks/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capistrano-opsworks"
|
8
|
+
spec.version = Capistrano::Opsworks::VERSION
|
9
|
+
spec.authors = ["Brian Muse"]
|
10
|
+
spec.email = ["brian@onemightyroar.com"]
|
11
|
+
spec.description = "Opsworks deployment trigger for capistrano"
|
12
|
+
spec.summary = "Allows you to trigger a deployment for an opsworks application from a remote capistrano project"
|
13
|
+
spec.homepage = "http://brianmuse.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_runtime_dependency "aws-sdk"
|
24
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'capistrano/recipes/deploy/strategy/base'
|
2
|
+
require 'aws-sdk'
|
3
|
+
|
4
|
+
module Capistrano
|
5
|
+
module Deploy
|
6
|
+
module Strategy
|
7
|
+
class Opsworks < Base
|
8
|
+
def deploy!
|
9
|
+
if exists?(:aws_key_id) && exists?(:aws_secret_key)
|
10
|
+
AWS.config({
|
11
|
+
:access_key_id => configuration[:aws_key_id],
|
12
|
+
:secret_access_key => configuration[:aws_secret_key],
|
13
|
+
})
|
14
|
+
else
|
15
|
+
abort "aws_key_id and aws_secret_key are required"
|
16
|
+
end
|
17
|
+
|
18
|
+
opsworks = AWS::OpsWorks.new
|
19
|
+
|
20
|
+
if exists?(:stack_id) && exists?(:app_id) && exists?(:command_name)
|
21
|
+
valid_options = [
|
22
|
+
"stack_id",
|
23
|
+
"app_id",
|
24
|
+
"instance_ids",
|
25
|
+
"comment",
|
26
|
+
"custom_json"
|
27
|
+
]
|
28
|
+
|
29
|
+
aws_params = {}
|
30
|
+
|
31
|
+
valid_options.each { |x|
|
32
|
+
sym = x.to_sym
|
33
|
+
if exists?(sym)
|
34
|
+
aws_params[sym] = configuration[sym]
|
35
|
+
end
|
36
|
+
}
|
37
|
+
|
38
|
+
aws_params[:command] = {}
|
39
|
+
aws_params[:command][:name] = configuration[:command_name]
|
40
|
+
|
41
|
+
if exists?(:command_args)
|
42
|
+
aws_params[:command][:args] = configuration[:command_args]
|
43
|
+
end
|
44
|
+
else
|
45
|
+
abort "command_name, app_id, and stack_id are required"
|
46
|
+
end
|
47
|
+
|
48
|
+
opsworks.client.create_deployment(aws_params)
|
49
|
+
end
|
50
|
+
|
51
|
+
def check!
|
52
|
+
end
|
53
|
+
|
54
|
+
protected
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
Capistrano::Configuration.instance(true).load do
|
62
|
+
# We need to override the core deployment tasks so they use opsworks instead.
|
63
|
+
namespace :deploy do
|
64
|
+
desc <<-DESC
|
65
|
+
deploy
|
66
|
+
DESC
|
67
|
+
task :default do
|
68
|
+
on_rollback { run "There was a problem. Check opsworks logs for more." }
|
69
|
+
strategy.deploy!
|
70
|
+
end
|
71
|
+
|
72
|
+
desc <<-DESC
|
73
|
+
Clean up
|
74
|
+
DESC
|
75
|
+
task :cleanup, :except => { :no_release => true } do
|
76
|
+
puts "nothing to cleanup..."
|
77
|
+
end
|
78
|
+
|
79
|
+
namespace :rollback do
|
80
|
+
desc <<-DESC
|
81
|
+
Rolling things back
|
82
|
+
DESC
|
83
|
+
task :default do
|
84
|
+
puts "Nothing to do here"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-opsworks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Muse
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aws-sdk
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Opsworks deployment trigger for capistrano
|
56
|
+
email:
|
57
|
+
- brian@onemightyroar.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- capistrano-opsworks.gemspec
|
68
|
+
- lib/capistrano/opsworks.rb
|
69
|
+
- lib/capistrano/opsworks/version.rb
|
70
|
+
- lib/capistrano/recipes/deploy/strategy/opsworks.rb
|
71
|
+
homepage: http://brianmuse.com
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.0.6
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Allows you to trigger a deployment for an opsworks application from a remote
|
95
|
+
capistrano project
|
96
|
+
test_files: []
|