standup 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -11,11 +11,55 @@ Standup is an application deployment and infrastructure management tool for Rail
11
11
  0. `standup setup`
12
12
  0. `standup status`
13
13
 
14
- ## Tweaking default scripts
14
+ ## Config file
15
+
16
+ It consists of 3 major parts:
17
+
18
+ ### Amazon Web Services credentials
19
+
20
+ aws:
21
+ account_id: 0123-4567-8910
22
+ access_key_id: GTFGV123P45DRDKOBBVP
23
+ secret_access_key: jKkjhkjbb1Bhjh+MBG0GBbmuhdGh/Kgbdhzbd9sd
24
+ keypair_name: aws
25
+ availability_zone: us-east-1c
26
+
27
+ Here, keypair_name is keypair filename, without `.pem` extension.
28
+ By default, Standup searches actual file under `~/.ssh` directory.
29
+ You can override this behavior by specifying `keypair_file` param.
30
+
31
+ ### Global script params
32
+
33
+ ec2:
34
+ image_id: ami-480df921 # Canonical Ubuntu 10.04, EBS boot
35
+ instance_type: m1.small
36
+ ssh_user: ubuntu
37
+ webapp:
38
+ github_user: supercoder
39
+ github_repo: superproject
40
+
41
+ Major part of script params can be set here.
42
+
43
+ ### Nodes and their script params
44
+
45
+ nodes:
46
+ main:
47
+ ec2:
48
+ elastic_ip: 123.123.123.123
49
+ testing:
50
+ staging:
51
+
52
+ Here, under `nodes` section, should go actual nodes (server instances) which you want to manage.
53
+ For each node, you can specify additional script params.
54
+ In this example, `elastic_ip` param of `ec2` script is set for node `main`.
55
+
56
+ Script params are merged in `node-specific || global || script-defaults` manner.
57
+
58
+ ## Tweaking bundled scripts
15
59
 
16
60
  0. `standup localize <script_name>`
17
61
  0. Script file `config/standup/<script_name>.rb` will be copied from gem.
18
- 0. Script's own files, like configs etc. under `config/standup/<script_name>`, if any, will be copied from gem too.
62
+ 0. Script's own files, like configs etc. under `config/standup/<script_name>`, if any, will be copied from gem too.
19
63
  0. You can edit them and standup will use them instead of default.
20
64
  0. You can delete local script's own files, then default ones will be used.
21
65
 
@@ -23,13 +67,13 @@ Standup is an application deployment and infrastructure management tool for Rail
23
67
 
24
68
  0. `standup generate <script_name>`
25
69
  0. Script file `config/standup/<script_name>.rb` will be created with empty script stub.
26
- 0. Edit it as you want, it's now available for standup.
70
+ 0. Edit it as you want, it's now available for Standup.
27
71
 
28
72
  ## Setup script
29
73
 
30
- Setup script is just common Rails application deployment workflow.
74
+ Setup script automates common Rails application deployment workflow.
31
75
 
32
- If you just want to add your script into this workflow, just set it as script param, thus overwriting default.
76
+ If you want to add your script into this workflow, just set it as script param, thus overwriting default.
33
77
 
34
78
  For example, if you want to add `rescue` to your configuration, you need to:
35
79
 
@@ -44,8 +88,6 @@ For example, if you want to add `rescue` to your configuration, you need to:
44
88
 
45
89
  ## To do
46
90
 
47
- - `standup -v`
48
-
49
91
  - **?** Script sequences: rework default script as script sequence
50
92
 
51
93
  - ERB processing for script files
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
data/bin/standup CHANGED
@@ -5,7 +5,7 @@ require 'trollop'
5
5
  require 'standup'
6
6
 
7
7
  opt_parser = Trollop::Parser.new do
8
- version "Standup #{Standup.version} (c) 2010 Ilia Ablamonov, Cloud Castle" # "test 1.2.3 (c) 2008 William Morgan"
8
+ version "Standup #{Standup.version} (c) 2010 Ilia Ablamonov, Cloud Castle Inc."
9
9
 
10
10
  banner 'Standup is an application deployment and infrastructure management tool for Rails and Amazon EC2.'
11
11
  banner ''
@@ -32,8 +32,6 @@ Trollop::with_standard_exception_handling opt_parser do
32
32
  raise Trollop::HelpNeeded if ARGV.empty?
33
33
  end
34
34
 
35
- exit if ARGV.empty?
36
-
37
35
  script_name = ARGV.shift
38
36
  script = Standup.scripts[script_name]
39
37
 
data/lib/standup/node.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'active_support/hash_with_indifferent_access'
2
+
1
3
  module Standup
2
4
  class Node
3
5
  def initialize name
@@ -24,11 +26,11 @@ module Standup
24
26
 
25
27
  def ssh_string
26
28
  return '' unless instance
27
- "ssh -i #{Settings.aws.keypair_file} -q -o StrictHostKeyChecking=no #{params.ec2.ssh_user}@#{instance.external_ip}"
29
+ "ssh -i #{Settings.aws.keypair_file} -q -o StrictHostKeyChecking=no #{scripts.ec2.params.ssh_user}@#{instance.external_ip}"
28
30
  end
29
31
 
30
32
  def params
31
- Settings.nodes[@name]
33
+ Settings.nodes[@name] || ActiveSupport::HashWithIndifferentAccess.new
32
34
  end
33
35
 
34
36
  def remoting
@@ -6,7 +6,7 @@ module Standup
6
6
  @node = node
7
7
  @host = @node.instance.external_ip
8
8
  @keypair_file = Settings.aws.keypair_file
9
- @user = @node.params.ec2.ssh_user
9
+ @user = @node.scripts.ec2.params.ssh_user
10
10
  @ssh = nil
11
11
  @path = nil
12
12
  end
data/scripts/browse.rb ADDED
@@ -0,0 +1,13 @@
1
+ Standup.script :node do
2
+ self.description = 'Open Web browser with specified node address'
3
+
4
+ def run
5
+ return unless node.instance
6
+ ['x-www-browser', 'open'].each do |cmd|
7
+ if `which #{cmd}`.present?
8
+ `#{cmd} http://#{node.instance.external_ip}/`
9
+ return
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,4 @@
1
+ # Amazon Web Services credentials
1
2
  aws:
2
3
  account_id:
3
4
  access_key_id:
@@ -5,13 +6,17 @@ aws:
5
6
  keypair_name:
6
7
  availability_zone: us-east-1a
7
8
 
9
+ # Global script params
10
+ ec2:
11
+ image_id: ami-480df921 # Canonical Ubuntu 10.04, EBS boot, i386
12
+ instance_type: m1.small
13
+ ssh_user: ubuntu
14
+ webapp:
15
+ github_user:
16
+ github_repo:
17
+
18
+ # Nodes and their script params
8
19
  nodes:
9
20
  main:
10
21
  ec2:
11
- image_id: ami-480df921 # Canonical Ubuntu 10.04, EBS boot
12
- instance_type: m1.small
13
- ssh_user: ubuntu
14
- # elastic_ip:
15
- webapp:
16
- github_user:
17
- github_repo:
22
+ elastic_ip:
@@ -29,6 +29,5 @@ http {
29
29
 
30
30
  passenger_max_pool_size 10;
31
31
 
32
- # standup place server fragments here
33
- # standup place server fragments here
32
+ include servers/*.conf;
34
33
  }
data/scripts/passenger.rb CHANGED
@@ -9,6 +9,8 @@ Standup.script :node do
9
9
  sudo 'passenger-install-nginx-module --auto --auto-download --prefix=/opt/nginx'
10
10
  end
11
11
 
12
+ sudo 'mkdir -p /opt/nginx/conf/servers'
13
+
12
14
  upload script_file('nginx.conf'),
13
15
  :to =>'/opt/nginx/conf/nginx.conf',
14
16
  :sudo => true
@@ -25,6 +27,14 @@ Standup.script :node do
25
27
  restart_nginx
26
28
  end
27
29
 
30
+ def add_server_conf file, name = File.basename(file), restart = true
31
+ upload file,
32
+ :to => "/opt/nginx/conf/servers/#{name}",
33
+ :sudo => true
34
+
35
+ restart_nginx if restart
36
+ end
37
+
28
38
  def restart_nginx
29
39
  scripts.monit.restart_watch 'nginx'
30
40
  end
@@ -0,0 +1,11 @@
1
+ server {
2
+ server_name "";
3
+ listen 80;
4
+
5
+ root /opt/webapp/public;
6
+
7
+ passenger_enabled on;
8
+ passenger_min_instances 3;
9
+ }
10
+
11
+ passenger_pre_start http://127.0.0.1/;
data/scripts/webapp.rb CHANGED
@@ -21,15 +21,10 @@ Standup.script :node do
21
21
  end
22
22
 
23
23
  bootstrap_db
24
-
25
- remote_update '/opt/nginx/conf/nginx.conf',
26
- File.read(script_file('nginx-server-fragment.conf')),
27
- :delimiter => '# standup place server fragments here',
28
- :sudo => true
29
-
24
+
30
25
  sudo 'chown -R nobody:nogroup /opt/webapp'
31
26
 
32
- scripts.passenger.restart_nginx
27
+ scripts.passenger.add_server_conf script_file('webapp.conf')
33
28
  end
34
29
 
35
30
  protected
data/standup.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{standup}
8
- s.version = "0.3.5"
8
+ s.version = "0.3.6"
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-12}
12
+ s.date = %q{2010-11-13}
13
13
  s.default_executable = %q{standup}
14
14
  s.email = %q{ilia@flamefork.ru}
15
15
  s.executables = ["standup"]
@@ -40,6 +40,7 @@ Gem::Specification.new do |s|
40
40
  "scripts/allocate_ip.rb",
41
41
  "scripts/appconsole.rb",
42
42
  "scripts/basics.rb",
43
+ "scripts/browse.rb",
43
44
  "scripts/delayed_job.rb",
44
45
  "scripts/delayed_job/delayed_job_monit.conf",
45
46
  "scripts/ec2.rb",
@@ -66,7 +67,7 @@ Gem::Specification.new do |s|
66
67
  "scripts/update.rb",
67
68
  "scripts/watchlog.rb",
68
69
  "scripts/webapp.rb",
69
- "scripts/webapp/nginx-server-fragment.conf",
70
+ "scripts/webapp/webapp.conf",
70
71
  "standup.gemspec"
71
72
  ]
72
73
  s.homepage = %q{http://github.com/Flamefork/standup}
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: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 5
10
- version: 0.3.5
9
+ - 6
10
+ version: 0.3.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ilia Ablamonov
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-12 00:00:00 +03:00
19
+ date: 2010-11-13 00:00:00 +03:00
20
20
  default_executable: standup
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -157,6 +157,7 @@ files:
157
157
  - scripts/allocate_ip.rb
158
158
  - scripts/appconsole.rb
159
159
  - scripts/basics.rb
160
+ - scripts/browse.rb
160
161
  - scripts/delayed_job.rb
161
162
  - scripts/delayed_job/delayed_job_monit.conf
162
163
  - scripts/ec2.rb
@@ -183,7 +184,7 @@ files:
183
184
  - scripts/update.rb
184
185
  - scripts/watchlog.rb
185
186
  - scripts/webapp.rb
186
- - scripts/webapp/nginx-server-fragment.conf
187
+ - scripts/webapp/webapp.conf
187
188
  - standup.gemspec
188
189
  has_rdoc: true
189
190
  homepage: http://github.com/Flamefork/standup
@@ -1,12 +0,0 @@
1
- server {
2
- server_name "";
3
- listen 80;
4
-
5
- root /opt/webapp/public;
6
-
7
- passenger_enabled on;
8
- passenger_min_instances 3;
9
- }
10
-
11
- passenger_pre_start http://127.0.0.1/;
12
-