salted-rails 0.0.2

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.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +48 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +20 -0
  5. data/README.md +79 -0
  6. data/Rakefile +1 -0
  7. data/lib/salted_rails.rb +5 -0
  8. data/lib/salted_rails/base.rb +5 -0
  9. data/lib/salted_rails/capistrano.rb +6 -0
  10. data/lib/salted_rails/vagrant_helper.rb +155 -0
  11. data/lib/salted_rails/version.rb +3 -0
  12. data/pillar/capistrano.sls +3 -0
  13. data/pillar/capistrano/top.sls +5 -0
  14. data/pillar/common.sls +15 -0
  15. data/pillar/vagrant.sls +3 -0
  16. data/pillar/vagrant/top.sls +5 -0
  17. data/salt/apt/partner-sources.sls +13 -0
  18. data/salt/apt/unwanted.sls +5 -0
  19. data/salt/capistrano.sls +0 -0
  20. data/salt/capistrano/minion +14 -0
  21. data/salt/capistrano/minion.sls +6 -0
  22. data/salt/capistrano/top.sls +8 -0
  23. data/salt/common.sls +19 -0
  24. data/salt/crons/init.sls +23 -0
  25. data/salt/databases/mysql/client-encoding-and-collation.cnf +2 -0
  26. data/salt/databases/mysql/client.sls +17 -0
  27. data/salt/databases/mysql/common.sls +22 -0
  28. data/salt/databases/mysql/config.sls +6 -0
  29. data/salt/databases/mysql/custom_config.sls +14 -0
  30. data/salt/databases/mysql/default-table-engine.cnf +2 -0
  31. data/salt/databases/mysql/group.sls +4 -0
  32. data/salt/databases/mysql/init.sls +8 -0
  33. data/salt/databases/mysql/server-encoding-and-collation.cnf +4 -0
  34. data/salt/databases/mysql/server.sls +59 -0
  35. data/salt/databases/phpmyadmin/etc/nginx/sites-available/.gitignore +3 -0
  36. data/salt/databases/phpmyadmin/etc/nginx/sites-available/phpmyadmin.conf +24 -0
  37. data/salt/databases/phpmyadmin/init.sls +27 -0
  38. data/salt/develop/init.sls +3 -0
  39. data/salt/echo_pillar.sls +9 -0
  40. data/salt/editors/vim/init.sls +12 -0
  41. data/salt/editors/vim/vimrc +23 -0
  42. data/salt/lang/php/composer.sls +9 -0
  43. data/salt/lang/php/etc/php5/fpm/php.fpm.ini +1818 -0
  44. data/salt/lang/php/etc/php5/fpm/pool.d/www.conf +393 -0
  45. data/salt/lang/php/init.sls +38 -0
  46. data/salt/lang/php/nginx.sls +9 -0
  47. data/salt/lang/python/python-libs.sls +28 -0
  48. data/salt/lang/ruby.sls +60 -0
  49. data/salt/lang/ruby.sls.bak +106 -0
  50. data/salt/lang/system_ruby.sls +43 -0
  51. data/salt/munin/files/nginx/plugin-conf.d/nginx +2 -0
  52. data/salt/munin/files/nginx/plugins/nginx_combined_localhost +160 -0
  53. data/salt/munin/files/nginx/plugins/nginx_request +114 -0
  54. data/salt/munin/files/nginx/plugins/nginx_status +126 -0
  55. data/salt/munin/files/node/checkPermissions.sh +10 -0
  56. data/salt/munin/files/node/munin-node.conf +54 -0
  57. data/salt/munin/files/php5-fpm/plugins/phpfpm_average +39 -0
  58. data/salt/munin/files/php5-fpm/plugins/phpfpm_connections +71 -0
  59. data/salt/munin/files/php5-fpm/plugins/phpfpm_memory +24 -0
  60. data/salt/munin/files/php5-fpm/plugins/phpfpm_processes +38 -0
  61. data/salt/munin/files/php5-fpm/plugins/phpfpm_status +83 -0
  62. data/salt/munin/files/server/munin.conf +107 -0
  63. data/salt/munin/nginx.sls +13 -0
  64. data/salt/munin/node.sls +34 -0
  65. data/salt/munin/php5-fpm.sls +13 -0
  66. data/salt/munin/server.sls +7 -0
  67. data/salt/railsapp/database.sls +25 -0
  68. data/salt/railsapp/files/Gemfile +57 -0
  69. data/salt/railsapp/files/Gemfile.lock +133 -0
  70. data/salt/railsapp/gems.sls +18 -0
  71. data/salt/railsapp/init.sls +3 -0
  72. data/salt/run-standalone +3 -0
  73. data/salt/salt/minion/config.template +259 -0
  74. data/salt/salt/minion/debconf.sls +3 -0
  75. data/salt/salt/minion/init.sls +49 -0
  76. data/salt/salt/minion/lsb.sls +8 -0
  77. data/salt/salt/minion/mysql.conf +1 -0
  78. data/salt/salt/minion/mysql.sls +20 -0
  79. data/salt/server/monit.sls +31 -0
  80. data/salt/server/sudo/init.sls +16 -0
  81. data/salt/server/sudo/sudoers +90 -0
  82. data/salt/sysutils/file.sls +8 -0
  83. data/salt/sysutils/init.sls +5 -0
  84. data/salt/sysutils/net.sls +9 -0
  85. data/salt/sysutils/status.sls +11 -0
  86. data/salt/sysutils/tmux.sls +3 -0
  87. data/salt/vagrant.sls +0 -0
  88. data/salt/vagrant/minion +14 -0
  89. data/salt/vagrant/minion.sls +6 -0
  90. data/salt/vagrant/top.sls +8 -0
  91. data/salt/www/chromium.sls +6 -0
  92. data/salt/www/nginx/etc/nginx/nginx.conf +53 -0
  93. data/salt/www/nginx/init.sls +20 -0
  94. data/salt/www/users.sls +12 -0
  95. data/salted-rails.gemspec +23 -0
  96. metadata +163 -0
@@ -0,0 +1,60 @@
1
+ #
2
+ # ruby deps
3
+ #
4
+
5
+ rbenv-deps:
6
+ pkg.installed:
7
+ - pkgs:
8
+ - autoconf
9
+ - automake
10
+ - bison
11
+ - build-essential
12
+ - curl
13
+ - git
14
+ - libc6-dev
15
+ - libcurl4-openssl-dev
16
+ - libfreeimage3
17
+ - libfreeimage-dev
18
+ - libmysqlclient-dev
19
+ - libncurses5-dev
20
+ - libreadline-dev
21
+ - libsqlite3-0
22
+ - libsqlite3-dev
23
+ - libssl-dev
24
+ - libtool
25
+ - libxml2-dev
26
+ - libxslt1-dev
27
+ - libyaml-dev
28
+ - openssl
29
+ - python-software-properties
30
+ - sqlite3
31
+ - subversion
32
+ - zlib1g
33
+ - zlib1g-dev
34
+
35
+ ruby:
36
+ rbenv.installed:
37
+ - name: {{ pillar['ruby-version'] }}
38
+ - default: True
39
+ - runas: {{ pillar['username'] }}
40
+ - require:
41
+ - pkg: rbenv-deps
42
+
43
+ adjust_profile:
44
+ file.append:
45
+ - name: {{ pillar['homedir'] }}/.profile
46
+ - user: {{ pillar['username'] }}
47
+ - group: {{ pillar['username'] }}
48
+ - text:
49
+ - export PATH="$HOME/.rbenv/bin:$PATH"
50
+ - eval "$(rbenv init -)"
51
+ - require:
52
+ - rbenv.installed: ruby
53
+
54
+ base_gems:
55
+ gem.installed:
56
+ - runas: {{ pillar['username'] }}
57
+ - names:
58
+ - bundler
59
+ - require:
60
+ - file: adjust_profile
@@ -0,0 +1,106 @@
1
+ #
2
+ # ruby deps
3
+ #
4
+
5
+ rbenv_deps:
6
+ pkg.installed:
7
+ - names:
8
+ - git
9
+ - build-essential
10
+ - openssl
11
+ - curl
12
+ - zlib1g
13
+ - zlib1g-dev
14
+ - libssl-dev
15
+ - libyaml-dev
16
+ - libsqlite3-0
17
+ - libsqlite3-dev
18
+ - sqlite3
19
+ - libxml2-dev
20
+ - libxslt1-dev
21
+ - autoconf
22
+ - libc6-dev
23
+ - libncurses5-dev
24
+ - automake
25
+ - libtool
26
+ - bison
27
+ - subversion
28
+
29
+ #
30
+ # rbenv and ruby-build installation
31
+ #
32
+
33
+ {{ pillar['homedir'] }}/.rbenv:
34
+ file.directory:
35
+ - user: {{ pillar['username'] }}
36
+ - group: {{ pillar['username'] }}
37
+ - makedirs: True
38
+
39
+ https://github.com/sstephenson/rbenv.git:
40
+ git.latest:
41
+ - runas: {{ pillar['username'] }}
42
+ - rev: master
43
+ - target: {{ pillar['homedir'] }}/.rbenv
44
+ - force: True
45
+ - require:
46
+ - pkg: rbenv_deps
47
+ - file: {{ pillar['homedir'] }}/.rbenv
48
+
49
+ https://github.com/sstephenson/ruby-build.git:
50
+ git.latest:
51
+ - runas: {{ pillar['username'] }}
52
+ - rev: master
53
+ - target: {{ pillar['homedir'] }}/.rbenv/plugins
54
+ - force: True
55
+ - require:
56
+ - git: https://github.com/sstephenson/rbenv.git
57
+ - file: {{ pillar['homedir'] }}/.rbenv
58
+
59
+ adjust_profile:
60
+ file.append:
61
+ - name: {{ pillar['homedir'] }}/.profile
62
+ - user: {{ pillar['username'] }}
63
+ - group: {{ pillar['username'] }}
64
+ - text:
65
+ - export PATH="$HOME/.rbenv/bin:$PATH"
66
+ - eval "$(rbenv init -)"
67
+ - require:
68
+ - git: https://github.com/sstephenson/rbenv.git
69
+
70
+
71
+ #
72
+ # ruby installation
73
+ #
74
+
75
+ # this is currently not working
76
+ # ruby-{{ pillar['ruby-version'] }}:
77
+ # rbenv.installed:
78
+ # - default: True
79
+ # - require:
80
+ # - git: https://github.com/sstephenson/ruby-build.git
81
+
82
+ install_ruby:
83
+ cmd.run:
84
+ - name: {{ pillar['homedir'] }}/.rbenv/bin/rbenv install {{ pillar['ruby-version'] }}
85
+ - user: {{ pillar['username'] }}
86
+ - group: {{ pillar['username'] }}
87
+ - require:
88
+ - git: https://github.com/sstephenson/ruby-build.git
89
+
90
+ rehash:
91
+ cmd.run:
92
+ - name: {{ pillar['homedir'] }}/.rbenv/bin/rbenv rehash
93
+ - user: {{ pillar['username'] }}
94
+ - group: {{ pillar['username'] }}
95
+ - require:
96
+ - cmd: install_rbenv
97
+
98
+ set-global:
99
+ cmd.run:
100
+ - name: {{ pillar['homedir'] }}/.rbenv/bin/rbenv global {{ pillar['ruby-version'] }}
101
+ - user: {{ pillar['username'] }}
102
+ - group: {{ pillar['username'] }}
103
+ - require:
104
+ - cmd: rehash
105
+
106
+
@@ -0,0 +1,43 @@
1
+ ruby-deps:
2
+ pkg:
3
+ - installed
4
+ - names:
5
+ - build-essential
6
+ - openssl
7
+ - libreadline6
8
+ - libreadline6-dev
9
+ - curl
10
+ - git
11
+ - zlib1g
12
+ - zlib1g-dev
13
+ - libssl-dev
14
+ - libyaml-dev
15
+ - libsqlite3-0
16
+ - libsqlite3-dev
17
+ - sqlite3
18
+ - libxml2-dev
19
+ - libxslt1-dev
20
+ - autoconf
21
+ - libc6-dev
22
+ - libncurses5-dev
23
+ - automake
24
+ - libtool
25
+ - bison
26
+ - subversion
27
+
28
+ ruby:
29
+ pkg.installed:
30
+ - names:
31
+ - ruby
32
+ - rubygems
33
+ - require:
34
+ - ruby-deps
35
+
36
+ gems:
37
+ gem.installed:
38
+ - names:
39
+ - bundler
40
+ - rake
41
+ - require:
42
+ - ruby
43
+
@@ -0,0 +1,2 @@
1
+ [nginx*]
2
+ env.url http://localhost/nginx_status
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/perl -w
2
+ # -*- cperl -*-
3
+ # Magic markers:
4
+ #%# family=auto
5
+ #%# capabilities=autoconf
6
+ # nginx_combine_ --- Determine the current status of Nginx
7
+ # using the http_stub_status module.
8
+ # extend of nginx_status_ plugin of Ant?nio P. P. Almeida
9
+
10
+ # Copyright (C) 2010 Ant?nio P. P. Almeida <appa@perusio.net>
11
+ # Copyright (C) 2010 Minato Miray <minatomiray@gmail.com>
12
+
13
+ # Author: Ant?nio P. P. Almeida <appa@perusio.net>,
14
+ # Author: Minato Miray <minatomiray@gmail.com>
15
+
16
+ #######################################
17
+ # Nginx combined plugin to measure in one graph:
18
+ # - Request /sec
19
+ # - Connection / sec
20
+ # - Request / connection
21
+ # - Active connections
22
+ # - Reading
23
+ # - Writing
24
+ # - Waiting
25
+ ########################################
26
+
27
+ # Usage:
28
+ # Copy to /usr/share/munin/plugins
29
+ # ln -s /usr/share/munin/plugins/nginx_combined_ /etc/munin/plugins/nginx_combined_[hostname OR IP address]
30
+
31
+ #examples based on nginx configuration:
32
+ #example1: ./nginx_combined_mysite.net
33
+ #example2: ./nginx_combined_10.0.0.1
34
+
35
+ ########################################
36
+
37
+ my $ret = undef;
38
+
39
+ if (! eval "require LWP::UserAgent;"){
40
+ $ret = "LWP::UserAgent not found";
41
+ }
42
+
43
+ chomp(my $fqdn = `basename $0 | sed 's/^nginx_combined_//g'`);
44
+
45
+ my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://$fqdn/nginx_status";
46
+
47
+ if ( exists $ARGV[0] and $ARGV[0] eq "autoconf" )
48
+ {
49
+ if ($ret){
50
+ print "no ($ret)\n";
51
+ exit 1;
52
+ }
53
+
54
+ my $ua = LWP::UserAgent->new(timeout => 30);
55
+ my $response = $ua->request(HTTP::Request->new('GET',$URL));
56
+
57
+ unless ($response->is_success and $response->content =~ /server/im)
58
+ {
59
+ print "no (no nginx status on $URL)\n";
60
+ exit 1;
61
+ }
62
+ else
63
+ {
64
+ print "yes\n";
65
+ exit 0;
66
+ }
67
+ }
68
+
69
+ if ( exists $ARGV[0] and $ARGV[0] eq "config" )
70
+ {
71
+ print "graph_title NGINX status: $URL\n";
72
+ print "graph_args --base 1000\n";
73
+ print "graph_category nginx\n";
74
+ print "graph_vlabel Connections\n";
75
+
76
+ print "reqpsec.label Request/sec.\n";
77
+ print "reqpsec.info Request/sec.\n";
78
+ print "reqpsec.draw LINE2\n";
79
+
80
+ print "conpersec.label Connection/sec.\n";
81
+ print "conpersec.info Connection/sec.\n";
82
+ print "conpersec.draw LINE2\n";
83
+
84
+ print "reqpcon.label Request/conn.\n";
85
+ print "reqpcon.info Request/conn.\n";
86
+ print "reqpcon.draw LINE2\n";
87
+
88
+ print "total.label Active connections\n";
89
+ print "total.info Active connections\n";
90
+ print "total.draw LINE2\n";
91
+
92
+ print "reading.label Reading\n";
93
+ print "reading.info Reading\n";
94
+ print "reading.draw LINE2\n";
95
+
96
+ print "writing.label Writing\n";
97
+ print "writing.info Writing\n";
98
+ print "writing.draw LINE2\n";
99
+
100
+ print "waiting.label Waiting\n";
101
+ print "waiting.info Waiting\n";
102
+ print "waiting.draw LINE2\n";
103
+
104
+ exit 0;
105
+ }
106
+
107
+ #do requests
108
+ my $ua = LWP::UserAgent->new(timeout => 10);
109
+ my $response = $ua->request(HTTP::Request->new('GET',$URL));
110
+ sleep(1);
111
+ my $response2 = $ua->request(HTTP::Request->new('GET',$URL));
112
+
113
+
114
+ #calculate responses
115
+ $response->content =~ /Active connections:\s+(\d+).*Reading:\s+(\d+).*Writing:\s+(\d+).*Waiting:\s+(\d+)/s;
116
+ my $a1 = $1;
117
+ my $r1 = $2;
118
+ my $w1 = $3;
119
+ my $wa1 = $4;
120
+
121
+ my $out1 = $response->content;
122
+ $out1 =~ s/\n/ /g;
123
+ my @vals = split(/ /, $out1);
124
+
125
+ my $tmp1_reqpsec=$vals[11];
126
+ my $tmp1_conpsec=$vals[10];
127
+
128
+ $response2->content =~ /Active connections:\s+(\d+).*Reading:\s+(\d+).*Writing:\s+(\d+).*Waiting:\s+(\d+)/s;
129
+
130
+ my $a2 = $1;
131
+ my $r2 = $2;
132
+ my $w2 = $3;
133
+ my $wa2 = $4;
134
+
135
+ my $out2 = $response2->content;
136
+ $out2 =~ s/\n/ /g;
137
+ my @vals2 = split(/ /, $out2);
138
+ my $tmp2_reqpsec=$vals2[11];
139
+ my $tmp2_conpsec=$vals2[10];
140
+
141
+ my $conpersec=0;
142
+ my $reqpcon=0;
143
+ my $reqpsec=0;
144
+ if (defined $tmp2_conpsec && $tmp2_conpsec =~ /^[+-]?\d+$/ && $tmp2_conpsec > 0){
145
+ $conpersec=$tmp2_conpsec-$tmp1_conpsec;
146
+ }
147
+ if (defined $tmp2_reqpsec && $tmp2_reqpsec =~ /^[+-]?\d+$/ && $tmp2_reqpsec > 0){
148
+ $reqpsec=$tmp2_reqpsec-$tmp1_reqpsec;
149
+ }
150
+ if ($conpersec > 0){
151
+ $reqpcon=$reqpsec/$conpersec;
152
+ }
153
+
154
+ print "reqpsec.value $reqpsec\n";
155
+ print "conpersec.value $conpersec\n";
156
+ printf("reqpcon.value %.2f\n", $reqpcon);
157
+ print "total.value $a2\n";
158
+ print "reading.value $r2\n";
159
+ print "writing.value $w2\n";
160
+ print "waiting.value $wa2\n";
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/perl -w
2
+ # -*- cperl -*-
3
+
4
+ =head1 NAME
5
+
6
+ nginx_request - Munin plugin to show number of requests pr. second to nginx.
7
+
8
+ =head1 APPLICABLE SYSTEMS
9
+
10
+ Any nginx host
11
+
12
+ =head1 CONFIGURATION
13
+
14
+ This shows the default configuration of this plugin. You can override
15
+ the status URL.
16
+
17
+ [nginx*]
18
+ env.url http://localhost/nginx_status
19
+
20
+ Nginx must also be configured. Firstly the stub-status module must be
21
+ compiled, and secondly it must be configured like this:
22
+
23
+ server {
24
+ listen 127.0.0.1;
25
+ server_name localhost;
26
+ location /nginx_status {
27
+ stub_status on;
28
+ access_log off;
29
+ allow 127.0.0.1;
30
+ deny all;
31
+ }
32
+ }
33
+
34
+ =head1 MAGIC MARKERS
35
+
36
+ #%# family=auto
37
+ #%# capabilities=autoconf
38
+
39
+ =head1 VERSION
40
+
41
+ $Id: nginx_request.in 2431 2009-09-16 10:04:17Z janl $
42
+
43
+ =head1 BUGS
44
+
45
+ None known
46
+
47
+ =head1 AUTHOR
48
+
49
+ Unknown
50
+
51
+ =head1 LICENSE
52
+
53
+ Unknown. Not specified by the unknown author. Nginx has a BSD
54
+ license. Munin is GPLv2 licensed.
55
+
56
+ =cut
57
+
58
+ my $ret = undef;
59
+
60
+ if (! eval "require LWP::UserAgent;"){
61
+ $ret = "LWP::UserAgent not found";
62
+ }
63
+
64
+ chomp(my $fqdn=`hostname -f 2>/dev/null | hostname`);
65
+
66
+ my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://$fqdn/nginx_status";
67
+ my $port = exists $ENV{'port'} ? $ENV{'port'} : "80";
68
+
69
+ if ( exists $ARGV[0] and $ARGV[0] eq "autoconf" )
70
+ {
71
+ if ($ret){
72
+ print "no ($ret)\n";
73
+ exit 0;
74
+ }
75
+
76
+ my $ua = LWP::UserAgent->new(timeout => 30);
77
+ my $response = $ua->request(HTTP::Request->new('GET',$URL));
78
+
79
+ unless ($response->is_success and $response->content =~ /server/im)
80
+ {
81
+ print "no (no nginx status on $URL)\n";
82
+ exit 0;
83
+ }
84
+ else
85
+ {
86
+ print "yes\n";
87
+ exit 0;
88
+ }
89
+ }
90
+
91
+ if ( exists $ARGV[0] and $ARGV[0] eq "config" )
92
+ {
93
+ print "graph_title Nginx requests\n";
94
+ print "graph_args --base 1000\n";
95
+ print "graph_category nginx\n";
96
+ print "graph_vlabel Request per second\n";
97
+ print "request.label req/sec\n";
98
+ print "request.type DERIVE\n";
99
+ print "request.min 0\n";
100
+ print "request.label requests port $port\n";
101
+ print "request.draw LINE2\n";
102
+
103
+ exit 0;
104
+ }
105
+
106
+ my $ua = LWP::UserAgent->new(timeout => 30);
107
+
108
+ my $response = $ua->request(HTTP::Request->new('GET',$URL));
109
+
110
+ if ($response->content =~ /^\s+(\d+)\s+(\d+)\s+(\d+)/m) {
111
+ print "request.value $3\n";
112
+ } else {
113
+ print "request.value U\n";
114
+ }