rubber 2.9.0 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG +29 -0
  4. data/lib/rubber/recipes/rubber/deploy.rb +10 -5
  5. data/lib/rubber/version.rb +1 -1
  6. data/templates/base/config/rubber/deploy-setup.rb +2 -0
  7. data/templates/base/config/rubber/rubber.yml +8 -5
  8. data/templates/delayed_job/config/rubber/deploy-delayed_job.rb +27 -16
  9. data/templates/delayed_job/config/rubber/rubber-delayed_job.yml +1 -0
  10. data/templates/graylog/config/rubber/deploy-graylog.rb +17 -9
  11. data/templates/graylog/config/rubber/role/graylog_server/graylog2.conf +55 -36
  12. data/templates/graylog/config/rubber/role/graylog_web/graylog2-web-interface.conf +15 -0
  13. data/templates/graylog/config/rubber/rubber-graylog.yml +6 -2
  14. data/templates/monit/config/rubber/role/delayed_job/monit-delayed_job.conf +24 -0
  15. data/templates/monit/config/rubber/role/unicorn/monit-unicorn.conf +1 -1
  16. data/templates/passenger_nginx/config/rubber/deploy-passenger_nginx.rb +6 -39
  17. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/nginx.conf +14 -12
  18. data/templates/passenger_nginx/config/rubber/rubber-passenger_nginx.yml +2 -7
  19. data/templates/unicorn/config/rubber/deploy-unicorn.rb +8 -9
  20. data/templates/unicorn/config/rubber/role/unicorn/unicorn +30 -20
  21. data/templates/unicorn/config/rubber/role/unicorn/unicorn.rb +6 -6
  22. data/templates/unicorn/config/rubber/rubber-unicorn.yml +4 -1
  23. metadata +3 -7
  24. data/templates/delayed_job/config/rubber/role/delayed_job/monit-delayed_job.conf +0 -18
  25. data/templates/munin/config/rubber/role/passenger_nginx/munin-passenger-memory.conf +0 -34
  26. data/templates/munin/config/rubber/role/passenger_nginx/munin-passenger-sudoers.conf +0 -8
  27. data/templates/munin/config/rubber/role/passenger_nginx/munin-passenger.conf +0 -47
  28. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/nginx +0 -101
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab6253fd1d0b38c978eda0a0dc6ca62262284cb6
4
- data.tar.gz: d64c12b608be9a43292bace407970d31a2d7f0cf
3
+ metadata.gz: 8744439407fab692486f20a294c52a5c9205497e
4
+ data.tar.gz: 0786a0389c092de1defec7d51955e33e70380d9f
5
5
  SHA512:
6
- metadata.gz: 0037e0e29c1b5a408971a1ba2b2095135e34881fcac4d26e6ed100b27211ec1e3db324f52526e29b1aa2a4b14ff0a31c3f381897340b6cf41414eaa92eb4c6d0
7
- data.tar.gz: 3c60ffe2b978abda2f0626770776a68e412fe695eee2b5221d0585131998a74e6973a1a35061654a599c44389d272b11dab769de128906d30623ca3fc85da0cd
6
+ metadata.gz: fdde13fda5fd4795b06f60941e5e4bef3177d21c171a0d1158c70743c47da90f3c368584bf87cf37f2ed511962671cc95a488cc6f9ee6ee0cd0d9113c70d096a
7
+ data.tar.gz: 7f6c872ddaf88857d52e543ae6b90972dc6027201e24111d7e46f84d98374e0d26234481ece2a903b3023037446412f3c23533244f26928a8252f51530b9fe6b
@@ -51,4 +51,4 @@ env:
51
51
  - JAVA_OPTS="-server -Djruby.cext.enabled=false -Djruby.compile.invokedynamic=false"
52
52
 
53
53
  notifications:
54
- irc: "irc.freenode.net#rubberec2"
54
+ irc: "irc.freenode.net#rubber"
data/CHANGELOG CHANGED
@@ -1,3 +1,32 @@
1
+ 2.10.0 (06/17/2014)
2
+
3
+ Improvements:
4
+ ============
5
+
6
+ [delayed_job] Added :kill and :status tasks. <52b593e>
7
+ [delayed_job] Run in bundle exec context. <52b593e>
8
+ [delayed_job] Move monit-delayed_job.conf inside the monit vulcanizer, as is the standard for all other templates. <52b593e>
9
+ [delayed_job] Added PID file control. <52b593e>
10
+ [delayed_job] Monit now has a 10-minute timeout because the PID file being monitored is not generated until after delayed_job daemonizes. <52b593e>
11
+ [graylog] Upgraded to graylog 0.2.2. <51d9b26, 30fbbbc, fb0cff8, 8a72986, 0785b66>
12
+ [graylog] Added a tools proxy for the graylog server API browser. <899555a>
13
+ [graylog] Configured the mail transport. <686ce6b>
14
+ [passenger_nginx] Install Passenger/Nginx from packages instead of building by hand. <103feee, 0c6eb6a, 499c08c, 9a88ffe>
15
+ [passenger_nginx] Remove unneeded deploy.task blocks. <1b9b252>
16
+ [passenger_nginx] Removed munin passenger plugins. <a91f837>
17
+ [unicorn] Standardized Rake names with init script names (use terms "upgrade" and "kill"). <4c616ba>
18
+ [unicorn] Increased Unicorn upgrade timeout to 10 mins. <4c616ba>
19
+ [unicorn] Clarified log messages. <4c616ba>
20
+ [unicorn] Allow setting PID file and number of workers from Rubber config. <4c616ba>
21
+
22
+ Bug Fixes:
23
+ =========
24
+
25
+ [core] Fixed template calls to rubber.run_config (a regression introduced in 2.9.0). <66310a5>
26
+ [graylog] Prevent creating the same graylog inputs twice. <ad8a177>
27
+ [unicorn] Fixed unicorn init script. <4c616ba>
28
+
29
+
1
30
  2.9.0 (06/02/2014)
2
31
 
3
32
  New Features:
@@ -108,12 +108,17 @@ namespace :rubber do
108
108
  end
109
109
  end
110
110
 
111
- def run_config
111
+ def run_config(options={})
112
+ path = options.delete(:deploy_path) || config_path
113
+ no_post = options[:no_post] || ENV['NO_POST']
114
+ force = options[:force] || ENV['FORCE']
115
+ file = options[:file] || ENV['FILE']
116
+
112
117
  opts = ""
113
- opts += " --no_post" if ENV['NO_POST']
114
- opts += " --force" if ENV['FORCE']
115
- opts += " --file=\"#{ENV['FILE']}\"" if ENV['FILE']
116
- rsudo "cd #{config_path} && RUBBER_ENV=#{Rubber.env} RAILS_ENV=#{Rubber.env} ./script/rubber config #{opts}"
118
+ opts += " --no_post" if no_post
119
+ opts += " --force" if force
120
+ opts += " --file=\"#{file}\"" if file
121
+ rsudo "cd #{path} && RUBBER_ENV=#{Rubber.env} RAILS_ENV=#{Rubber.env} ./script/rubber config #{opts}"
117
122
  end
118
123
 
119
124
  def config_path
@@ -1,3 +1,3 @@
1
1
  module Rubber
2
- VERSION = '2.9.0'.freeze
2
+ VERSION = '2.10.0'.freeze
3
3
  end
@@ -54,6 +54,8 @@ namespace :rubber do
54
54
 
55
55
  echo "export RUBYOPT=rubygems\nexport PATH=#{rubber_env.ruby_path}/bin:$PATH" > /etc/profile.d/ruby.sh
56
56
  echo "--- \ngem: --no-ri --no-rdoc" > /etc/gemrc
57
+ update-alternatives --install /usr/bin/ruby ruby #{rubber_env.ruby_path}/bin/ruby 100
58
+ update-alternatives --set ruby #{rubber_env.ruby_path}/bin/ruby
57
59
  fi
58
60
  ENDSCRIPT
59
61
  end
@@ -230,15 +230,18 @@ roles:
230
230
  assigned_security_groups: [web_tools]
231
231
 
232
232
  # OPTIONAL: Automatically create security groups for each host and role
233
- # EC2 doesn't allow one to change what groups an instance belongs to after
234
- # creation, so its good to have some empty ones predefined.
235
- auto_security_groups: true
233
+ # EC2 Classic doesn't allow one to change what groups an instance belongs to after
234
+ # creation, so it's good to have some empty ones predefined. EC2 with VPC, however,
235
+ # does allow changing security groups after instance creation and allows far fewer
236
+ # security groups per instance, so you shouldn't enable this setting if using VPC.
237
+ auto_security_groups: false
236
238
 
237
239
  # OPTIONAL: Automatically isolate security groups for each appname/environment
238
240
  # by mangling their names to be appname_env_groupname
239
241
  # This makes it safer to have staging and production coexist on the same EC2
240
- # account, or even multiple apps
241
- isolate_security_groups: true
242
+ # account, or even multiple apps. NB: due to the security group limits per instance
243
+ # in EC2 with VPCs, this option should only be enabled if you're using EC2 Classic.
244
+ isolate_security_groups: false
242
245
 
243
246
  # OPTIONAL: Prompts one to sync security group rules when the ones in amazon
244
247
  # differ from those in rubber
@@ -1,39 +1,50 @@
1
1
  namespace :rubber do
2
-
2
+
3
3
  namespace :delayed_job do
4
-
4
+
5
5
  rubber.allow_optional_tasks(self)
6
-
6
+
7
7
  after "deploy:stop", "rubber:delayed_job:stop"
8
8
  after "deploy:start", "rubber:delayed_job:start"
9
9
  after "deploy:restart", "rubber:delayed_job:restart"
10
-
10
+
11
11
  def args
12
- rubber_env.delayed_job_args || "-n #{rubber_env.num_delayed_job_workers}"
12
+ rubber_env.delayed_job_args || "-n #{rubber_env.num_delayed_job_workers} --pid-dir=#{rubber_env.delayed_job_pid_dir}"
13
13
  end
14
14
 
15
- def script_location
16
- bin_location = "bin/delayed_job"
17
- script_location = "script/delayed_job"
15
+ def script_path
16
+ bin_path = "bin/delayed_job"
17
+ script_path = "script/delayed_job"
18
18
 
19
- File.exists?(bin_location) ? bin_location : script_location
19
+ File.exists?(bin_path) ? bin_path : script_path
20
20
  end
21
-
21
+
22
22
  desc "Stop the delayed_job process"
23
23
  task :stop, :roles => :delayed_job do
24
- rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} #{self.script_location} stop #{self.args}", :as => rubber_env.app_user
24
+ rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} bundle exec #{self.script_path} stop #{self.args}", :as => rubber_env.app_user
25
25
  end
26
-
26
+
27
27
  desc "Start the delayed_job process"
28
28
  task :start, :roles => :delayed_job do
29
- rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} #{self.script_location} start #{self.args}", :as => rubber_env.app_user
29
+ rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} bundle exec #{self.script_path} start #{self.args}", :as => rubber_env.app_user
30
30
  end
31
-
31
+
32
32
  desc "Restart the delayed_job process"
33
33
  task :restart, :roles => :delayed_job do
34
- rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} #{self.script_location} restart #{self.args}", :as => rubber_env.app_user
34
+ rsudo "cd #{current_path} && RAILS_ENV=#{Rubber.env} bundle exec #{self.script_path} restart #{self.args}", :as => rubber_env.app_user
35
+ end
36
+
37
+ desc "Forcefully kills the delayed_job process"
38
+ task :kill, :roles => :delayed_job do
39
+ rsudo "pkill -9 -f [d]elayed_job || true"
40
+ rsudo "rm -r -f #{rubber_env.delayed_job_pid_dir}/delayed_job.*"
35
41
  end
36
-
42
+
43
+ desc "Display status of the delayed_job process"
44
+ task :status, :roles => :delayed_job do
45
+ rsudo 'ps -eopid,user,cmd | grep [d]elayed_job || true'
46
+ end
47
+
37
48
  desc "Live tail of delayed_job log files for all machines"
38
49
  task :tail_logs, :roles => :delayed_job do
39
50
  last_host = ""
@@ -1 +1,2 @@
1
1
  num_delayed_job_workers: 1
2
+ delayed_job_pid_dir: "/var/run"
@@ -40,6 +40,22 @@ namespace :rubber do
40
40
  end
41
41
  end
42
42
 
43
+ after "rubber:graylog:server:bootstrap", "rubber:graylog:server:create_inputs"
44
+
45
+ task :create_inputs, :roles => :graylog_web do
46
+ rubber.sudo_script 'create_inputs', <<-ENDSCRIPT
47
+ # Only create inputs if the system has 0 inputs. It's a bit of a rough hack, but graylog currently (v0.20.2)
48
+ # doesn't prevent the creation of duplicate conflicting inputs.
49
+ if ! curl -s --user #{rubber_env.graylog_web_username}:#{rubber_env.graylog_web_password} -XGET http://localhost:12900/system/inputs | grep "GELFUDPInput" &> /dev/null; then
50
+ curl --user #{rubber_env.graylog_web_username}:#{rubber_env.graylog_web_password} -XPOST http://localhost:12900/system/inputs -H "Content-Type: application/json" -d '{"type": "org.graylog2.inputs.gelf.udp.GELFUDPInput", "creator_user_id": "admin", "title": "gelf-udp", "global": true, "configuration": { "port": #{rubber_env.graylog_server_port}, "bind_address": "0.0.0.0" } }'
51
+ fi
52
+
53
+ if ! curl -s --user #{rubber_env.graylog_web_username}:#{rubber_env.graylog_web_password} -XGET http://localhost:12900/system/inputs | grep "SyslogUDPInput" &> /dev/null; then
54
+ curl --user #{rubber_env.graylog_web_username}:#{rubber_env.graylog_web_password} -XPOST http://localhost:12900/system/inputs -H "Content-Type: application/json" -d '{"type": "org.graylog2.inputs.syslog.udp.SyslogUDPInput", "creator_user_id": "admin", "title": "syslog-udp", "global": true, "configuration": { "port": #{rubber_env.graylog_server_syslog_port}, "bind_address": "0.0.0.0" } }'
55
+ fi
56
+ ENDSCRIPT
57
+ end
58
+
43
59
  desc "Stops the graylog server"
44
60
  task :stop, :roles => :graylog_server, :on_error => :continue do
45
61
  rsudo "service graylog-server stop || true"
@@ -84,18 +100,10 @@ namespace :rubber do
84
100
  rubber.run_config(:file => "role/graylog_web/", :force => true, :deploy_path => release_path)
85
101
 
86
102
  restart
103
+ sleep 5 # Give graylog-web a bit of time to start up.
87
104
  end
88
105
  end
89
106
 
90
- after "rubber:graylog:web:bootstrap", "rubber:graylog:web:create_inputs"
91
-
92
- task :create_inputs, :roles => :graylog_web do
93
- rubber.sudo_script 'create_inputs', <<-ENDSCRIPT
94
- curl --user #{rubber_env.graylog_web_username}:#{rubber_env.graylog_web_password} -XPOST http://localhost:12900/system/inputs -H "Content-Type: application/json" -d '{"type": "org.graylog2.inputs.gelf.udp.GELFUDPInput", "creator_user_id": "admin", "title": "gelf-udp", "global": true, "configuration": { "port": #{rubber_env.graylog_server_port}, "bind_address": "0.0.0.0" } }'
95
- curl --user #{rubber_env.graylog_web_username}:#{rubber_env.graylog_web_password} -XPOST http://localhost:12900/system/inputs -H "Content-Type: application/json" -d '{"type": "org.graylog2.inputs.syslog.udp.SyslogUDPInput", "creator_user_id": "admin", "title": "syslog-udp", "global": true, "configuration": { "port": #{rubber_env.graylog_server_syslog_port}, "bind_address": "0.0.0.0" } }'
96
- ENDSCRIPT
97
- end
98
-
99
107
  desc "Stops the graylog web"
100
108
  task :stop, :roles => :graylog_web, :on_error => :continue do
101
109
  rsudo "service graylog-web stop || true"
@@ -1,5 +1,6 @@
1
1
  <%
2
2
  @path = "/etc/graylog2.conf"
3
+ @delayed_post = "service graylog-server restart"
3
4
 
4
5
  require 'digest/sha2'
5
6
  root_password_sha2 = (Digest::SHA2.new << rubber_env.graylog_web_password).to_s
@@ -23,6 +24,8 @@ root_username = <%= rubber_env.graylog_web_username %>
23
24
 
24
25
  # You MUST specify a hash password for the root user (which you only need to initially set up the
25
26
  # system and in case you lose connectivity to your authentication backend)
27
+ # This password cannot be changed using the API or via the web interface. If you need to change it,
28
+ # modify it in this file.
26
29
  # Create one by using for example: echo -n yourpassword | shasum -a 256
27
30
  # and put the resulting hash value into the following line
28
31
  root_password_sha2 = <%= root_password_sha2 %>
@@ -38,6 +41,15 @@ rest_listen_uri = http://<%= rubber_instances[rubber_env.host].internal_ip %>:12
38
41
  # address. (see rest_listen_uri)
39
42
  rest_transport_uri = http://<%= rubber_instances[rubber_env.host].internal_ip %>:12900/
40
43
 
44
+ # Enable CORS headers for REST api. This is necessary for JS-clients accessing the server directly.
45
+ # If these are disabled, modern browsers will not be able to retrieve resources from the server.
46
+ # This is disabled by default. Uncomment the next line to enable it.
47
+ #rest_enable_cors = true
48
+
49
+ # Enable GZIP support for REST api. This compresses API responses and therefore helps to reduce
50
+ # overall round trip times. This is disabled by default. Uncomment the next line to enable it.
51
+ #rest_enable_gzip = true
52
+
41
53
  # Embedded elasticsearch configuration file
42
54
  # pay attention to the working directory of the server, maybe use an absolute path here
43
55
  elasticsearch_config_file = /etc/graylog2-elasticsearch.yml
@@ -60,6 +72,14 @@ elasticsearch_replicas = 0
60
72
 
61
73
  elasticsearch_index_prefix = graylog2
62
74
 
75
+ # Do you want to allow searches with leading wildcards? This can be extremely resource hungry and should only
76
+ # be enabled with care. See also: http://support.torch.sh/help/kb/graylog2-web-interface/the-search-bar-explained
77
+ allow_leading_wildcard_searches = false
78
+
79
+ # Do you want to allow searches to be highlighted? Depending on the size of your messages this can be memory hungry and
80
+ # should only be enabled after making sure your elasticsearch cluster has enough memory.
81
+ allow_highlighting = false
82
+
63
83
  # settings to be passed to elasticsearch's client (overriding those in the provided elasticsearch_config_file)
64
84
  # all these
65
85
  # this must be the same as for your elasticsearch cluster
@@ -80,6 +100,13 @@ elasticsearch_node_name = <%= rubber_env.host %>
80
100
  elasticsearch_discovery_zen_ping_multicast_enabled = false
81
101
  elasticsearch_discovery_zen_ping_unicast_hosts = <%= es_servers %>
82
102
 
103
+ # the following settings allow to change the bind addresses for the elasticsearch client in graylog2
104
+ # these settings are empty by default, letting elasticsearch choose automatically,
105
+ # override them here or in the 'elasticsearch_config_file' if you need to bind to a special address
106
+ # refer to http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/modules-network.html for special values here
107
+ # elasticsearch_network_host =
108
+ # elasticsearch_network_bind_host =
109
+ # elasticsearch_network_publish_host =
83
110
 
84
111
  # Analyzer (tokenizer) to use for message and full_message field. The "standard" filter usually is a good idea.
85
112
  # All supported analyzers are: standard, simple, whitespace, stop, keyword, pattern, language, snowball, custom
@@ -117,6 +144,18 @@ processor_wait_strategy = blocking
117
144
  # Must be a power of 2. (512, 1024, 2048, ...)
118
145
  ring_size = 1024
119
146
 
147
+ # EXPERIMENTAL: Dead Letters
148
+ # Every failed indexing attempt is logged by default and made visible in the web-interface. You can enable
149
+ # the experimental dead letters feature to write every message that was not successfully indexed into the
150
+ # MongoDB "dead_letters" collection to make sure that you never lose a message. The actual writing of dead
151
+ # letter should work fine already but it is not heavily tested yet and will get more features in future
152
+ # releases.
153
+ dead_letters_enabled = false
154
+
155
+ # How many seconds to wait between marking node as DEAD for possible load balancers and starting the actual
156
+ # shutdown process. Set to 0 if you have no status checking load balancers in front.
157
+ lb_recognition_period_seconds = 3
158
+
120
159
  # MongoDB Configuration
121
160
  mongodb_useauth = false
122
161
  #mongodb_user = grayloguser
@@ -134,48 +173,28 @@ mongodb_max_connections = 100
134
173
  # http://api.mongodb.org/java/current/com/mongodb/MongoOptions.html#threadsAllowedToBlockForConnectionMultiplier
135
174
  mongodb_threads_allowed_to_block_multiplier = 5
136
175
 
137
-
138
176
  # Drools Rule File (Use to rewrite incoming log messages)
139
177
  # See: http://support.torch.sh/help/kb/graylog2-server/custom-message-rewritingprocessing
140
178
  # rules_file = /etc/graylog2.drl
141
179
 
142
180
  # Email transport
143
- transport_email_enabled = false
181
+ transport_email_enabled = true
144
182
  transport_email_protocol = smtp
145
- transport_email_hostname = mail.example.com
146
- transport_email_port = 587
147
- transport_email_use_auth = true
148
- transport_email_use_tls = true
183
+ transport_email_hostname = localhost
184
+ transport_email_port = 25
185
+ transport_email_use_auth = false
186
+ transport_email_use_tls = false
187
+ transport_email_use_ssl = false
149
188
  transport_email_auth_username = you@example.com
150
189
  transport_email_auth_password = secret
151
- transport_email_subject_prefix = [graylog2]
152
- transport_email_from_email = graylog2@example.com
190
+ transport_email_subject_prefix = <%= Rubber.env == 'production' ? '[graylog2]' : "[graylog2-#{Rubber.env}]" %>
191
+ transport_email_from_email = <%= Rubber.env == 'production' ? 'graylog' : "graylog-#{Rubber.env}" %>@<%= rubber_env.domain %>
153
192
  transport_email_from_name = Graylog2
154
- transport_email_web_interface_url = http://your-graylog2.example.org
155
-
156
- # Jabber/XMPP transport
157
- transport_jabber_enabled = false
158
- transport_jabber_hostname = jabber.example.com
159
- transport_jabber_port = 5222
160
- transport_jabber_use_sasl_auth = true
161
- transport_jabber_allow_selfsigned_certs = false
162
- transport_jabber_auth_username = your_user
163
- transport_jabber_auth_password = secret
164
- transport_jabber_message_prefix = [graylog2]
165
-
166
- # Additional modules
167
- # Graphite
168
- #enable_graphite_output = false
169
- #graphite_carbon_host = 127.0.0.1
170
- #graphite_carbon_tcp_port = 2003
171
- #graphite_prefix = logs
172
-
173
- # Librato Metrics (http://support.torch.sh/help/kb/graylog2-server/using-librato-metrics-with-graylog2)
174
- #enable_libratometrics_output = false
175
- #enable_libratometrics_system_metrics = false
176
- #libratometrics_api_user = you@example.com
177
- #libratometrics_api_token = abcdefg12345
178
- #libratometrics_prefix = gl2-
179
- #libratometrics_interval = 60
180
- #libratometrics_stream_filter =
181
- #libratometrics_host_filter =
193
+
194
+ # Specify and uncomment this if you want to include links to the stream in your stream alert mails.
195
+ # This should define the fully qualified base url to your web interface exactly the same way as it is accessed by your users.
196
+ #
197
+ transport_email_web_interface_url = https://graylog-<%= rubber_env.full_host %>:<%= rubber_env.web_tools_ssl_port %>/
198
+
199
+ # HTTP proxy for outgoing HTTP calls
200
+ #http_proxy_uri =
@@ -6,6 +6,9 @@
6
6
  # graylog2-server REST URIs (one or more, comma separated) For example: "http://127.0.0.1:12900/,http://127.0.0.1:12910/"
7
7
  graylog2-server.uris="<%= graylog_server_uris %>"
8
8
 
9
+ # Learn how to configure custom logging in the documentation:
10
+ # http://support.torch.sh/help/kb/graylog2-web-interface/configuring-web-interface-logging
11
+
9
12
  # Secret key
10
13
  # ~~~~~
11
14
  # The secret key is used to secure cryptographics functions. Set this to a long and randomly generated string.
@@ -17,3 +20,15 @@ application.secret="<%= rubber_env.graylog_web_secret %>"
17
20
  # Graylog2 stores all timestamps in UTC. To properly display times, set the default timezone of the interface.
18
21
  # If you leave this out, Graylog2 will pick your system default as the timezone. Usually you will want to configure it explicitly.
19
22
  timezone="<%= rubber_env.timezone %>"
23
+
24
+ # Message field limit
25
+ # Your web interface can cause high load in your browser when you have a lot of different message fields. The default
26
+ # limit of message fields is 100. Set it to 0 if you always want to get all fields. They are for example used in the
27
+ # search result sidebar or for autocompletion of field names.
28
+ field_list_limit=100
29
+
30
+ # Use this to run Graylog2 with a path prefix
31
+ #application.context=/graylog2
32
+
33
+ # You usually do not want to change this.
34
+ application.global=lib.Global
@@ -1,11 +1,11 @@
1
- graylog_server_version: "0.20.1"
1
+ graylog_server_version: "0.20.2"
2
2
  graylog_server_prefix: "/usr/local"
3
3
  graylog_server_dir: "#{graylog_server_prefix}/graylog2-server-#{graylog_server_version}"
4
4
  graylog_server_pid_file: "/var/run/graylog-server.pid"
5
5
  graylog_server_port: 12201
6
6
  graylog_server_syslog_port: 12514
7
7
 
8
- graylog_web_version: "0.20.1"
8
+ graylog_web_version: "0.20.2"
9
9
  graylog_web_prefix: "/usr/local"
10
10
  graylog_web_dir: "#{graylog_web_prefix}/graylog2-web-interface-#{graylog_web_version}"
11
11
  graylog_web_pid_file: "/var/run/graylog-web.pid"
@@ -22,6 +22,10 @@ web_tools_proxies:
22
22
  role: graylog_web
23
23
  port: "#{graylog_web_port}"
24
24
  path: /
25
+ graylog_server_api_browser:
26
+ role: graylog_server
27
+ port: 12900
28
+ path: /api-browser/
25
29
 
26
30
  role_dependencies:
27
31
  graylog_server: [graylog_mongodb, graylog_elasticsearch]
@@ -0,0 +1,24 @@
1
+ <%
2
+ @path = '/etc/monit/monit.d/monit-delayed_job.conf'
3
+ current_path = "/mnt/#{rubber_env.app_name}-#{Rubber.env}/current"
4
+
5
+ bin_path = "bin/delayed_job"
6
+ script_path = "script/delayed_job"
7
+ script_path = File.exists?(bin_path) ? bin_path : script_path
8
+ %>
9
+
10
+ <% if rubber_env.num_delayed_job_workers == 1 %>
11
+ check process delayed_job
12
+ with pidfile <%= rubber_env.delayed_job_pid_dir %>/delayed_job.pid
13
+ start program = "/usr/bin/sudo -H -u #{rubber_env.app_user} /bin/bash -l -c 'cd <%= current_path %> && RAILS_ENV=<%= Rubber.env %> bundle exec <%= script_path %> start --pid-dir=<%= rubber_env.delayed_job_pid_dir %>'" with timeout 600 seconds
14
+ stop program = "/usr/bin/sudo -H -u #{rubber_env.app_user} /bin/bash -l -c 'cd <%= current_path %> && RAILS_ENV=<%= Rubber.env %> bundle exec <%= script_path %> stop --pid-dir=<%= rubber_env.delayed_job_pid_dir %>'" with timeout 600 seconds
15
+ <% else %>
16
+ <% rubber_env.num_delayed_job_workers.times do |id| %>
17
+ check process delayed_job_<%= id %>
18
+ with pidfile <%= rubber_env.delayed_job_pid_dir %>/delayed_job.<%= id %>.pid
19
+ start program = "/usr/bin/sudo -H -u #{rubber_env.app_user} /bin/bash -l -c 'cd <%= current_path %> && RAILS_ENV=<%= Rubber.env %> bundle exec <%= script_path %> start -i <%= id %> --pid-dir=<%= rubber_env.delayed_job_pid_dir %>'" with timeout 600 seconds
20
+ stop program = "/usr/bin/sudo -H -u #{rubber_env.app_user} /bin/bash -l -c 'cd <%= current_path %> && RAILS_ENV=<%= Rubber.env %> bundle exec <%= script_path %> stop -i <%= id %> --pid-dir=<%= rubber_env.delayed_job_pid_dir %>'" with timeout 600 seconds
21
+ group delayed_job
22
+ <% end %>
23
+ <% end %>
24
+ if 5 restarts within 5 cycles then timeout
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  @path = '/etc/monit/monit.d/monit-unicorn.conf'
3
3
  %>
4
- check process unicorn with pidfile /var/run/unicorn.pid
4
+ check process unicorn with pidfile <%= rubber_env.unicorn_pid_file %>
5
5
  group unicorn-<%= Rubber.env %>
6
6
  start program = "/usr/bin/env service unicorn start"
7
7
  stop program = "/usr/bin/env service unicorn stop"
@@ -4,34 +4,14 @@ namespace :rubber do
4
4
 
5
5
  rubber.allow_optional_tasks(self)
6
6
 
7
- after "rubber:install_gems", "rubber:passenger_nginx:custom_install"
8
-
9
- task :custom_install, :roles => :passenger_nginx do
10
- rubber.sudo_script 'install_passenger_nginx', <<-ENDSCRIPT
11
- # Check if there is an nginx with the required version and passenger built in.
12
- if [ -x /usr/sbin/nginx ]
13
- then echo 'Found nginx on system'
14
- if [ $(find #{rubber_env.ruby_path} -regex .*passenger-#{rubber_env.passenger_version}.*PassengerWatchdog | wc -l) -gt 0 ]
15
- then echo 'Found passenger-nginx-module on system'
16
- pax=$(/usr/sbin/nginx -V 2>&1 | awk '/nginx\\/#{rubber_env.nginx_version}/{a++}/passenger-#{rubber_env.passenger_version}/{b++} END {print a&&b}')
17
- if [ $pax -eq 1 ]
18
- then echo 'Nginx/Passenger version matches'
19
- exit 0
20
- fi
21
- fi
22
- fi
23
- # Lets install
24
- echo 'Installing / Upgrading nginx #{rubber_env.nginx_version}'
25
- TMPDIR=`mktemp -d` || exit 1
26
- cd $TMPDIR
27
- echo 'Downloading'
28
- wget -qN http://nginx.org/download/nginx-#{rubber_env.nginx_version}.tar.gz
29
- echo 'Unpacking'
30
- tar xf nginx-#{rubber_env.nginx_version}.tar.gz
31
- passenger-install-nginx-module --auto --prefix=/opt/nginx --nginx-source-dir=$TMPDIR/nginx-#{rubber_env.nginx_version} --extra-configure-flags="--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --sbin-path=/usr/sbin/nginx --with-http_gzip_static_module"
7
+ before "rubber:install_packages", "rubber:passenger_nginx:setup_apt_sources"
8
+ task :setup_apt_sources do
9
+ rubber.sudo_script 'configure_passenger_nginx_repository', <<-ENDSCRIPT
10
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
11
+ add-apt-repository -y https://oss-binaries.phusionpassenger.com/apt/passenger
32
12
  ENDSCRIPT
33
13
  end
34
-
14
+
35
15
  after "rubber:setup_app_permissions", "rubber:passenger_nginx:setup_passenger_permissions"
36
16
 
37
17
  task :setup_passenger_permissions, :roles => :passenger_nginx do
@@ -71,18 +51,5 @@ namespace :rubber do
71
51
  serial_reload
72
52
  end
73
53
 
74
-
75
- deploy.task :restart, :roles => :passenger_nginx do
76
- end
77
-
78
- deploy.task :reload, :roles => :passenger_nginx do
79
- end
80
-
81
- deploy.task :stop, :roles => :passenger_nginx do
82
- end
83
-
84
- deploy.task :start, :roles => :passenger_nginx do
85
- end
86
-
87
54
  end
88
55
  end
@@ -9,6 +9,9 @@ worker_rlimit_nofile 10240;
9
9
 
10
10
  pid /var/run/nginx.pid;
11
11
 
12
+ # Preserve the system path (needed for things like imagemagick + ghostscript)
13
+ env PATH;
14
+
12
15
  events
13
16
  {
14
17
  worker_connections 8192;
@@ -44,20 +47,19 @@ http
44
47
  error_log <%= rubber_env.nginx_log_dir %>/error.log notice;
45
48
  access_log <%= rubber_env.nginx_log_dir %>/access.log main;
46
49
 
47
- passenger_root <%= rubber_env.passenger_root %>;
48
- passenger_ruby <%= rubber_env.passenger_ruby %>;
50
+ passenger_root <%= rubber_env.passenger_root %>;
51
+ passenger_ruby <%= rubber_env.passenger_ruby %>;
49
52
 
50
- passenger_max_pool_size <%= rubber_env.max_app_connections %>;
51
- passenger_min_instances <%= rubber_env.max_app_connections %>;
52
- passenger_max_instances_per_app 0;
53
- passenger_pool_idle_time 0;
54
- rails_framework_spawner_idle_time 0;
55
- rails_app_spawner_idle_time 0;
53
+ passenger_max_pool_size <%= rubber_env.max_app_connections %>;
54
+ passenger_min_instances <%= rubber_env.max_app_connections %>;
55
+ passenger_max_instances_per_app 0;
56
+ passenger_pool_idle_time 0;
57
+ passenger_max_preloader_idle_time 0;
56
58
  rails_env <%= Rubber.env %>;
57
- passenger_friendly_error_pages <%= Rubber.env == 'production' ? 'off' : 'on' %>;
58
-
59
- passenger_user <%= rubber_env.app_user %>;
60
-
59
+ passenger_friendly_error_pages <%= Rubber.env == 'production' ? 'off' : 'on' %>;
60
+
61
+ passenger_user <%= rubber_env.app_user %>;
62
+
61
63
  include /etc/nginx/rubber/passenger_nginx.conf;
62
64
  <% if rubber_instances[rubber_env.host].role_names.include?('web_tools') %>
63
65
  include /etc/nginx/rubber/tools.conf;
@@ -1,13 +1,9 @@
1
- passenger_version: 3.0.19
2
- nginx_version: 1.2.8
3
- passenger_root: "#{`bash -l -c 'find #{ruby_path} -name passenger-#{passenger_version}'`.strip}"
1
+ passenger_root: "/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini"
4
2
  passenger_ruby: "#{ruby_path}/bin/ruby"
5
- passenger_lib: "#{passenger_root}/ext/nginx"
6
3
  nginx_log_dir: /mnt/nginx/logs
7
4
  passenger_listen_port: 7000
8
5
  passenger_listen_ssl_port: 7001
9
6
  max_app_connections: 20
10
- nginx_log_dir: /mnt/nginx/logs
11
7
 
12
8
  use_ssl_key: false
13
9
  #if you use an ssl key, put your cert and key
@@ -18,5 +14,4 @@ use_ssl_key: false
18
14
 
19
15
  roles:
20
16
  passenger_nginx:
21
- packages: [libcurl4-openssl-dev, libpcre3-dev]
22
- gems: [[passenger, "#{passenger_version}"]]
17
+ packages: [libcurl4-openssl-dev, libpcre3-dev, nginx-extras, passenger]
@@ -7,18 +7,13 @@ namespace :rubber do
7
7
 
8
8
  before "deploy:stop", "rubber:unicorn:stop"
9
9
  after "deploy:start", "rubber:unicorn:start"
10
- after "deploy:restart", "rubber:unicorn:reload"
10
+ after "deploy:restart", "rubber:unicorn:upgrade"
11
11
 
12
12
  desc "Stops the unicorn server"
13
13
  task :stop, :roles => :unicorn do
14
14
  rsudo "service unicorn stop"
15
15
  end
16
16
 
17
- desc "Forcefully kills the unicorn server"
18
- task :force_stop, :roles => :unicorn do
19
- rsudo "service unicorn force-stop"
20
- end
21
-
22
17
  desc "Starts the unicorn server"
23
18
  task :start, :roles => :unicorn do
24
19
  rsudo "service unicorn start"
@@ -30,16 +25,20 @@ namespace :rubber do
30
25
  end
31
26
 
32
27
  desc "Reloads the unicorn web server"
33
- task :reload, :roles => :unicorn do
28
+ task :upgrade, :roles => :unicorn do
34
29
  rsudo "service unicorn upgrade"
35
30
  end
36
31
 
32
+ desc "Forcefully kills the unicorn server"
33
+ task :kill, :roles => :unicorn do
34
+ rsudo "service unicorn kill"
35
+ end
37
36
 
38
37
  desc "Display status of the unicorn web server"
39
38
  task :status, :roles => :unicorn do
40
- # "service unicorn status" always returns "unicorn stop/waiting"
39
+ rsudo "service unicorn status || true"
41
40
  rsudo "ps -eopid,user,cmd | grep [u]nicorn || true"
42
- rsudo "netstat -tupan | grep unicorn || true"
41
+ # rsudo "netstat -tupan | grep unicorn || true"
43
42
  end
44
43
 
45
44
  end
@@ -10,9 +10,9 @@ set -e
10
10
  # since nginx and unicorn accept the same signals
11
11
 
12
12
  # Feel free to change any of the following variables for your app:
13
- TIMEOUT=${TIMEOUT-60}
13
+ TIMEOUT=${TIMEOUT-600}
14
14
  APP_ROOT=<%= current_path %>
15
- PID=/var/run/unicorn.pid
15
+ PID=<%= rubber_env.unicorn_pid_file %>
16
16
  CMD="<%= "bundle exec unicorn_rails -c #{current_path}/config/unicorn.rb -E #{Rubber.env} -D" %>"
17
17
  action="$1"
18
18
  set -u
@@ -38,7 +38,7 @@ stop)
38
38
  sig QUIT && exit 0
39
39
  echo >&2 "Not running"
40
40
  ;;
41
- force-stop)
41
+ kill)
42
42
  sig TERM && exit 0
43
43
  echo >&2 "Not running"
44
44
  ;;
@@ -50,42 +50,52 @@ restart|reload)
50
50
  upgrade)
51
51
  if sig USR2
52
52
  then
53
- printf 'Waiting for new workers'
53
+ printf 'Waiting for new Unicorn workers'
54
54
  n=$TIMEOUT
55
55
  while (! (test -s $PID && ps --no-headers --ppid `cat $PID` > /dev/null)) && test $n -ge 0
56
56
  do
57
- printf '.' && sleep 1 && n=$(( $n - 1 ))
57
+ printf '.' && sleep 10 && n=$(( $n - 10 ))
58
58
  done
59
- if test ! -s $old_pid
59
+
60
+ if test $n -lt 0 && (! (test -s $PID && ps --no-headers --ppid `cat $PID` > /dev/null))
60
61
  then
61
- echo
62
- echo >&2 'New workers failed to start; see error log'
62
+ echo >&2 "$PID process does not exist after $TIMEOUT seconds"
63
63
  exit 1
64
64
  fi
65
- printf '\nStopping old master' && oldsig QUIT
66
-
67
- n=$TIMEOUT
68
- while test -s $old_pid && test $n -ge 0
69
- do
70
- printf '.' && sleep 1 && n=$(( $n - 1 ))
71
- done
72
- echo
65
+ printf '\nNew Unicorn workers started'
73
66
 
74
- if test $n -lt 0 && test -s $old_pid
67
+ if test -s $old_pid
75
68
  then
76
- echo >&2 "$old_pid still exists after $TIMEOUT seconds"
77
- exit 1
69
+ printf '\nWaiting for old Unicorn master to stop'
70
+ n=$TIMEOUT
71
+ while test -s $old_pid && test $n -ge 0
72
+ do
73
+ printf '.' && sleep 10 && n=$(( $n - 10 ))
74
+ done
75
+ echo
76
+
77
+ if test $n -lt 0 && test -s $old_pid
78
+ then
79
+ echo >&2 "$old_pid still exists after $TIMEOUT seconds"
80
+ exit 1
81
+ fi
78
82
  fi
83
+
84
+ printf '\nOld Unicorn master stopped'
79
85
  exit 0
80
86
  fi
81
87
  echo >&2 "Couldn't upgrade, starting '$CMD' instead"
82
88
  $CMD
83
89
  ;;
90
+ status)
91
+ sig 0 && echo >&2 "Running" && exit 1
92
+ echo >&2 "Stopped" && exit 0
93
+ ;;
84
94
  reopen-logs)
85
95
  sig USR1
86
96
  ;;
87
97
  *)
88
- echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
98
+ echo >&2 "Usage: $0 <start|stop|restart|upgrade|kill|status|reopen-logs>"
89
99
  exit 1
90
100
  ;;
91
101
  esac
@@ -2,7 +2,7 @@
2
2
  @path = "#{Rubber.root}/config/unicorn.rb"
3
3
  current_path = "/mnt/#{rubber_env.app_name}-#{Rubber.env}/current"
4
4
  %>
5
- worker_processes 2
5
+ worker_processes <%= rubber_env.unicorn_num_workers %>
6
6
  working_directory "<%= Rubber.root %>"
7
7
 
8
8
  # This loads the application in the master process before forking
@@ -17,7 +17,7 @@ timeout 30
17
17
  # We will point the upstream Nginx module to this socket later on
18
18
  listen "/var/run/unicorn.sock", :backlog => 64
19
19
 
20
- pid "/var/run/unicorn.pid"
20
+ pid "<%= rubber_env.unicorn_pid_file %>"
21
21
 
22
22
  # Set the path of the log files inside the log folder of the testapp
23
23
  stderr_path "<%= Rubber.root %>/log/unicorn.stderr.log"
@@ -41,12 +41,12 @@ before_fork do |server, worker|
41
41
  # we send it a QUIT.
42
42
  #
43
43
  # Using this method we get 0 downtime deploys.
44
- old_pid = "/var/run/unicorn.pid.oldbin"
44
+ old_pid = server.config[:pid].sub('.pid', '.pid.oldbin')
45
45
  if File.exists?(old_pid) && server.pid != old_pid
46
46
  begin
47
47
  Process.kill("QUIT", File.read(old_pid).to_i)
48
48
  rescue Errno::ENOENT, Errno::ESRCH
49
- # someone else did our job for us
49
+ STDERR.puts "WARNING: old Unicorn process was already killed before new process forked."
50
50
  end
51
51
  end
52
52
 
@@ -74,7 +74,7 @@ after_fork do |server, worker|
74
74
  end
75
75
  rescue => e
76
76
  if RAILS_ENV == 'development'
77
- STDERR.puts "couldn't change user, oh well"
77
+ STDERR.puts "WARNING: could not set user on Unicorn workers."
78
78
  else
79
79
  raise e
80
80
  end
@@ -84,4 +84,4 @@ after_fork do |server, worker|
84
84
  # processes
85
85
  defined?(ActiveRecord::Base) and
86
86
  ActiveRecord::Base.establish_connection
87
- end
87
+ end
@@ -1,5 +1,8 @@
1
+ unicorn_num_workers: 2
2
+ unicorn_pid_file: /var/run/unicorn.pid
3
+
1
4
  role_dependencies:
2
5
  unicorn: [nginx]
3
6
  roles:
4
7
  unicorn:
5
- gems: [unicorn]
8
+ gems: [unicorn]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Conway
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-02 00:00:00.000000000 Z
12
+ date: 2014-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -357,7 +357,6 @@ files:
357
357
  - templates/cruise/config/rubber/rubber-cruise.yml
358
358
  - templates/cruise/templates.yml
359
359
  - templates/delayed_job/config/rubber/deploy-delayed_job.rb
360
- - templates/delayed_job/config/rubber/role/delayed_job/monit-delayed_job.conf
361
360
  - templates/delayed_job/config/rubber/rubber-delayed_job.yml
362
361
  - templates/delayed_job/templates.yml
363
362
  - templates/discourse/config/rubber/deploy-discourse.rb
@@ -454,6 +453,7 @@ files:
454
453
  - templates/monit/config/rubber/role/apache/monit-apache.conf
455
454
  - templates/monit/config/rubber/role/cassandra/monit-cassandra.conf
456
455
  - templates/monit/config/rubber/role/couchbase/monit-couchbase.conf
456
+ - templates/monit/config/rubber/role/delayed_job/monit-delayed_job.conf
457
457
  - templates/monit/config/rubber/role/elasticsearch/monit-elasticsearch.conf
458
458
  - templates/monit/config/rubber/role/graphite_server/monit-graphite_server.conf
459
459
  - templates/monit/config/rubber/role/graylog_server/monit-graylog_server.conf
@@ -490,9 +490,6 @@ files:
490
490
  - templates/munin/config/rubber/role/passenger/munin-passenger-memory.conf
491
491
  - templates/munin/config/rubber/role/passenger/munin-passenger-sudoers.conf
492
492
  - templates/munin/config/rubber/role/passenger/munin-passenger.conf
493
- - templates/munin/config/rubber/role/passenger_nginx/munin-passenger-memory.conf
494
- - templates/munin/config/rubber/role/passenger_nginx/munin-passenger-sudoers.conf
495
- - templates/munin/config/rubber/role/passenger_nginx/munin-passenger.conf
496
493
  - templates/munin/config/rubber/role/postgresql/munin-postgresql.conf
497
494
  - templates/munin/config/rubber/role/web_tools/munin-nginx.conf
498
495
  - templates/munin/config/rubber/role/web_tools/munin-plugins.conf
@@ -543,7 +540,6 @@ files:
543
540
  - templates/passenger_nginx/config/rubber/deploy-passenger_nginx.rb
544
541
  - templates/passenger_nginx/config/rubber/role/passenger_nginx/application.conf
545
542
  - templates/passenger_nginx/config/rubber/role/passenger_nginx/crontab
546
- - templates/passenger_nginx/config/rubber/role/passenger_nginx/nginx
547
543
  - templates/passenger_nginx/config/rubber/role/passenger_nginx/nginx.conf
548
544
  - templates/passenger_nginx/config/rubber/role/passenger_nginx/passenger_nginx.conf
549
545
  - templates/passenger_nginx/config/rubber/role/web_tools/nginx-tools.conf
@@ -1,18 +0,0 @@
1
- <%
2
- @path = '/etc/monit/monit.d/monit-delayed_job.conf'
3
- %>
4
-
5
- <% if rubber_env.num_delayed_job_workers == 1 %>
6
- check process delayed_job
7
- with pidfile <%= Rubber.root %>/tmp/pids/delayed_job.pid
8
- start program = "/usr/bin/sudo -H -u <%= rubber_env.app_user %> /bin/bash -l -c 'RAILS_ENV=<%= Rubber.env %> <%= Rubber.root %>/script/delayed_job start'"
9
- stop program = "/usr/bin/sudo -H -u <%= rubber_env.app_user %> /bin/bash -l -c 'RAILS_ENV=<%= Rubber.env %> <%= Rubber.root %>/script/delayed_job stop'"
10
- <% else %>
11
- <% rubber_env.num_delayed_job_workers.times do |id| %>
12
- check process delayed_job_<%= id %>
13
- with pidfile <%= Rubber.root %>/tmp/pids/delayed_job.<%= id %>.pid
14
- start program = "/usr/bin/sudo -H -u <%= rubber_env.app_user %> /bin/bash -l -c 'RAILS_ENV=<%= Rubber.env %> <%= Rubber.root %>/script/delayed_job start -i <%= id %>'"
15
- stop program = "/usr/bin/sudo -H -u <%= rubber_env.app_user %> /bin/bash -l -c 'RAILS_ENV=<%= Rubber.env %> <%= Rubber.root %>/script/delayed_job stop -i <%= id %>'"
16
- group delayed_job
17
- <% end %>
18
- <% end %>
@@ -1,34 +0,0 @@
1
- <%
2
- @path = "/etc/munin/plugins/passenger_memory_status"
3
- @perms = 0755
4
- %>#!/usr/bin/env ruby
5
- # put in /etc/munin/plugins and restart munin-node
6
- # by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin
7
- # NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats
8
-
9
- def output_config
10
- puts <<-END
11
- graph_category App
12
- graph_title Passenger memory stats
13
- graph_vlabel megabytes
14
-
15
- memory.label memory
16
- END
17
- exit 0
18
- end
19
-
20
- def output_values
21
- status = `sudo <%= rubber_env.ruby_path %>/bin/passenger-memory-stats | tail -1`
22
- unless $?.success?
23
- $stderr.puts "failed executing passenger-memory-stats"
24
- exit 1
25
- end
26
- status =~ /(\d+\.\d+)/
27
- puts "memory.value #{$1}"
28
- end
29
-
30
- if ARGV[0] == "config"
31
- output_config
32
- else
33
- output_values
34
- end
@@ -1,8 +0,0 @@
1
- <%
2
- @path = '/etc/sudoers'
3
- @additive = ["# munin passenger start", "# munin passenger end"]
4
- %>
5
- Defaults env_keep = GEM_PATH
6
-
7
- nobody ALL=(ALL) NOPASSWD: <%= rubber_env.ruby_path %>/bin/passenger-status
8
- nobody ALL=(ALL) NOPASSWD: <%= rubber_env.ruby_path %>/bin/passenger-memory-stats
@@ -1,47 +0,0 @@
1
- <%
2
- @path = "/etc/munin/plugins/passenger_status"
3
- @perms = 0755
4
- %>#!/usr/bin/env ruby
5
-
6
- # from http://gist.github.com/21328
7
- # by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin
8
-
9
- def output_config
10
- puts <<-END
11
- graph_category App
12
- graph_title passenger status
13
- graph_vlabel count
14
-
15
- sessions.label sessions
16
- max.label max processes
17
- running.label running processes
18
- active.label active processes
19
- END
20
- exit 0
21
- end
22
-
23
- def output_values
24
- status = `sudo <%= rubber_env.ruby_path %>/bin/passenger-status`
25
- unless $?.success?
26
- $stderr.puts "failed executing passenger-status"
27
- exit 1
28
- end
29
- status =~ /max\s+=\s+(\d+)/
30
- puts "max.value #{$1}"
31
-
32
- status =~ /count\s+=\s+(\d+)/
33
- puts "running.value #{$1}"
34
-
35
- status =~ /active\s+=\s+(\d+)/
36
- puts "active.value #{$1}"
37
-
38
- total_sessions = 0
39
- status.scan(/Sessions: (\d+)/).flatten.each { |count| total_sessions += count.to_i }
40
- puts "sessions.value #{total_sessions}"
41
- end
42
-
43
- if ARGV[0] == "config"
44
- output_config
45
- else
46
- output_values
47
- end
@@ -1,101 +0,0 @@
1
- <%
2
- @path = "/etc/init.d/nginx"
3
- @perms = 0755
4
- @post = "/usr/sbin/update-rc.d -f nginx defaults"
5
- @backup = false
6
- %>#!/bin/sh
7
-
8
- ### BEGIN INIT INFO
9
- # Provides: nginx
10
- # Required-Start: $local_fs $remote_fs $network $syslog
11
- # Required-Stop: $local_fs $remote_fs $network $syslog
12
- # Default-Start: 2 3 4 5
13
- # Default-Stop: 0 1 6
14
- # Short-Description: starts the nginx web server
15
- # Description: starts nginx using start-stop-daemon
16
- ### END INIT INFO
17
-
18
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
19
- DAEMON=/usr/sbin/nginx
20
- NAME=nginx
21
- DESC=nginx
22
-
23
- # Include nginx defaults if available
24
- if [ -f /etc/default/nginx ]; then
25
- . /etc/default/nginx
26
- fi
27
-
28
- test -x $DAEMON || exit 0
29
-
30
- set -e
31
-
32
- . /lib/lsb/init-functions
33
-
34
- test_nginx_config() {
35
- if $DAEMON -t $DAEMON_OPTS >/dev/null 2>&1; then
36
- return 0
37
- else
38
- $DAEMON -t $DAEMON_OPTS
39
- return $?
40
- fi
41
- }
42
-
43
- case "$1" in
44
- start)
45
- echo -n "Starting $DESC: "
46
- test_nginx_config
47
- # Check if the ULIMIT is set in /etc/default/nginx
48
- if [ -n "$ULIMIT" ]; then
49
- # Set the ulimits
50
- ulimit $ULIMIT
51
- fi
52
- start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
53
- --exec $DAEMON -- $DAEMON_OPTS || true
54
- echo "$NAME."
55
- ;;
56
-
57
- stop)
58
- echo -n "Stopping $DESC: "
59
- start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
60
- --exec $DAEMON || true
61
- echo "$NAME."
62
- ;;
63
-
64
- restart|force-reload)
65
- echo -n "Restarting $DESC: "
66
- start-stop-daemon --stop --quiet --pidfile \
67
- /var/run/$NAME.pid --exec $DAEMON || true
68
- sleep 1
69
- test_nginx_config
70
- start-stop-daemon --start --quiet --pidfile \
71
- /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
72
- echo "$NAME."
73
- ;;
74
-
75
- reload)
76
- echo -n "Reloading $DESC configuration: "
77
- test_nginx_config
78
- start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
79
- --exec $DAEMON || true
80
- echo "$NAME."
81
- ;;
82
-
83
- configtest|testconfig)
84
- echo -n "Testing $DESC configuration: "
85
- if test_nginx_config; then
86
- echo "$NAME."
87
- else
88
- exit $?
89
- fi
90
- ;;
91
-
92
- status)
93
- status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
94
- ;;
95
- *)
96
- echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2
97
- exit 1
98
- ;;
99
- esac
100
-
101
- exit 0