ops_tasks 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -0
- data/.ruby-verion +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +49 -0
- data/README.md +81 -0
- data/bin/ops_tasks +31 -0
- data/lib/ops_tasks/rake_helper.rb +11 -8
- data/lib/ops_tasks/version.rb +1 -1
- data/ops_tasks.gemspec +27 -0
- metadata +28 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eab2ec03b9aa9a8741a9fb34d717617c578333a9
|
4
|
+
data.tar.gz: 5d815350ddaf2fdfa94b57a10d5a9bf74cb87880
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07f9941ac19f766c77d75816115f01bc2516afe0c662f72f313a7727b6813a9943184b006d45e93366844d2d043599ffea45eac648f5939c32fb72c064e36c0
|
7
|
+
data.tar.gz: 1205ec07abf44398422cb98231dfafdb68a34da804f3c4de7bc7553ff705d0be7c3bd1b44e77cf3b9da7e80742d291762adc881c623f9c09583532b543c8166e
|
data/.gitignore
ADDED
data/.ruby-verion
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.5
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in aws_deployment_tasks.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use a debugger
|
14
|
+
# gem 'byebug', group: [:development, :test]
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ops_tasks (0.4.3)
|
5
|
+
aws-sdk (~> 1)
|
6
|
+
dotenv (~> 0)
|
7
|
+
highline (~> 1)
|
8
|
+
say2slack (~> 0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
aws-sdk (1.64.0)
|
14
|
+
aws-sdk-v1 (= 1.64.0)
|
15
|
+
aws-sdk-v1 (1.64.0)
|
16
|
+
json (~> 1.4)
|
17
|
+
nokogiri (>= 1.4.4)
|
18
|
+
domain_name (0.5.24)
|
19
|
+
unf (>= 0.0.5, < 1.0.0)
|
20
|
+
dotenv (0.11.1)
|
21
|
+
dotenv-deployment (~> 0.0.2)
|
22
|
+
dotenv-deployment (0.0.2)
|
23
|
+
highline (1.6.21)
|
24
|
+
http-cookie (1.0.2)
|
25
|
+
domain_name (~> 0.5)
|
26
|
+
json (1.8.3)
|
27
|
+
mime-types (2.6.1)
|
28
|
+
mini_portile (0.6.2)
|
29
|
+
netrc (0.10.3)
|
30
|
+
nokogiri (1.6.6.2)
|
31
|
+
mini_portile (~> 0.6.0)
|
32
|
+
rest-client (1.8.0)
|
33
|
+
http-cookie (>= 1.0.2, < 2.0)
|
34
|
+
mime-types (>= 1.16, < 3.0)
|
35
|
+
netrc (~> 0.7)
|
36
|
+
say2slack (0.0.6)
|
37
|
+
rest-client (~> 1.8)
|
38
|
+
unf (0.1.4)
|
39
|
+
unf_ext
|
40
|
+
unf_ext (0.0.7.1)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
ops_tasks!
|
47
|
+
|
48
|
+
BUNDLED WITH
|
49
|
+
1.10.4
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# Ops Tasks
|
2
|
+
|
3
|
+
Provides your rails project with rake tasks for deploying to AWS via Opsworks
|
4
|
+
|
5
|
+
- Alerts Slack channel that deployment is starting
|
6
|
+
- Initiates a deployment on Opsworks
|
7
|
+
- Monitors deployment until completion
|
8
|
+
- Alerts Slack channel of result status for deployment
|
9
|
+
|
10
|
+
## Setup
|
11
|
+
|
12
|
+
#### Add gem & source
|
13
|
+
|
14
|
+
# Gemfile
|
15
|
+
gem 'ops_tasks'
|
16
|
+
|
17
|
+
#### Find your AWS IAM Credentials
|
18
|
+
|
19
|
+
If my AWS IAM user name was `Nick`
|
20
|
+
|
21
|
+
`https://console.aws.amazon.com/iam/home?region=us-east-1#users/Nick`
|
22
|
+
|
23
|
+
Then click 'Manage Access Keys' and create a new Access Key. The secret key will only be shown once. After that, you'll have to create a new one if you lose it.
|
24
|
+
|
25
|
+
#### Find your stack and instance IDs
|
26
|
+
|
27
|
+
These are listed on the settings or details page for stacks and instances, and they're called _Opsworks ID_.
|
28
|
+
|
29
|
+
|
30
|
+
#### Setup your environment variables as follows:
|
31
|
+
|
32
|
+
| variable name | description |
|
33
|
+
| --------------|-------------- |
|
34
|
+
| AWS_ACCESS_KEY_ID | your AWS access key id / API key |
|
35
|
+
| AWS_SECRET_ACCESS_KEY | your AWS secret key / API secret |
|
36
|
+
| AWS_REGION | region of AWS instance (should always be us-east-1) |
|
37
|
+
| production_layer_id | opsworks layer id for production servers |
|
38
|
+
| production_stack_id | opsworks stack id for production server |
|
39
|
+
| production_deploy_recipe | deployment recipe for production server (cookbook-name::recipe-name) |
|
40
|
+
| production_project_name | Project description used in hipchat alert ("App Name Production") |
|
41
|
+
| production_room_notifications | true or false; enable or disable slack alerts |
|
42
|
+
| production_slack_channel | Slack channel to alert of deployment |
|
43
|
+
| SLACK_API_TOKEN | API token for your slack team |
|
44
|
+
| SLACK_BOT_IMG | url for the icon that appears with the alert in slack. defaults to Bender. |
|
45
|
+
|
46
|
+
To add additional layers, just copy the above format, and change `production` to whatever you'd like to name it. The deploy task will automatically detect your configurations based on the environment variables you set.
|
47
|
+
|
48
|
+
```
|
49
|
+
your_server_name_layer_id
|
50
|
+
your_server_name_stack_id
|
51
|
+
your_server_name_deploy_recipe
|
52
|
+
your_server_name_project_name
|
53
|
+
your_server_name_slack_channel
|
54
|
+
your_server_name_room_notifications
|
55
|
+
```
|
56
|
+
|
57
|
+
You can use figaro or dotenv. I prefer figaro.
|
58
|
+
|
59
|
+
## Usage
|
60
|
+
|
61
|
+
### Update Cookbooks
|
62
|
+
|
63
|
+
rake staging:update_cookbooks
|
64
|
+
rake production:update_cookbooks
|
65
|
+
|
66
|
+
### Deploy to AWS
|
67
|
+
|
68
|
+
bundle exec rake deploy
|
69
|
+
|
70
|
+
Select a server...
|
71
|
+
1. staging
|
72
|
+
2. production
|
73
|
+
3. realtime
|
74
|
+
4. sidekiq
|
75
|
+
5. quit
|
76
|
+
? 4
|
77
|
+
Sidekiq Server: Preparing deployment... successful
|
78
|
+
Sidekiq Server: Running... successful
|
79
|
+
|
80
|
+
|
81
|
+
|
data/bin/ops_tasks
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'ops_tasks'
|
4
|
+
require 'highline/import'
|
5
|
+
require 'dotenv'
|
6
|
+
|
7
|
+
Dotenv.load
|
8
|
+
|
9
|
+
if ARGV[0] == 'init'
|
10
|
+
`touch .env`
|
11
|
+
`echo 'AWS_ACCESS_KEY_ID=' > .env`
|
12
|
+
`echo 'AWS_SECRET_ACCESS_KEY=' >> .env`
|
13
|
+
`echo 'production_deploy_recipe=' >> .env`
|
14
|
+
`echo 'production_stack_id=' >> .env`
|
15
|
+
`echo 'production_layer_id=' >> .env`
|
16
|
+
`echo 'production_project_name=' >> .env`
|
17
|
+
`echo 'production_slack_channel=' >> .env`
|
18
|
+
elsif ARGV[0] == 'add'
|
19
|
+
|
20
|
+
`echo "\n#{ARGV[1]}_deploy_recipe=" >> .env`
|
21
|
+
`echo "#{ARGV[1]}_stack_id=" >> .env`
|
22
|
+
`echo "#{ARGV[1]}_layer_id=" >> .env`
|
23
|
+
`echo "#{ARGV[1]}_project_name=" >> .env`
|
24
|
+
`echo "#{ARGV[1]}_slack_channel=" >> .env`
|
25
|
+
elsif ARGV.size.zero?
|
26
|
+
puts "ops_tasks [deploy|update_cookbooks|setup|configure|init] <args>"
|
27
|
+
else
|
28
|
+
deployment = OpsTasks::RakeHelper.create_deployment
|
29
|
+
deploy_id = deployment.send(ARGV[0].to_sym)
|
30
|
+
deployment.wait_for_completion(deploy_id, ARGV[0].gsub(/\s/, '_'))
|
31
|
+
end
|
@@ -20,17 +20,20 @@ module OpsTasks
|
|
20
20
|
if servers.size > 1
|
21
21
|
@server_type = nil
|
22
22
|
say("\nSelect a server...")
|
23
|
-
|
24
|
-
servers.each do |server|
|
25
|
-
menu.choice server do @server_type = server end
|
26
|
-
end
|
27
|
-
menu.choice "quit" do exit end
|
28
|
-
end
|
23
|
+
show_menu(servers)
|
29
24
|
else
|
30
25
|
@server_type = servers.first
|
31
26
|
end
|
32
|
-
|
33
|
-
|
27
|
+
@server_type
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.show_menu(servers)
|
31
|
+
choose do |menu|
|
32
|
+
servers.each do |server|
|
33
|
+
menu.choice server do @server_type = server end
|
34
|
+
end
|
35
|
+
menu.choice "quit" do exit end
|
36
|
+
end
|
34
37
|
end
|
35
38
|
|
36
39
|
def self.create_deployment
|
data/lib/ops_tasks/version.rb
CHANGED
data/ops_tasks.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "ops_tasks/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "ops_tasks"
|
9
|
+
s.version = OpsTasks::VERSION
|
10
|
+
s.authors = ["Nick Prokesch"]
|
11
|
+
s.email = ["nick@prokes.ch"]
|
12
|
+
s.homepage = "http://nick.prokes.ch"
|
13
|
+
s.summary = "AWS Opsworks Commands"
|
14
|
+
s.description = "AWS Opsworks Rake & CLI Tasks for Deployment"
|
15
|
+
s.license = "MIT"
|
16
|
+
s.executables = ["ops_tasks"]
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split($\)
|
19
|
+
s.test_files = Dir["test/**/*"]
|
20
|
+
|
21
|
+
# s.add_dependency "rails", "~> 4"
|
22
|
+
s.add_dependency "aws-sdk", "~> 1"
|
23
|
+
s.add_dependency "say2slack", "~> 0"
|
24
|
+
s.add_dependency "highline", "~> 1"
|
25
|
+
s.add_dependency "dotenv", "~> 0"
|
26
|
+
|
27
|
+
end
|
metadata
CHANGED
@@ -1,86 +1,94 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ops_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Prokesch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: aws-sdk
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: say2slack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: highline
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: dotenv
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: Opsworks Rake Tasks for Deployment
|
69
|
+
description: AWS Opsworks Rake & CLI Tasks for Deployment
|
70
70
|
email:
|
71
71
|
- nick@prokes.ch
|
72
|
-
executables:
|
72
|
+
executables:
|
73
|
+
- ops_tasks
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
75
76
|
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".ruby-verion"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
76
81
|
- MIT-LICENSE
|
82
|
+
- README.md
|
77
83
|
- Rakefile
|
84
|
+
- bin/ops_tasks
|
78
85
|
- lib/ops_tasks.rb
|
79
86
|
- lib/ops_tasks/deployment.rb
|
80
87
|
- lib/ops_tasks/railtie.rb
|
81
88
|
- lib/ops_tasks/rake_helper.rb
|
82
89
|
- lib/ops_tasks/version.rb
|
83
90
|
- lib/tasks/ops_tasks.rake
|
91
|
+
- ops_tasks.gemspec
|
84
92
|
homepage: http://nick.prokes.ch
|
85
93
|
licenses:
|
86
94
|
- MIT
|
@@ -101,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
109
|
version: '0'
|
102
110
|
requirements: []
|
103
111
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.2.2
|
105
113
|
signing_key:
|
106
114
|
specification_version: 4
|
107
|
-
summary: Opsworks
|
115
|
+
summary: AWS Opsworks Commands
|
108
116
|
test_files: []
|