rubber 2.2.4 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +46 -0
  3. data/lib/rubber/commands/config.rb +4 -2
  4. data/lib/rubber/commands/vulcanize.rb +1 -1
  5. data/lib/rubber/dns/base.rb +4 -0
  6. data/lib/rubber/recipes/rubber.rb +3 -3
  7. data/lib/rubber/recipes/rubber/utils.rb +3 -1
  8. data/lib/rubber/version.rb +1 -1
  9. data/rubber.gemspec +1 -1
  10. data/templates/base/config/deploy.rb +1 -0
  11. data/templates/base/config/rubber/rubber-ruby.yml +1 -1
  12. data/templates/base/config/rubber/rubber.yml +1 -1
  13. data/templates/collectd/config/rubber/deploy-collectd.rb +6 -0
  14. data/templates/elasticsearch/config/rubber/deploy-elasticsearch.rb +1 -1
  15. data/templates/graphite/config/rubber/deploy-graphite.rb +20 -5
  16. data/templates/memcached/config/rubber/deploy-memcached.rb +15 -0
  17. data/templates/memcached/config/rubber/role/memcached/crontab +8 -0
  18. data/templates/memcached/config/rubber/role/memcached/memcached.conf +1 -1
  19. data/templates/memcached/config/rubber/rubber-memcached.yml +2 -0
  20. data/templates/mongodb/config/rubber/deploy-mongodb.rb +11 -2
  21. data/templates/mongodb/config/rubber/role/mongodb/crontab +8 -0
  22. data/templates/monit/config/rubber/deploy-monit.rb +8 -1
  23. data/templates/mysql/config/rubber/rubber-mysql.yml +1 -1
  24. data/templates/nginx/config/rubber/deploy-nginx.rb +8 -1
  25. data/templates/nginx/config/rubber/role/nginx/crontab +1 -1
  26. data/templates/nginx/config/rubber/role/nginx/nginx.conf +4 -4
  27. data/templates/nginx/config/rubber/rubber-nginx.yml +2 -0
  28. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/application.conf +1 -1
  29. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/crontab +1 -1
  30. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/nginx.conf +3 -3
  31. data/templates/passenger_nginx/config/rubber/rubber-passenger_nginx.yml +3 -3
  32. data/templates/percona/config/rubber/rubber-percona.yml +1 -1
  33. data/templates/redis/config/rubber/deploy-redis.rb +1 -1
  34. data/templates/redis/config/rubber/role/redis/redis.conf +261 -141
  35. data/templates/redis/config/rubber/rubber-redis.yml +1 -1
  36. data/templates/torquebox/config/rubber/deploy-torquebox.rb +1 -1
  37. data/templates/unicorn/config/rubber/deploy-unicorn.rb +8 -1
  38. metadata +102 -151
  39. data/templates/graphite/config/rubber/role/graphite_server/graphite-collectd-ping.conf +0 -11
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da3f085ebdc37b989578576bdb4a58416229704a
4
+ data.tar.gz: 121a3118cdf6321dc57b3408e7e549c8d5f17c25
5
+ SHA512:
6
+ metadata.gz: 15d26dc76976a8d1568e9dfdafd72a92d2bc670f97c75b62d77300811f8a66505d0c472bef0738e2f3bcb132fe7f83f2b17c6cd6f7242b3c4a4446be7bba883c
7
+ data.tar.gz: faf33dcca62169c86969185337761478654efdf6780a73477b25d7701fae0ef4d783f12e2447e1e25df4568909b52fc695f12c88e345fb65c8c1365d9885f53d
data/CHANGELOG CHANGED
@@ -1,3 +1,49 @@
1
+ 2.3.0 (05/11/2013)
2
+ ------------------
3
+
4
+ New Features:
5
+ ============
6
+
7
+ [core] Added a --fakeroot option to rake rubber:config task to aid in debbugging rubber templates. <20e3fb0>
8
+ [collectd] Added a :status task to check the status of a remote service. <55f593a>
9
+ [graphite] Added a :status task to check the status of a remote service. <55f593a>
10
+ [memcached] Added a :status task to check the status of a remote service. <55f593a>
11
+ [mongodb] Added a :status task to check the status of a remote service. <55f593a>
12
+ [monit] Added a :status task to check the status of a remote service. <55f593a>
13
+ [nginx] Added a :status task to check the status of a remote service. <55f593a>
14
+ [unicorn] Added a :status task to check the status of a remote service. <55f593a>
15
+
16
+ Improvements:
17
+ ============
18
+
19
+ [base] Upgraded from ruby-build 20130222 to 20130501. <4ea28f8>
20
+ [base] Configure Capistrano to compile assets on the `app` role, not the `web` one, in order to better match a typical Rubber project layout. <9c8096e>
21
+ [core] Allow customizing Capistrano config that rubber has traditionally taken ownership of. <ff69b52>
22
+ [graphite] Removed redundant ping check. <9950dc4>
23
+ [memcached] Added a rotate_logs cron job for memached. <f4d49ac>
24
+ [mongodb] Added a rotate_logs cron job for MongoDB. <b93665d>
25
+ [nginx] Allow configuration of the nginx log directory. <f4ef26f>
26
+ [nginx] Removed "text/html" from the gzip config to get rid of a warning message. <2429a7d>
27
+ [passenger_nginx] Upgraded to Passenger 3.0.19 and nginx 1.2.8. <48fd214, 9a8d81c>
28
+ [passenger_nginx] Added HTTP_X_QUEUE_START CGI param to work better with NewRelic. <48fd214>
29
+ [redis] Upgrade to redis 2.6.13 <9fb33e2>
30
+
31
+ Bug Fixes:
32
+ =========
33
+
34
+ [base] Fixed a typo in the cloud storage example configuration. <409137b>
35
+ [core] Honor the `host` option in the rubber:config rake task. <9477b8b>
36
+ [core] Fixed an issue with `symbolize_keys` and nested hashes that was resulting in broken MX record requests for Route 53. <13fdffd>
37
+ [core] Fixed an issue with vulcanizing multiple templates at once. <abca6e3>
38
+ [core] Fixed a problem with newer Capistrano/HighLine causing role names to be serialized incorrectly in an instance file. <9ea1fa6>
39
+ [elasticsearch] The upstart script lies about the service status, causing us to think the service is running when it isn't and thus preventing proper start up. <81aab0e>
40
+ [graphite] The upstart script lies about the service status, causing us to think the service is running when it isn't and thus preventing proper start up. <d92f077>
41
+ [mongodb] The upstart script lies about the service status, causing us to think the service is running when it isn't and thus preventing proper start up. <d92f077>
42
+ [mysql] Maatkit is now part of percona-tools, so our package name was outdated. <2e8d5f6>
43
+ [redis] The upstart script lies about the service status, causing us to think the service is running when it isn't and thus preventing proper start up. <d92f077>
44
+ [torquebox] The upstart script lies about the service status, causing us to think the service is running when it isn't and thus preventing proper start up. <d92f077>
45
+
46
+
1
47
  2.2.4 (03/05/2013)
2
48
  ------------------
3
49
 
@@ -23,15 +23,17 @@ module Rubber
23
23
  option ["--file", "-p"], "FILE", "Only generate files matching the given pattern"
24
24
  option ["--no_post", "-n"], :flag, "Skip running post commands"
25
25
  option ["--force", "-f"], :flag, "Overwrite files that already exist"
26
+ option ["--fakeroot", "-k"], "FAKEROOT", "Prefix generated files with fakeroot. Useful\nfor debugging with an environment and host"
26
27
 
27
28
  def execute
28
29
  cfg = Rubber::Configuration.get_configuration(Rubber.env)
29
- instance_alias = cfg.environment.current_host
30
+ instance_alias = host || cfg.environment.current_host
30
31
  instance = cfg.instance[instance_alias]
31
32
  if instance
32
33
  role_names = instance.role_names
33
34
  env = cfg.environment.bind(role_names, instance_alias)
34
35
  gen = Rubber::Configuration::Generator.new("#{Rubber.root}/config/rubber", role_names, instance_alias)
36
+ gen.fake_root = fakeroot if fakeroot
35
37
  elsif ['development', 'test'].include?(Rubber.env)
36
38
  instance_alias = host || instance_alias
37
39
  role_names = roles || cfg.environment.known_roles
@@ -48,7 +50,7 @@ module Rubber
48
50
  instance.internal_ip = "127.0.0.1"
49
51
  cfg.instance.add(instance)
50
52
  gen = Rubber::Configuration::Generator.new("#{Rubber.root}/config/rubber", role_names, instance_alias)
51
- gen.fake_root ="#{Rubber.root}/tmp/rubber"
53
+ gen.fake_root = fakeroot || "#{Rubber.root}/tmp/rubber"
52
54
  else
53
55
  puts "Instance not found for host: #{instance_alias}"
54
56
  exit 1
@@ -50,7 +50,7 @@ module Rubber
50
50
  option ["-s", "--skip"], :flag, "Skip files that already exist"
51
51
 
52
52
  parameter "TEMPLATE ...", "rubber template(s)" do |arg|
53
- invalid = arg - VulcanizeThor.valid_templates
53
+ invalid = [arg].flatten - VulcanizeThor.valid_templates
54
54
  if invalid.size == 0
55
55
  arg
56
56
  else
@@ -68,6 +68,10 @@ module Rubber
68
68
  actual_opts = default_opts.merge(Rubber::Util::symbolize_keys(opts))
69
69
  end
70
70
 
71
+ if actual_opts.has_key?(:data) && actual_opts[:data].is_a?(Array) && actual_opts[:data].first.is_a?(Hash)
72
+ actual_opts[:data] = actual_opts[:data].collect { |x| Rubber::Util.symbolize_keys(x) }
73
+ end
74
+
71
75
  required.each do |r|
72
76
  raise "Missing required options: #{r}" unless actual_opts[r]
73
77
  end
@@ -55,9 +55,9 @@ namespace :rubber do
55
55
  # Disable connecting to any Windows instance.
56
56
  # pass -l to bash in :shell to that run also gets full env
57
57
  # use a pty so we don't get "stdin: is not a tty" error output
58
- default_run_options[:pty] = true
59
- default_run_options[:shell] = "/bin/bash -l"
60
- default_run_options[:except] = { :platform => 'windows' }
58
+ default_run_options[:pty] = true if default_run_options[:pty].nil?
59
+ default_run_options[:shell] = "/bin/bash -l" if default_run_options[:shell].nil?
60
+ default_run_options[:except] ||= { :platform => 'windows' }
61
61
 
62
62
  set :cloud, Rubber.cloud(self)
63
63
 
@@ -191,7 +191,9 @@ namespace :rubber do
191
191
  value = Capistrano::CLI.ui.ask(msg) unless value
192
192
  value = value.size == 0 ? default : value
193
193
  fatal "#{name} is required, pass using environment or enter at prompt" if required && ! value
194
- return value
194
+
195
+ # Explicitly convert to a String to avoid weird serialization issues with Psych.
196
+ value.to_s
195
197
  end
196
198
 
197
199
  def fatal(msg, code=1)
@@ -1,3 +1,3 @@
1
1
  module Rubber
2
- VERSION = "2.2.4"
2
+ VERSION = "2.3.0"
3
3
  end
data/rubber.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = ["Matt Conway", "Kevin Menard"]
12
12
  s.email = ["matt@conwaysplace.com", "nirvdrum@gmail.com"]
13
- s.homepage = "http://github.com/wr0ngway/rubber"
13
+ s.homepage = "https://github.com/rubber/rubber"
14
14
  s.summary = "A capistrano plugin for managing multi-instance deployments to the cloud (ec2)"
15
15
  s.description = <<-DESC
16
16
  The rubber plugin enables relatively complex multi-instance deployments of RubyOnRails applications to
@@ -7,6 +7,7 @@ on :load do
7
7
  set :runner, rubber_env.app_user
8
8
  set :deploy_to, "/mnt/#{application}-#{Rubber.env}"
9
9
  set :copy_exclude, [".git/*", ".bundle/*", "log/*", ".rvmrc", ".rbenv-version"]
10
+ set :assets_role, [:app]
10
11
  end
11
12
 
12
13
  # Use a simple directory tree copy here to make demo easier.
@@ -11,7 +11,7 @@
11
11
  packages: [build-essential, git-core, subversion, curl, autoconf, bison, ruby, zlib1g-dev, libssl-dev, libreadline6-dev, libxml2-dev, libyaml-dev]
12
12
 
13
13
  # REQUIRED: The version of ruby-build to use for building ruby.
14
- ruby_build_version: 20130222
14
+ ruby_build_version: 20130501
15
15
 
16
16
  # REQUIRED: Set to the version string for the ruby version you wish to use
17
17
  # Run "ruby-build --definitions" to see the list of possible options
@@ -118,7 +118,7 @@ cloud_provider: aws
118
118
  #
119
119
  # Allowed forms are:
120
120
  # filesystem: "file:#{Rubber.root}/config/rubber/instance-#{Rubber.env}.yml"
121
- # cloud storage (s3): "storage:#{cloud_provider.aws.backup_bucket}/RubberInstances_#{app_name}/instance-#{Rubber.env}.yml"
121
+ # cloud storage (s3): "storage:#{cloud_providers.aws.backup_bucket}/RubberInstances_#{app_name}/instance-#{Rubber.env}.yml"
122
122
  # cloud table (simpledb): "table:RubberInstances_#{app_name}_#{Rubber.env}"
123
123
  #
124
124
  # If you need to port between forms, load the rails console then:
@@ -43,6 +43,12 @@ namespace :rubber do
43
43
  rsudo "pkill -fn #{rubber_env.rubber_collectd_runner.sub(/./, '[\0]')} ; exit 0"
44
44
  end
45
45
 
46
+ desc "Display status of collectd system monitoring"
47
+ task :status, :roles => :collectd do
48
+ rsudo "service collectd status || true"
49
+ rsudo "ps -eopid,user,fname | grep [c]ollectd || true"
50
+ end
51
+
46
52
  end
47
53
 
48
54
  end
@@ -34,7 +34,7 @@ namespace :rubber do
34
34
  end
35
35
 
36
36
  task :start, :roles => :elasticsearch do
37
- rsudo "service elasticsearch status || service elasticsearch start"
37
+ rsudo "service elasticsearch start"
38
38
  end
39
39
 
40
40
  task :stop, :roles => :elasticsearch do
@@ -116,7 +116,7 @@ namespace :rubber do
116
116
 
117
117
  desc "Start graphite system monitoring"
118
118
  task :start, :roles => :graphite_server do
119
- rsudo "service graphite-server status || service graphite-server start"
119
+ rsudo "service graphite-server start"
120
120
  end
121
121
 
122
122
  desc "Stop graphite system monitoring"
@@ -129,6 +129,14 @@ namespace :rubber do
129
129
  stop
130
130
  start
131
131
  end
132
+
133
+ desc "Display status of graphite system monitoring"
134
+ task :status, :roles => :graphite_server do
135
+ rsudo "service graphite-server status || true"
136
+ rsudo "ps -eopid,user,cmd | grep [c]arbon || true"
137
+ rsudo "sudo netstat -tupln | grep [p]ython || true"
138
+ end
139
+
132
140
  end
133
141
 
134
142
  namespace :web do
@@ -189,22 +197,29 @@ EOF
189
197
  end
190
198
  end
191
199
 
192
- desc "Start graphite system monitoring"
200
+ desc "Start graphite web server"
193
201
  task :start, :roles => :graphite_web do
194
- rsudo "service graphite-web status || service graphite-web start"
202
+ rsudo "service graphite-web start"
195
203
  end
196
204
 
197
- desc "Stop graphite system monitoring"
205
+ desc "Stop graphite web server"
198
206
  task :stop, :roles => :graphite_web do
199
207
  rsudo "service graphite-web stop || true"
200
208
  end
201
209
 
202
- desc "Restart graphite system monitoring"
210
+ desc "Restart graphite web server"
203
211
  task :restart, :roles => :graphite_web do
204
212
  stop
205
213
  start
206
214
  end
207
215
 
216
+ desc "Display status of graphite web server"
217
+ task :status, :roles => :graphite_web do
218
+ rsudo "service graphite-web status || true"
219
+ rsudo "ps -eopid,user,cmd | grep '[g]raphite/conf/uwsgi.ini' || true"
220
+ rsudo "netstat -tupln | grep uwsgi || true"
221
+ end
222
+
208
223
  end
209
224
 
210
225
  end
@@ -0,0 +1,15 @@
1
+
2
+ namespace :rubber do
3
+
4
+ namespace :memcached do
5
+
6
+ desc "Display status of memcached shared memory"
7
+ task :status, :roles => :memcached do
8
+ rsudo "service memcached status || true"
9
+ rsudo "ps -eopid,user,cmd | grep [m]emcached || true"
10
+ rsudo "netstat -tulpn | grep memcached || true"
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,8 @@
1
+ <%
2
+ @read_cmd = 'crontab -l'
3
+ @write_cmd = 'crontab -'
4
+ @additive = ["# rubber-memcached-start", "# rubber-memcached-end"]
5
+ %>
6
+
7
+ # Roll the memcached logs at midnight
8
+ 0 0 * * * <%= Rubber.root %>/script/rubber cron --task util:rotate_logs --directory=<%= rubber_env.memcached_log_dir %>
@@ -14,7 +14,7 @@
14
14
  -d
15
15
 
16
16
  # Log memcached's output to /var/log/memcached
17
- logfile /var/log/memcached.log
17
+ logfile <%= rubber_env.memcached_log_dir %>/memcached.log
18
18
 
19
19
  # Be verbose
20
20
  -v
@@ -1,5 +1,7 @@
1
1
  # Sets up memcached server and client as dalli
2
2
 
3
+ memcached_log_dir: /var/log/memcached
4
+
3
5
  gems: [dalli]
4
6
 
5
7
  roles:
@@ -33,7 +33,7 @@ namespace :rubber do
33
33
  Starts the mongodb daemon
34
34
  DESC
35
35
  task :start, :roles => :mongodb do
36
- rsudo "service mongodb status || service mongodb start"
36
+ rsudo "service mongodb start"
37
37
  end
38
38
 
39
39
  desc <<-DESC
@@ -50,7 +50,16 @@ namespace :rubber do
50
50
  stop
51
51
  start
52
52
  end
53
-
53
+
54
+ desc <<-DESC
55
+ Display status of the mongodb daemon
56
+ DESC
57
+ task :status, :roles => :mongodb do
58
+ rsudo "service mongodb status || true"
59
+ rsudo "ps -eopid,user,cmd | grep [m]ongod || true"
60
+ rsudo "netstat -tupan | grep mongod || true"
61
+ end
62
+
54
63
  end
55
64
 
56
65
  end
@@ -0,0 +1,8 @@
1
+ <%
2
+ @read_cmd = 'crontab -l'
3
+ @write_cmd = 'crontab -'
4
+ @additive = ["# rubber-mongodb-start", "# rubber-mongodb-end"]
5
+ %>
6
+
7
+ # Roll the mongodb logs at midnight
8
+ 0 0 * * * <%= Rubber.root %>/script/rubber cron --task util:rotate_logs --directory=<%= rubber_env.mongodb_log_dir %>
@@ -27,7 +27,14 @@ namespace :rubber do
27
27
  stop
28
28
  start
29
29
  end
30
-
30
+
31
+ desc "Display status of monit daemon monitoring"
32
+ task :status, :roles => :monit do
33
+ rsudo "service monit status || true"
34
+ rsudo "ps -eopid,user,fname | grep [m]onit || true"
35
+ rsudo "netstat -tulpn | grep monit || true"
36
+ end
37
+
31
38
  end
32
39
 
33
40
  end
@@ -42,5 +42,5 @@ roles:
42
42
  mysql:
43
43
  packages: [
44
44
  mysql-server,
45
- maatkit # useful mysql tools for replication
45
+ percona-tools # useful mysql tools for replication
46
46
  ]
@@ -52,7 +52,14 @@ namespace :rubber do
52
52
  task :reload, :roles => :nginx do
53
53
  serial_reload
54
54
  end
55
-
55
+
56
+ desc "Display status of the nginx web server"
57
+ task :status, :roles => :nginx do
58
+ rsudo "service nginx status || true"
59
+ rsudo "ps -eopid,user,fname | grep [n]ginx || true"
60
+ rsudo "netstat -tulpn | grep nginx || true"
61
+ end
62
+
56
63
  end
57
64
 
58
65
  end
@@ -5,5 +5,5 @@
5
5
  %>
6
6
 
7
7
  # Roll the nginx logs at midnight
8
- 0 0 * * * <%= Rubber.root %>/script/rubber cron --task util:rotate_logs --directory=/mnt/nginx/logs
8
+ 0 0 * * * <%= Rubber.root %>/script/rubber cron --task util:rotate_logs --directory=<%= rubber_env.nginx_log_dir %>
9
9
 
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  @path = "/etc/nginx/nginx.conf"
3
- @post = "mkdir -p /mnt/nginx/logs"
3
+ @post = "mkdir -p #{rubber_env.nginx_log_dir}"
4
4
  %>
5
5
 
6
6
  user www-data;
@@ -26,7 +26,7 @@ http
26
26
  gzip_http_version 1.0;
27
27
  gzip_comp_level 2;
28
28
  gzip_proxied any;
29
- gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
29
+ gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
30
30
 
31
31
  # configure log format like to Apache's "combined" log format
32
32
  log_format main
@@ -35,8 +35,8 @@ http
35
35
  '"$http_user_agent" "$http_cookie"';
36
36
 
37
37
  # default log files
38
- error_log /mnt/nginx/logs/error.log notice;
39
- access_log /mnt/nginx/logs/access.log main;
38
+ error_log <%= rubber_env.nginx_log_dir %>/error.log notice;
39
+ access_log <%= rubber_env.nginx_log_dir %>/access.log main;
40
40
 
41
41
  include /etc/nginx/rubber/*.conf;
42
42
  }
@@ -5,6 +5,8 @@
5
5
  # Uses from rubber-complete.yml
6
6
  # web_tools_port: 8080
7
7
 
8
+ nginx_log_dir: /mnt/nginx/logs
9
+
8
10
  roles:
9
11
  nginx:
10
12
  packages: [nginx]
@@ -4,8 +4,8 @@
4
4
 
5
5
  server_name <%= [ rubber_env.domain, rubber_env.web_aliases ].flatten.compact.join(" ") %>;
6
6
  passenger_enabled on;
7
-
8
7
  passenger_min_instances 1;
8
+ passenger_set_cgi_param HTTP_X_QUEUE_START "t=${msec}000";
9
9
 
10
10
  root <%= Rubber.root + "/public" %>;
11
11