standup 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ ### Standup
2
+
3
+ Standup is an application deployment and infrastructure management tool for Rails and Amazon EC2.
4
+
5
+ ## Basic usage
6
+
7
+ 0. Add `gem 'standup'` into Gemfile and install it via `> bundle install`
8
+ 0. `> standup init`
9
+ 0. Write actual settings in generated `config/standup.yml`
10
+ 0. `> standup setup`
11
+ 0. `> standup status`
12
+
13
+ ## Tweaking default scripts
14
+
15
+ 0. `> standup localize SCRIPT=<script_name>`
16
+ 0. Script file `config/standup/<script_name>.rb` will be copied from gem.
17
+ 0. Script's own files, like configs etc. under `config/standup/<script_name>`, if any, will be copied from gem too.
18
+ 0. You can edit them and standup will use them instead of default.
19
+ 0. You can delete local script's own files, then default ones will be used.
20
+
21
+ ## Creating new scripts
22
+
23
+ 0. `> standup generate SCRIPT=<script_name>`
24
+ 0. Script file `config/standup/<script_name>.rb` will be created with empty script stub.
25
+ 0. Edit it as you want, it's now available for standup.
26
+
27
+ ## Setup script
28
+
29
+ Setup script is just common Rails application deployment workflow.
30
+
31
+ If you just want to add your script into this workflow, just set it as script param, thus overwriting default.
32
+
33
+ For example, if you want to add `rescue` to your configuration, you need to:
34
+
35
+ 0. Write that `rescue` script
36
+ 0. Change standup.yml like the following:
37
+
38
+ nodes:
39
+ main:
40
+ ...
41
+ setup:
42
+ ec2 basics ruby postgresql passenger rescue webapp update
43
+
44
+ ## To do
45
+
46
+ - Allow Rails environment specification other than production (make it param)
47
+
48
+ - If there is more than one node in standup.yml, require node name(s) or `all` explicitly set:
49
+ `standup shell web`
50
+ `standup update db,web`
51
+ `standup setup all`
52
+
53
+ - **?** Script sequences: rework default script as script sequence
54
+
55
+ ## Copyright
56
+
57
+ Copyright (c) 2010 Ilia Ablamonov, Cloud Castle Inc.
58
+ See LICENSE for details.
data/Rakefile CHANGED
@@ -6,16 +6,20 @@ begin
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = 'standup'
8
8
  gem.summary = %Q{Standup is an application deployment and infrastructure management tool for Rails and Amazon EC2}
9
- gem.description = %Q{}
10
9
  gem.email = 'ilia@flamefork.ru'
11
10
  gem.homepage = 'http://github.com/Flamefork/standup'
12
11
  gem.authors = ['Ilia Ablamonov', 'Cloud Castle Inc.']
12
+
13
+ gem.add_dependency 'trollop', '>= 1.16'
13
14
  gem.add_dependency 'activesupport', '>= 3.0'
14
15
  gem.add_dependency 'settingslogic', '>= 2.0'
15
16
  gem.add_dependency 'amazon-ec2', '>= 0.9'
16
17
  gem.add_dependency 'aws-s3', '>= 0.5'
17
18
  gem.add_dependency 'net-ssh', '>= 2.0'
18
19
  gem.add_dependency 'highline', '>= 1.5.2'
20
+
21
+ gem.executables = ['standup']
22
+
19
23
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
24
  end
21
25
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/bin/standup ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'trollop'
5
+ require 'standup'
6
+
7
+ opt_parser = Trollop::Parser.new do
8
+ banner 'Standup is an application deployment and infrastructure management tool for Rails and Amazon EC2.'
9
+ banner ''
10
+ banner 'Usage:'
11
+ banner ' standup script [options]'
12
+ banner ''
13
+ banner 'where script is one of the following:'
14
+ banner ''
15
+
16
+ offset = Standup.scripts.keys.map(&:length).max + 2
17
+ Standup.scripts.each do |name, script|
18
+ banner "#{"%-#{offset}s" % name} #{script.description}"
19
+ end
20
+
21
+ banner ''
22
+ banner "and [options] are:"
23
+ banner ''
24
+
25
+ stop_on Standup.scripts.keys
26
+ end
27
+
28
+ Trollop::with_standard_exception_handling opt_parser do
29
+ opt_parser.parse ARGV
30
+ raise Trollop::HelpNeeded if ARGV.empty?
31
+ end
32
+
33
+ exit if ARGV.empty?
34
+
35
+ script_name = ARGV.shift
36
+
37
+ if Standup.scripts.include? script_name
38
+ Standup.nodes.each {|node| node.run_script script_name}
39
+ else
40
+ opt_parser.die "unknown script #{script_name}", nil
41
+ end
data/lib/standup.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'active_support/all'
1
2
  require 'settingslogic'
2
3
  require 'AWS'
3
4
  require 'aws/s3'
@@ -5,7 +6,6 @@ require 'net/ssh'
5
6
  require 'highline'
6
7
 
7
8
  require 'standup/core_ext'
8
- require 'standup/railtie'
9
9
  require 'standup/settings'
10
10
  require 'standup/ec2'
11
11
  require 'standup/remoting'
@@ -24,7 +24,7 @@ module Standup
24
24
  end
25
25
 
26
26
  def self.local_scripts_path
27
- File.expand_path('config/standup', Rails.root) rescue nil
27
+ File.expand_path('config/standup') rescue nil
28
28
  end
29
29
 
30
30
  def self.scripts
@@ -0,0 +1,7 @@
1
+ Standup.script do
2
+ self.description = 'Run remote Rails application console'
3
+
4
+ def run
5
+ Kernel.exec "#{node.ssh_string} -t 'cd /opt/webapp && rails console production'".tap(&:bright_p)
6
+ end
7
+ end
data/scripts/init.rb CHANGED
@@ -2,6 +2,6 @@ Standup.script do
2
2
  self.description = 'Generate config file'
3
3
 
4
4
  def run
5
- FileUtils.copy script_file('standup.yml'), File.expand_path('config', Rails.root)
5
+ FileUtils.copy script_file('standup.yml'), File.expand_path('config')
6
6
  end
7
7
  end
data/scripts/shell.rb ADDED
@@ -0,0 +1,7 @@
1
+ Standup.script do
2
+ self.description = 'Run remote shell (e.g. bash)'
3
+
4
+ def run
5
+ Kernel.exec "#{node.ssh_string} -t".tap(&:bright_p)
6
+ end
7
+ end
data/standup.gemspec CHANGED
@@ -5,23 +5,25 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{standup}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ilia Ablamonov", "Cloud Castle Inc."]
12
- s.date = %q{2010-11-03}
13
- s.description = %q{}
12
+ s.date = %q{2010-11-09}
13
+ s.default_executable = %q{standup}
14
14
  s.email = %q{ilia@flamefork.ru}
15
+ s.executables = ["standup"]
15
16
  s.extra_rdoc_files = [
16
17
  "LICENSE",
17
- "README.rdoc"
18
+ "README.md"
18
19
  ]
19
20
  s.files = [
20
21
  ".gitignore",
21
22
  "LICENSE",
22
- "README.rdoc",
23
+ "README.md",
23
24
  "Rakefile",
24
25
  "VERSION",
26
+ "bin/standup",
25
27
  "lib/standup.rb",
26
28
  "lib/standup/core_ext.rb",
27
29
  "lib/standup/ec2.rb",
@@ -31,12 +33,11 @@ Gem::Specification.new do |s|
31
33
  "lib/standup/ec2/security_group.rb",
32
34
  "lib/standup/ec2/volume.rb",
33
35
  "lib/standup/node.rb",
34
- "lib/standup/railtie.rb",
35
36
  "lib/standup/remoting.rb",
36
37
  "lib/standup/scripts/base.rb",
37
38
  "lib/standup/settings.rb",
38
- "lib/tasks/standup.rake",
39
39
  "scripts/allocate_ip.rb",
40
+ "scripts/appconsole.rb",
40
41
  "scripts/basics.rb",
41
42
  "scripts/ec2.rb",
42
43
  "scripts/generate.rb",
@@ -51,6 +52,7 @@ Gem::Specification.new do |s|
51
52
  "scripts/postgresql/postgresql.conf",
52
53
  "scripts/ruby.rb",
53
54
  "scripts/setup.rb",
55
+ "scripts/shell.rb",
54
56
  "scripts/status.rb",
55
57
  "scripts/terminate.rb",
56
58
  "scripts/update.rb",
@@ -69,6 +71,7 @@ Gem::Specification.new do |s|
69
71
  s.specification_version = 3
70
72
 
71
73
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
74
+ s.add_runtime_dependency(%q<trollop>, [">= 1.16"])
72
75
  s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
73
76
  s.add_runtime_dependency(%q<settingslogic>, [">= 2.0"])
74
77
  s.add_runtime_dependency(%q<amazon-ec2>, [">= 0.9"])
@@ -76,6 +79,7 @@ Gem::Specification.new do |s|
76
79
  s.add_runtime_dependency(%q<net-ssh>, [">= 2.0"])
77
80
  s.add_runtime_dependency(%q<highline>, [">= 1.5.2"])
78
81
  else
82
+ s.add_dependency(%q<trollop>, [">= 1.16"])
79
83
  s.add_dependency(%q<activesupport>, [">= 3.0"])
80
84
  s.add_dependency(%q<settingslogic>, [">= 2.0"])
81
85
  s.add_dependency(%q<amazon-ec2>, [">= 0.9"])
@@ -84,6 +88,7 @@ Gem::Specification.new do |s|
84
88
  s.add_dependency(%q<highline>, [">= 1.5.2"])
85
89
  end
86
90
  else
91
+ s.add_dependency(%q<trollop>, [">= 1.16"])
87
92
  s.add_dependency(%q<activesupport>, [">= 3.0"])
88
93
  s.add_dependency(%q<settingslogic>, [">= 2.0"])
89
94
  s.add_dependency(%q<amazon-ec2>, [">= 0.9"])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ilia Ablamonov
@@ -16,13 +16,28 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-03 00:00:00 +03:00
20
- default_executable:
19
+ date: 2010-11-09 00:00:00 +03:00
20
+ default_executable: standup
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: activesupport
23
+ name: trollop
24
24
  prerelease: false
25
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 47
31
+ segments:
32
+ - 1
33
+ - 16
34
+ version: "1.16"
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: activesupport
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
26
41
  none: false
27
42
  requirements:
28
43
  - - ">="
@@ -33,11 +48,11 @@ dependencies:
33
48
  - 0
34
49
  version: "3.0"
35
50
  type: :runtime
36
- version_requirements: *id001
51
+ version_requirements: *id002
37
52
  - !ruby/object:Gem::Dependency
38
53
  name: settingslogic
39
54
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
55
+ requirement: &id003 !ruby/object:Gem::Requirement
41
56
  none: false
42
57
  requirements:
43
58
  - - ">="
@@ -48,11 +63,11 @@ dependencies:
48
63
  - 0
49
64
  version: "2.0"
50
65
  type: :runtime
51
- version_requirements: *id002
66
+ version_requirements: *id003
52
67
  - !ruby/object:Gem::Dependency
53
68
  name: amazon-ec2
54
69
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
70
+ requirement: &id004 !ruby/object:Gem::Requirement
56
71
  none: false
57
72
  requirements:
58
73
  - - ">="
@@ -63,11 +78,11 @@ dependencies:
63
78
  - 9
64
79
  version: "0.9"
65
80
  type: :runtime
66
- version_requirements: *id003
81
+ version_requirements: *id004
67
82
  - !ruby/object:Gem::Dependency
68
83
  name: aws-s3
69
84
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
85
+ requirement: &id005 !ruby/object:Gem::Requirement
71
86
  none: false
72
87
  requirements:
73
88
  - - ">="
@@ -78,11 +93,11 @@ dependencies:
78
93
  - 5
79
94
  version: "0.5"
80
95
  type: :runtime
81
- version_requirements: *id004
96
+ version_requirements: *id005
82
97
  - !ruby/object:Gem::Dependency
83
98
  name: net-ssh
84
99
  prerelease: false
85
- requirement: &id005 !ruby/object:Gem::Requirement
100
+ requirement: &id006 !ruby/object:Gem::Requirement
86
101
  none: false
87
102
  requirements:
88
103
  - - ">="
@@ -93,11 +108,11 @@ dependencies:
93
108
  - 0
94
109
  version: "2.0"
95
110
  type: :runtime
96
- version_requirements: *id005
111
+ version_requirements: *id006
97
112
  - !ruby/object:Gem::Dependency
98
113
  name: highline
99
114
  prerelease: false
100
- requirement: &id006 !ruby/object:Gem::Requirement
115
+ requirement: &id007 !ruby/object:Gem::Requirement
101
116
  none: false
102
117
  requirements:
103
118
  - - ">="
@@ -109,22 +124,23 @@ dependencies:
109
124
  - 2
110
125
  version: 1.5.2
111
126
  type: :runtime
112
- version_requirements: *id006
113
- description: ""
127
+ version_requirements: *id007
128
+ description:
114
129
  email: ilia@flamefork.ru
115
- executables: []
116
-
130
+ executables:
131
+ - standup
117
132
  extensions: []
118
133
 
119
134
  extra_rdoc_files:
120
135
  - LICENSE
121
- - README.rdoc
136
+ - README.md
122
137
  files:
123
138
  - .gitignore
124
139
  - LICENSE
125
- - README.rdoc
140
+ - README.md
126
141
  - Rakefile
127
142
  - VERSION
143
+ - bin/standup
128
144
  - lib/standup.rb
129
145
  - lib/standup/core_ext.rb
130
146
  - lib/standup/ec2.rb
@@ -134,12 +150,11 @@ files:
134
150
  - lib/standup/ec2/security_group.rb
135
151
  - lib/standup/ec2/volume.rb
136
152
  - lib/standup/node.rb
137
- - lib/standup/railtie.rb
138
153
  - lib/standup/remoting.rb
139
154
  - lib/standup/scripts/base.rb
140
155
  - lib/standup/settings.rb
141
- - lib/tasks/standup.rake
142
156
  - scripts/allocate_ip.rb
157
+ - scripts/appconsole.rb
143
158
  - scripts/basics.rb
144
159
  - scripts/ec2.rb
145
160
  - scripts/generate.rb
@@ -154,6 +169,7 @@ files:
154
169
  - scripts/postgresql/postgresql.conf
155
170
  - scripts/ruby.rb
156
171
  - scripts/setup.rb
172
+ - scripts/shell.rb
157
173
  - scripts/status.rb
158
174
  - scripts/terminate.rb
159
175
  - scripts/update.rb
data/README.rdoc DELETED
@@ -1,8 +0,0 @@
1
- = Standup
2
-
3
- Standup is an application deployment and infrastructure management tool for Rails and Amazon EC2.
4
-
5
- == Copyright
6
-
7
- Copyright (c) 2010 Ilia Ablamonov, Cloud Castle Inc.
8
- See LICENSE for details.
@@ -1,10 +0,0 @@
1
- require 'standup'
2
- require 'rails'
3
-
4
- module Standup
5
- class Railtie < Rails::Railtie
6
- rake_tasks do
7
- load 'tasks/standup.rake'
8
- end
9
- end
10
- end
@@ -1,19 +0,0 @@
1
- desc "List standup scripts"
2
- task :standup do
3
- puts
4
- bright_p "Standup scripts list:"
5
- offset = Standup.scripts.keys.map(&:length).max + 2
6
- Standup.scripts.each do |name, script|
7
- puts " rake standup:\e[1m#{"%-#{offset}s" % name}\e[0m #{script.description}"
8
- end
9
- puts
10
- end
11
-
12
- namespace :standup do
13
- Standup.scripts.each do |name, _|
14
- desc "Run script #{name} for each node"
15
- task name.to_sym do
16
- Standup.nodes.each {|node| node.run_script name}
17
- end
18
- end
19
- end