rubber 2.6.5 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG +37 -0
- data/lib/rubber/cloud/vsphere.rb +4 -0
- data/lib/rubber/generator.rb +37 -19
- data/lib/rubber/recipes/rubber/security_groups.rb +1 -1
- data/lib/rubber/recipes/rubber/volumes.rb +1 -1
- data/lib/rubber/version.rb +1 -1
- data/templates/delayed_job/config/rubber/deploy-delayed_job.rb +44 -0
- data/templates/delayed_job/config/rubber/role/delayed_job/monit-delayed_job.conf +18 -0
- data/templates/delayed_job/config/rubber/rubber-delayed_job.yml +1 -0
- data/templates/delayed_job/templates.yml +1 -0
- data/templates/discourse/config/rubber/deploy-discourse.rb +16 -0
- data/templates/discourse/config/rubber/role/nginx/nginx.conf +43 -0
- data/templates/discourse/config/rubber/role/nginx/unicorn_nginx.conf +102 -0
- data/templates/discourse/config/rubber/role/unicorn/unicorn.rb +99 -0
- data/templates/discourse/config/rubber/rubber-discourse.yml +3 -0
- data/templates/discourse/templates.yml +5 -0
- data/templates/elasticsearch/config/rubber/deploy-elasticsearch.rb +7 -7
- data/templates/elasticsearch/config/rubber/role/elasticsearch/elasticsearch-default.conf +47 -0
- data/templates/elasticsearch/config/rubber/role/elasticsearch/elasticsearch.yml +49 -30
- data/templates/elasticsearch/config/rubber/role/elasticsearch/logging.yml +14 -3
- data/templates/elasticsearch/config/rubber/role/elasticsearch/monit-elasticsearch.conf +8 -0
- data/templates/elasticsearch/config/rubber/rubber-elasticsearch.yml +1 -4
- data/templates/ffmpeg/config/rubber/deploy-ffmpeg.rb +13 -0
- data/templates/ffmpeg/config/rubber/rubber-ffmpeg.yml +5 -0
- data/templates/ffmpeg/templates.yml +1 -0
- data/templates/graylog/config/rubber/deploy-graylog.rb +17 -20
- data/templates/graylog/config/rubber/role/graylog_server/graylog2.conf +157 -43
- data/templates/graylog/config/rubber/role/graylog_server/monit-graylog_server.conf +8 -0
- data/templates/graylog/config/rubber/role/graylog_web/graylog2-web-interface.conf +19 -0
- data/templates/graylog/config/rubber/role/graylog_web/graylog_web-upstart.conf +1 -1
- data/templates/graylog/config/rubber/role/graylog_web/monit-graylog_web.conf +8 -0
- data/templates/graylog/config/rubber/rubber-graylog.yml +5 -12
- data/templates/graylog/templates.rb +13 -5
- data/templates/memcached/config/rubber/deploy-memcached.rb +16 -0
- data/templates/memcached/config/rubber/role/memcached/dalli.rb +20 -0
- data/templates/memcached/config/rubber/role/memcached/memcached.conf +17 -8
- data/templates/memcached/config/rubber/rubber-memcached.yml +25 -1
- data/templates/monit/config/rubber/role/memcached/monit-memcached.conf +9 -0
- data/templates/monit/config/rubber/role/mongodb/monit-mongodb.conf +1 -0
- data/templates/mysql/config/rubber/deploy-mysql.rb +1 -2
- data/templates/newrelic/config/rubber/deploy-newrelic.rb +49 -0
- data/templates/newrelic/config/rubber/role/newrelic/monit-newrelic.conf +9 -0
- data/templates/newrelic/config/rubber/rubber-newrelic.yml +5 -0
- data/templates/newrelic/templates.yml +1 -0
- data/templates/passenger_nginx/config/rubber/deploy-passenger_nginx.rb +7 -4
- data/templates/passenger_nginx/config/rubber/rubber-passenger_nginx.yml +1 -0
- data/templates/redis/config/rubber/role/redis/redis.conf +120 -16
- data/templates/redis/config/rubber/rubber-redis.yml +1 -1
- data/templates/solr/config/rubber/deploy-solr.rb +8 -8
- data/templates/solr/config/rubber/rubber-solr.yml +6 -6
- data/templates/solr/templates.yml +1 -3
- data/templates/solr_sunspot/config/rubber/common/solr_sunspot.yml +10 -0
- data/templates/solr_sunspot/config/rubber/deploy-solr_sunspot.rb +30 -0
- data/templates/solr_sunspot/config/rubber/rubber-solr_sunspot.yml +5 -0
- data/templates/solr_sunspot/templates.yml +1 -0
- data/templates/unicorn/config/rubber/deploy-unicorn.rb +16 -11
- data/templates/unicorn/config/rubber/role/unicorn/unicorn +91 -0
- data/test/generator_test.rb +54 -0
- data/test/test_helper.rb +2 -0
- metadata +31 -11
- data/templates/elasticsearch/config/rubber/role/elasticsearch/elasticsearch-upstart.conf +0 -23
- data/templates/graylog/config/initializers/graylog.rb +0 -53
- data/templates/graylog/config/rubber/role/graylog_web/crontab +0 -9
- data/templates/graylog/config/rubber/role/graylog_web/email.yml +0 -16
- data/templates/graylog/config/rubber/role/graylog_web/general.yml +0 -27
- data/templates/graylog/config/rubber/role/graylog_web/mongoid.yml +0 -28
- data/templates/memcached/config/memcached.yml +0 -28
- data/templates/memcached/config/rubber/common/memcached.yml +0 -14
- data/templates/unicorn/config/rubber/role/unicorn/unicorn-upstart.conf +0 -13
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@path = '/etc/monit/monit.d/monit-graylog_server.conf'
|
|
3
|
+
%>
|
|
4
|
+
check process graylog_server with pidfile <%= rubber_env.graylog_server_pid_file %>
|
|
5
|
+
group graylog-<%= Rubber.env %>
|
|
6
|
+
start program = "/usr/bin/env service graylog-server start"
|
|
7
|
+
stop program = "/usr/bin/env service graylog-server stop"
|
|
8
|
+
if failed host <%= rubber_env.host %> port <%= rubber_env.graylog_server_port %> type UDP with timeout 10 seconds for 10 cycles then restart
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@path = "#{rubber_env.graylog_web_dir}/conf/graylog2-web-interface.conf"
|
|
3
|
+
|
|
4
|
+
graylog_server_uris = rubber_instances.for_role('graylog_server').collect { |i| "http://#{i.internal_ip}:12900/" }.join(',')
|
|
5
|
+
%>
|
|
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
|
+
graylog2-server.uris="<%= graylog_server_uris %>"
|
|
8
|
+
|
|
9
|
+
# Secret key
|
|
10
|
+
# ~~~~~
|
|
11
|
+
# The secret key is used to secure cryptographics functions. Set this to a long and randomly generated string.
|
|
12
|
+
# If you deploy your application to several instances be sure to use the same key!
|
|
13
|
+
# Generate for example with: pwgen -s 96
|
|
14
|
+
application.secret="<%= rubber_env.graylog_web_secret %>"
|
|
15
|
+
|
|
16
|
+
# Web interface timezone
|
|
17
|
+
# Graylog2 stores all timestamps in UTC. To properly display times, set the default timezone of the interface.
|
|
18
|
+
# If you leave this out, Graylog2 will pick your system default as the timezone. Usually you will want to configure it explicitly.
|
|
19
|
+
timezone="<%= rubber_env.timezone %>"
|
|
@@ -9,7 +9,7 @@ stop on runlevel [016]
|
|
|
9
9
|
|
|
10
10
|
script
|
|
11
11
|
cd <%= rubber_env.graylog_web_dir %>
|
|
12
|
-
exec
|
|
12
|
+
exec ./bin/graylog2-web-interface > graylog.log 2>&1
|
|
13
13
|
end script
|
|
14
14
|
|
|
15
15
|
post-start script
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@path = '/etc/monit/monit.d/monit-graylog_web.conf'
|
|
3
|
+
%>
|
|
4
|
+
check process graylog_web with pidfile <%= rubber_env.graylog_web_pid_file %>
|
|
5
|
+
group graylog-<%= Rubber.env %>
|
|
6
|
+
start program = "/usr/bin/env service graylog-web start"
|
|
7
|
+
stop program = "/usr/bin/env service graylog-web stop"
|
|
8
|
+
if failed host <%= rubber_env.host %> port <%= rubber_env.graylog_web_port %> with timeout 10 seconds for 10 cycles then restart
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
graylog_server_version: "0.
|
|
2
|
-
graylog_server_pkg_url: "https://github.com/downloads/Graylog2/graylog2-server/graylog2-server-#{graylog_server_version}.tar.gz"
|
|
1
|
+
graylog_server_version: "0.20.0-rc.1-1"
|
|
3
2
|
graylog_server_prefix: "/usr/local"
|
|
4
3
|
graylog_server_dir: "#{graylog_server_prefix}/graylog2-server-#{graylog_server_version}"
|
|
5
4
|
graylog_server_pid_file: "/var/run/graylog-server.pid"
|
|
6
5
|
graylog_server_port: 12201
|
|
7
6
|
graylog_server_syslog_port: 12514
|
|
8
7
|
|
|
9
|
-
graylog_web_version: "0.
|
|
10
|
-
graylog_web_pkg_url: "https://github.com/downloads/Graylog2/graylog2-web-interface/graylog2-web-interface-#{graylog_web_version}.tar.gz"
|
|
8
|
+
graylog_web_version: "0.20.0-rc.1-1"
|
|
11
9
|
graylog_web_prefix: "/usr/local"
|
|
12
10
|
graylog_web_dir: "#{graylog_web_prefix}/graylog2-web-interface-#{graylog_web_version}"
|
|
13
11
|
graylog_web_pid_file: "/var/run/graylog-web.pid"
|
|
14
|
-
graylog_web_port:
|
|
12
|
+
graylog_web_port: 9000
|
|
15
13
|
|
|
16
14
|
graylog_web_username: admin
|
|
17
15
|
graylog_web_password: admin1
|
|
18
|
-
graylog_web_email: "#{admin_email}"
|
|
19
16
|
|
|
20
17
|
graylog_mongo_database: graylog2
|
|
21
|
-
graylog_elasticsearch_index:
|
|
18
|
+
graylog_elasticsearch_index: "graylog2_#{Rubber.env}"
|
|
22
19
|
|
|
23
20
|
web_tools_proxies:
|
|
24
21
|
graylog:
|
|
@@ -27,7 +24,6 @@ web_tools_proxies:
|
|
|
27
24
|
path: /
|
|
28
25
|
|
|
29
26
|
role_dependencies:
|
|
30
|
-
web_tools: [graylog_web, graylog_server]
|
|
31
27
|
graylog_server: [graylog_mongodb, graylog_elasticsearch]
|
|
32
28
|
graylog_mongodb: [mongodb]
|
|
33
29
|
graylog_elasticsearch: [elasticsearch]
|
|
@@ -36,7 +32,4 @@ roles:
|
|
|
36
32
|
graylog_server:
|
|
37
33
|
packages: [openjdk-7-jdk, mongodb-10gen]
|
|
38
34
|
graylog_web:
|
|
39
|
-
packages: [
|
|
40
|
-
gems: [puma]
|
|
41
|
-
|
|
42
|
-
gems: [gelf, graylog2_exceptions, graylog2-resque]
|
|
35
|
+
packages: [openjdk-7-jdk]
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
require 'securerandom'
|
|
2
|
+
|
|
3
|
+
extra_config = <<-EXTRA
|
|
4
|
+
# This was auto-generated by Rubber and is unique to your machine. Feel free to regenerate if you'd like.
|
|
5
|
+
# You may want to move this to your rubber-secret.yml to keep it out of version control.
|
|
6
|
+
graylog_server_secret: #{SecureRandom.hex(96)}
|
|
7
|
+
|
|
8
|
+
# This was auto-generated by Rubber and is unique to your machine. Feel free to regenerate if you'd like.
|
|
9
|
+
# You may want to move this to your rubber-secret.yml to keep it out of version control.
|
|
10
|
+
graylog_web_secret: #{SecureRandom.hex(96)}
|
|
11
|
+
EXTRA
|
|
12
|
+
|
|
13
|
+
append_to_file 'config/rubber/rubber-graylog.yml', "\n#{extra_config}"
|
|
@@ -3,6 +3,22 @@ namespace :rubber do
|
|
|
3
3
|
|
|
4
4
|
namespace :memcached do
|
|
5
5
|
|
|
6
|
+
desc "Starts memcached shared memory"
|
|
7
|
+
task :start, :roles => :memcached do
|
|
8
|
+
rsudo "service memcached status || service memcached start"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
desc "Stops memcached shared memory"
|
|
12
|
+
task :stop, :roles => :memcached do
|
|
13
|
+
rsudo "service memcached stop || true"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
desc "Restarts memcached shared memory"
|
|
17
|
+
task :restart, :roles => :memcached do
|
|
18
|
+
stop
|
|
19
|
+
start
|
|
20
|
+
end
|
|
21
|
+
|
|
6
22
|
desc "Display status of memcached shared memory"
|
|
7
23
|
task :status, :roles => :memcached do
|
|
8
24
|
rsudo "service memcached status || true"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@path = "#{Rubber.root}/config/dalli.rb"
|
|
3
|
+
%>
|
|
4
|
+
|
|
5
|
+
module Rubber
|
|
6
|
+
module Dalli
|
|
7
|
+
module Config
|
|
8
|
+
include ::Rails::Initializable
|
|
9
|
+
|
|
10
|
+
initializer :set_dalli_cache, :before => :initialize_cache do |app|
|
|
11
|
+
config.action_controller.perform_caching = true
|
|
12
|
+
config.cache_store = :dalli_store,
|
|
13
|
+
<%- rubber_instances.for_role('memcached').each do |ic| %>
|
|
14
|
+
'<%= ic.full_name %>:<%= rubber_env.memcached_port %>',
|
|
15
|
+
<%- end %>
|
|
16
|
+
{ :value_max_bytes => <%= rubber_env.memcached_max_slab_bytes %> }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<%
|
|
2
2
|
@path = "/etc/memcached.conf"
|
|
3
|
-
|
|
3
|
+
max_mem = rubber_env.memcached_max_mem
|
|
4
|
+
max_mem = max_mem[rubber_instances[rubber_env.host].image_type.split('.')[1]] if max_mem.is_a?(Hash)
|
|
4
5
|
%>
|
|
5
6
|
|
|
6
|
-
# memcached default config file
|
|
7
|
+
# memcached default config file
|
|
7
8
|
# 2003 - Jay Bonci <jaybonci@debian.org>
|
|
8
9
|
# This configuration file is read by the start-memcached script provided as
|
|
9
10
|
# part of the Debian GNU/Linux distribution.
|
|
@@ -16,8 +17,11 @@
|
|
|
16
17
|
# Log memcached's output to /var/log/memcached
|
|
17
18
|
logfile <%= rubber_env.memcached_log_dir %>/memcached.log
|
|
18
19
|
|
|
19
|
-
#
|
|
20
|
-
|
|
20
|
+
# pid file
|
|
21
|
+
-P <%= rubber_env.memcached_pid_file %>
|
|
22
|
+
|
|
23
|
+
# Be verbose (shows errors, warnings, and socket connections)
|
|
24
|
+
-v
|
|
21
25
|
|
|
22
26
|
# Be even more verbose (print client commands as well)
|
|
23
27
|
# -vv
|
|
@@ -25,19 +29,24 @@ logfile <%= rubber_env.memcached_log_dir %>/memcached.log
|
|
|
25
29
|
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
|
|
26
30
|
# Note that the daemon will grow to this size, but does not start out holding this much
|
|
27
31
|
# memory
|
|
28
|
-
-m <%=
|
|
32
|
+
-m <%= max_mem %>
|
|
33
|
+
|
|
34
|
+
# Override the size of each slab page in bytes, i.e. the maximum item size that
|
|
35
|
+
# memcached will accept. Recommended not to set above 1 MB for performance reasons.
|
|
36
|
+
# The default value is 1 MB.
|
|
37
|
+
-I <%= rubber_env.memcached_max_slab_bytes %>
|
|
29
38
|
|
|
30
39
|
# Default connection port is 11211
|
|
31
|
-
-p
|
|
40
|
+
-p <%= rubber_env.memcached_port %>
|
|
32
41
|
|
|
33
42
|
# Run the daemon as root. The start-memcached will default to running as root if no
|
|
34
43
|
# -u command is present in this config file
|
|
35
|
-
-u
|
|
44
|
+
-u memcache
|
|
36
45
|
|
|
37
46
|
# Specify which IP address to listen on. The default is to listen on all IP addresses
|
|
38
47
|
# This parameter is one of the only security measures that memcached has, so make sure
|
|
39
48
|
# it's listening on a firewalled interface.
|
|
40
|
-
|
|
49
|
+
# -l 127.0.0.1
|
|
41
50
|
|
|
42
51
|
# Limit the number of simultaneous incoming connections. The daemon default is 1024
|
|
43
52
|
# -c 1024
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
# Sets up memcached server and client as dalli
|
|
2
|
+
#
|
|
3
|
+
# !!!IMPORTANT!!! add the following lines inside your application.rb class:
|
|
4
|
+
#
|
|
5
|
+
# dalli_config = Rails.root.join('config','dalli.rb')
|
|
6
|
+
# if File.exists?(dalli_config)
|
|
7
|
+
# require dalli_config; include ::Rubber::Dalli::Config
|
|
8
|
+
# end
|
|
2
9
|
|
|
10
|
+
memcached_pid_file: /var/run/memcached.pid
|
|
3
11
|
memcached_log_dir: /var/log/memcached
|
|
4
|
-
|
|
12
|
+
memcached_port: 11211
|
|
13
|
+
|
|
14
|
+
# MB memory max to use for object storage in megabytes.
|
|
15
|
+
# Accepts either a single value or a hash by instance size
|
|
16
|
+
memcached_max_mem:
|
|
17
|
+
micro: 64 # 613MB max
|
|
18
|
+
small: 768 # 1.7GB max
|
|
19
|
+
medium: 2048 # 3.7GB max
|
|
20
|
+
large: 4096 # 7.5GB max
|
|
21
|
+
xlarge: 10240 # 15GB max
|
|
22
|
+
2xlarge: 20480 # 30GB max
|
|
23
|
+
4xlarge: 51200 # 60GB max
|
|
24
|
+
|
|
25
|
+
# Set size of each slab page in bytes, i.e. maximum item size
|
|
26
|
+
# that memcached will accept. Recommended not to set above 1 MB
|
|
27
|
+
# for performance reasons.
|
|
28
|
+
memcached_max_slab_bytes: "#{1024*1024}"
|
|
5
29
|
|
|
6
30
|
gems: [dalli]
|
|
7
31
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@path = '/etc/monit/monit.d/monit-memcached.conf'
|
|
3
|
+
%>
|
|
4
|
+
check process memcache with pidfile <%= rubber_env.memcached_pid_file %>
|
|
5
|
+
group memcache-<%= Rubber.env %>
|
|
6
|
+
start program = "/usr/bin/env service memcached start"
|
|
7
|
+
stop program = "/usr/bin/env service memcached stop"
|
|
8
|
+
if failed port <%= rubber_env.memcached_port %> protocol memcache then restart
|
|
9
|
+
if 5 restarts within 5 cycles then timeout
|
|
@@ -6,5 +6,6 @@ check process mongodb with pidfile <%= rubber_env.mongodb_pid %>
|
|
|
6
6
|
group mongodb-<%= Rubber.env %>
|
|
7
7
|
start program = "/bin/bash -c 'rm -f <%= rubber_env.mongodb_pid %>; /usr/bin/env service mongodb start'"
|
|
8
8
|
stop program = "/usr/bin/env service mongodb stop"
|
|
9
|
+
if does not exist for 5 cycles then restart
|
|
9
10
|
if failed port 27017 then restart
|
|
10
11
|
if 5 restarts within 5 cycles then timeout
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
namespace :rubber do
|
|
3
2
|
|
|
4
3
|
namespace :mysql do
|
|
@@ -40,7 +39,7 @@ namespace :rubber do
|
|
|
40
39
|
pass = "identified by '#{env.db_pass}'" if env.db_pass
|
|
41
40
|
rubber.sudo_script "create_master_db", <<-ENDSCRIPT
|
|
42
41
|
mysql -u root -e "create database #{env.db_name};"
|
|
43
|
-
mysql -u root -e "delete from mysql.user where user=''
|
|
42
|
+
mysql -u root -e "delete from mysql.user where user='';"
|
|
44
43
|
mysql -u root -e "grant all on *.* to '#{env.db_user}'@'%' #{pass};"
|
|
45
44
|
mysql -u root -e "grant select on *.* to '#{env.db_slave_user}'@'%' #{pass};"
|
|
46
45
|
mysql -u root -e "grant replication slave on *.* to '#{env.db_replicator_user}'@'%' #{pass};"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
namespace :rubber do
|
|
3
|
+
|
|
4
|
+
namespace :newrelic do
|
|
5
|
+
|
|
6
|
+
rubber.allow_optional_tasks(self)
|
|
7
|
+
|
|
8
|
+
before "rubber:install_packages", "rubber:newrelic:install_newrelic_apt"
|
|
9
|
+
|
|
10
|
+
task :install_newrelic_apt, :roles => :newrelic do
|
|
11
|
+
rubber.sudo_script 'install_newrelic', <<-ENDSCRIPT
|
|
12
|
+
if [[ -z $(cat /etc/apt/sources.list.d/newrelic.list 2> /dev/null) ]]; then
|
|
13
|
+
wget -O /etc/apt/sources.list.d/newrelic.list http://download.newrelic.com/debian/newrelic.list
|
|
14
|
+
apt-key adv --keyserver hkp://subkeys.pgp.net --recv-keys 548C16BF
|
|
15
|
+
fi
|
|
16
|
+
ENDSCRIPT
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
after "rubber:bootstrap", "rubber:newrelic:bootstrap"
|
|
20
|
+
|
|
21
|
+
task :bootstrap, :roles => :newrelic do
|
|
22
|
+
rubber.sudo_script 'bootstrap_newrelic', <<-ENDSCRIPT
|
|
23
|
+
if [[ -z $(cat /etc/newrelic/nrsysmond.cfg | grep #{rubber_env.nrsysmond_license_key} 2> /dev/null) ]]; then
|
|
24
|
+
nrsysmond-config --set license_key=#{rubber_env.nrsysmond_license_key}
|
|
25
|
+
fi
|
|
26
|
+
ENDSCRIPT
|
|
27
|
+
|
|
28
|
+
restart
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
desc "Start newrelic system monitoring"
|
|
32
|
+
task :start, :roles => :newrelic do
|
|
33
|
+
rsudo "service newrelic-sysmond start"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc "Stop newrelic system monitoring"
|
|
37
|
+
task :stop, :roles => :newrelic do
|
|
38
|
+
rsudo "service newrelic-sysmond stop || true"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
desc "Restart newrelic system monitoring"
|
|
42
|
+
task :restart, :roles => :newrelic do
|
|
43
|
+
stop
|
|
44
|
+
start
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@path = '/etc/monit/monit.d/monit-newrelic.conf'
|
|
3
|
+
%>
|
|
4
|
+
|
|
5
|
+
check process nrsysmond with pidfile /var/run/nrsysmond.pid
|
|
6
|
+
group newrelic-<%= Rubber.env %>
|
|
7
|
+
start program = "/usr/bin/env service newrelic-sysmond restart"
|
|
8
|
+
stop program = "/usr/bin/env service newrelic-sysmond stop"
|
|
9
|
+
if 5 restarts within 5 cycles then timeout
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
description: The newrelic server monitoring module
|
|
@@ -11,10 +11,13 @@ namespace :rubber do
|
|
|
11
11
|
# Check if there is an nginx with the required version and passenger built in.
|
|
12
12
|
if [ -x /usr/sbin/nginx ]
|
|
13
13
|
then echo 'Found nginx on system'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
18
21
|
fi
|
|
19
22
|
fi
|
|
20
23
|
# Lets install
|
|
@@ -3,6 +3,7 @@ nginx_version: 1.2.8
|
|
|
3
3
|
passenger_root: "#{`bash -l -c 'find #{ruby_path} -name passenger-#{passenger_version}'`.strip}"
|
|
4
4
|
passenger_ruby: "#{ruby_path}/bin/ruby"
|
|
5
5
|
passenger_lib: "#{passenger_root}/ext/nginx"
|
|
6
|
+
nginx_log_dir: /mnt/nginx/logs
|
|
6
7
|
passenger_listen_port: 7000
|
|
7
8
|
passenger_listen_ssl_port: 7001
|
|
8
9
|
max_app_connections: 20
|
|
@@ -32,12 +32,17 @@ pidfile /var/run/redis.pid
|
|
|
32
32
|
# If port 0 is specified Redis will not listen on a TCP socket.
|
|
33
33
|
port <%= rubber_env.redis_server_port %>
|
|
34
34
|
|
|
35
|
-
#
|
|
36
|
-
#
|
|
35
|
+
# By default Redis listens for connections from all the network interfaces
|
|
36
|
+
# available on the server. It is possible to listen to just one or multiple
|
|
37
|
+
# interfaces using the "bind" configuration directive, followed by one or
|
|
38
|
+
# more IP addresses.
|
|
37
39
|
#
|
|
40
|
+
# Examples:
|
|
41
|
+
#
|
|
42
|
+
# bind 192.168.1.100 10.0.0.1
|
|
38
43
|
# bind 127.0.0.1
|
|
39
44
|
|
|
40
|
-
# Specify the path for the
|
|
45
|
+
# Specify the path for the Unix socket that will be used to listen for
|
|
41
46
|
# incoming connections. There is no default, so Redis will not listen
|
|
42
47
|
# on a unix socket when not specified.
|
|
43
48
|
#
|
|
@@ -71,7 +76,7 @@ tcp-keepalive 60
|
|
|
71
76
|
# warning (only very important / critical messages are logged)
|
|
72
77
|
loglevel notice
|
|
73
78
|
|
|
74
|
-
# Specify the log file name. Also
|
|
79
|
+
# Specify the log file name. Also the empty string can be used to force
|
|
75
80
|
# Redis to log on the standard output. Note that if you use standard
|
|
76
81
|
# output for logging but daemonize, logs will be sent to /dev/null
|
|
77
82
|
logfile <%= rubber_env.redis_server_log_file %>
|
|
@@ -119,16 +124,16 @@ save 60 10000
|
|
|
119
124
|
|
|
120
125
|
# By default Redis will stop accepting writes if RDB snapshots are enabled
|
|
121
126
|
# (at least one save point) and the latest background save failed.
|
|
122
|
-
# This will make the user aware (in
|
|
127
|
+
# This will make the user aware (in a hard way) that data is not persisting
|
|
123
128
|
# on disk properly, otherwise chances are that no one will notice and some
|
|
124
|
-
#
|
|
129
|
+
# disaster will happen.
|
|
125
130
|
#
|
|
126
131
|
# If the background saving process will start working again Redis will
|
|
127
132
|
# automatically allow writes again.
|
|
128
133
|
#
|
|
129
134
|
# However if you have setup your proper monitoring of the Redis server
|
|
130
135
|
# and persistence, you may want to disable this feature so that Redis will
|
|
131
|
-
# continue to work as
|
|
136
|
+
# continue to work as usual even if there are problems with disk,
|
|
132
137
|
# permissions, and so forth.
|
|
133
138
|
stop-writes-on-bgsave-error yes
|
|
134
139
|
|
|
@@ -207,7 +212,7 @@ slave-serve-stale-data yes
|
|
|
207
212
|
# Note: read only slaves are not designed to be exposed to untrusted clients
|
|
208
213
|
# on the internet. It's just a protection layer against misuse of the instance.
|
|
209
214
|
# Still a read only slave exports by default all the administrative commands
|
|
210
|
-
# such as CONFIG, DEBUG, and so forth. To a limited
|
|
215
|
+
# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
|
|
211
216
|
# security of read only slaves using 'rename-command' to shadow all the
|
|
212
217
|
# administrative / dangerous commands.
|
|
213
218
|
slave-read-only yes
|
|
@@ -218,8 +223,11 @@ slave-read-only yes
|
|
|
218
223
|
#
|
|
219
224
|
# repl-ping-slave-period 10
|
|
220
225
|
|
|
221
|
-
# The following option sets
|
|
222
|
-
#
|
|
226
|
+
# The following option sets the replication timeout for:
|
|
227
|
+
#
|
|
228
|
+
# 1) Bulk transfer I/O during SYNC, from the point of view of slave.
|
|
229
|
+
# 2) Master timeout from the point of view of slaves (data, pings).
|
|
230
|
+
# 3) Slave timeout from the point of view of masters (REPLCONF ACK pings).
|
|
223
231
|
#
|
|
224
232
|
# It is important to make sure that this value is greater than the value
|
|
225
233
|
# specified for repl-ping-slave-period otherwise a timeout will be detected
|
|
@@ -242,13 +250,35 @@ slave-read-only yes
|
|
|
242
250
|
# be a good idea.
|
|
243
251
|
repl-disable-tcp-nodelay no
|
|
244
252
|
|
|
253
|
+
# Set the replication backlog size. The backlog is a buffer that accumulates
|
|
254
|
+
# slave data when slaves are disconnected for some time, so that when a slave
|
|
255
|
+
# wants to reconnect again, often a full resync is not needed, but a partial
|
|
256
|
+
# resync is enough, just passing the portion of data the slave missed while
|
|
257
|
+
# disconnected.
|
|
258
|
+
#
|
|
259
|
+
# The biggest the replication backlog, the longer the time the slave can be
|
|
260
|
+
# disconnected and later be able to perform a partial resynchronization.
|
|
261
|
+
#
|
|
262
|
+
# The backlog is only allocated once there is at least a slave connected.
|
|
263
|
+
#
|
|
264
|
+
# repl-backlog-size 1mb
|
|
265
|
+
|
|
266
|
+
# After a master has no longer connected slaves for some time, the backlog
|
|
267
|
+
# will be freed. The following option configures the amount of seconds that
|
|
268
|
+
# need to elapse, starting from the time the last slave disconnected, for
|
|
269
|
+
# the backlog buffer to be freed.
|
|
270
|
+
#
|
|
271
|
+
# A value of 0 means to never release the backlog.
|
|
272
|
+
#
|
|
273
|
+
# repl-backlog-ttl 3600
|
|
274
|
+
|
|
245
275
|
# The slave priority is an integer number published by Redis in the INFO output.
|
|
246
276
|
# It is used by Redis Sentinel in order to select a slave to promote into a
|
|
247
277
|
# master if the master is no longer working correctly.
|
|
248
278
|
#
|
|
249
279
|
# A slave with a low priority number is considered better for promotion, so
|
|
250
280
|
# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
|
|
251
|
-
# pick the one
|
|
281
|
+
# pick the one with priority 10, that is the lowest.
|
|
252
282
|
#
|
|
253
283
|
# However a special priority of 0 marks the slave as not able to perform the
|
|
254
284
|
# role of master, so a slave with priority of 0 will never be selected by
|
|
@@ -256,6 +286,28 @@ repl-disable-tcp-nodelay no
|
|
|
256
286
|
#
|
|
257
287
|
# By default the priority is 100.
|
|
258
288
|
slave-priority 100
|
|
289
|
+
|
|
290
|
+
# It is possible for a master to stop accepting writes if there are less than
|
|
291
|
+
# N slaves connected, having a lag less or equal than M seconds.
|
|
292
|
+
#
|
|
293
|
+
# The N slaves need to be in "online" state.
|
|
294
|
+
#
|
|
295
|
+
# The lag in seconds, that must be <= the specified value, is calculated from
|
|
296
|
+
# the last ping received from the slave, that is usually sent every second.
|
|
297
|
+
#
|
|
298
|
+
# This option does not GUARANTEES that N replicas will accept the write, but
|
|
299
|
+
# will limit the window of exposure for lost writes in case not enough slaves
|
|
300
|
+
# are available, to the specified number of seconds.
|
|
301
|
+
#
|
|
302
|
+
# For example to require at least 3 slaves with a lag <= 10 seconds use:
|
|
303
|
+
#
|
|
304
|
+
# min-slaves-to-write 3
|
|
305
|
+
# min-slaves-max-lag 10
|
|
306
|
+
#
|
|
307
|
+
# Setting one or the other to 0 disables the feature.
|
|
308
|
+
#
|
|
309
|
+
# By default min-slaves-to-write is set to 0 (feature disabled) and
|
|
310
|
+
# min-slaves-max-lag is set to 10.
|
|
259
311
|
<%- end %>
|
|
260
312
|
|
|
261
313
|
################################## SECURITY ###################################
|
|
@@ -307,7 +359,7 @@ slave-priority 100
|
|
|
307
359
|
|
|
308
360
|
# Don't use more memory than the specified amount of bytes.
|
|
309
361
|
# When the memory limit is reached Redis will try to remove keys
|
|
310
|
-
#
|
|
362
|
+
# according to the eviction policy selected (see maxmemory-policy).
|
|
311
363
|
#
|
|
312
364
|
# If Redis can't remove keys according to the policy, or if the policy is
|
|
313
365
|
# set to 'noeviction', Redis will start to reply with errors to commands
|
|
@@ -315,7 +367,7 @@ slave-priority 100
|
|
|
315
367
|
# to reply to read-only commands like GET.
|
|
316
368
|
#
|
|
317
369
|
# This option is usually useful when using Redis as an LRU cache, or to set
|
|
318
|
-
#
|
|
370
|
+
# a hard memory limit for an instance (using the 'noeviction' policy).
|
|
319
371
|
#
|
|
320
372
|
# WARNING: If you have slaves attached to an instance with maxmemory on,
|
|
321
373
|
# the size of the output buffers needed to feed the slaves are subtracted
|
|
@@ -495,6 +547,52 @@ slowlog-log-slower-than 10000
|
|
|
495
547
|
# You can reclaim memory used by the slow log with SLOWLOG RESET.
|
|
496
548
|
slowlog-max-len 1024
|
|
497
549
|
|
|
550
|
+
############################# Event notification ##############################
|
|
551
|
+
|
|
552
|
+
# Redis can notify Pub/Sub clients about events happening in the key space.
|
|
553
|
+
# This feature is documented at http://redis.io/topics/keyspace-events
|
|
554
|
+
#
|
|
555
|
+
# For instance if keyspace events notification is enabled, and a client
|
|
556
|
+
# performs a DEL operation on key "foo" stored in the Database 0, two
|
|
557
|
+
# messages will be published via Pub/Sub:
|
|
558
|
+
#
|
|
559
|
+
# PUBLISH __keyspace@0__:foo del
|
|
560
|
+
# PUBLISH __keyevent@0__:del foo
|
|
561
|
+
#
|
|
562
|
+
# It is possible to select the events that Redis will notify among a set
|
|
563
|
+
# of classes. Every class is identified by a single character:
|
|
564
|
+
#
|
|
565
|
+
# K Keyspace events, published with __keyspace@<db>__ prefix.
|
|
566
|
+
# E Keyevent events, published with __keyevent@<db>__ prefix.
|
|
567
|
+
# g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
|
|
568
|
+
# $ String commands
|
|
569
|
+
# l List commands
|
|
570
|
+
# s Set commands
|
|
571
|
+
# h Hash commands
|
|
572
|
+
# z Sorted set commands
|
|
573
|
+
# x Expired events (events generated every time a key expires)
|
|
574
|
+
# e Evicted events (events generated when a key is evicted for maxmemory)
|
|
575
|
+
# A Alias for g$lshzxe, so that the "AKE" string means all the events.
|
|
576
|
+
#
|
|
577
|
+
# The "notify-keyspace-events" takes as argument a string that is composed
|
|
578
|
+
# by zero or multiple characters. The empty string means that notifications
|
|
579
|
+
# are disabled at all.
|
|
580
|
+
#
|
|
581
|
+
# Example: to enable list and generic events, from the point of view of the
|
|
582
|
+
# event name, use:
|
|
583
|
+
#
|
|
584
|
+
# notify-keyspace-events Elg
|
|
585
|
+
#
|
|
586
|
+
# Example 2: to get the stream of the expired keys subscribing to channel
|
|
587
|
+
# name __keyevent@0__:expired use:
|
|
588
|
+
#
|
|
589
|
+
# notify-keyspace-events Ex
|
|
590
|
+
#
|
|
591
|
+
# By default all notifications are disabled because most users don't need
|
|
592
|
+
# this feature and the feature has some overhead. Note that if you don't
|
|
593
|
+
# specify at least one of K or E, no events will be delivered.
|
|
594
|
+
notify-keyspace-events ""
|
|
595
|
+
|
|
498
596
|
############################### ADVANCED CONFIG ###############################
|
|
499
597
|
|
|
500
598
|
# Hashes are encoded using a memory efficient data structure when they have a
|
|
@@ -525,7 +623,7 @@ zset-max-ziplist-value 64
|
|
|
525
623
|
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
|
|
526
624
|
# order to help rehashing the main Redis hash table (the one mapping top-level
|
|
527
625
|
# keys to values). The hash table implementation Redis uses (see dict.c)
|
|
528
|
-
# performs a lazy rehashing: the more operation you run into
|
|
626
|
+
# performs a lazy rehashing: the more operation you run into a hash table
|
|
529
627
|
# that is rehashing, the more rehashing "steps" are performed, so if the
|
|
530
628
|
# server is idle the rehashing is never complete and some more memory is used
|
|
531
629
|
# by the hash table.
|
|
@@ -580,10 +678,10 @@ client-output-buffer-limit slave 256mb 64mb 60
|
|
|
580
678
|
client-output-buffer-limit pubsub 32mb 8mb 60
|
|
581
679
|
|
|
582
680
|
# Redis calls an internal function to perform many background tasks, like
|
|
583
|
-
# closing connections of clients in
|
|
681
|
+
# closing connections of clients in timeout, purging expired keys that are
|
|
584
682
|
# never requested, and so forth.
|
|
585
683
|
#
|
|
586
|
-
# Not all tasks are
|
|
684
|
+
# Not all tasks are performed with the same frequency, but Redis checks for
|
|
587
685
|
# tasks to perform accordingly to the specified "hz" value.
|
|
588
686
|
#
|
|
589
687
|
# By default "hz" is set to 10. Raising the value will use more CPU when
|
|
@@ -596,6 +694,12 @@ client-output-buffer-limit pubsub 32mb 8mb 60
|
|
|
596
694
|
# 100 only in environments where very low latency is required.
|
|
597
695
|
hz 10
|
|
598
696
|
|
|
697
|
+
# When a child rewrites the AOF file, if the following option is enabled
|
|
698
|
+
# the file will be fsync-ed every 32 MB of data generated. This is useful
|
|
699
|
+
# in order to commit the file to the disk more incrementally and avoid
|
|
700
|
+
# big latency spikes.
|
|
701
|
+
aof-rewrite-incremental-fsync yes
|
|
702
|
+
|
|
599
703
|
################################## INCLUDES ###################################
|
|
600
704
|
|
|
601
705
|
# Include one or more other config files here. This is useful if you
|