gigpark-ec2onrails 0.9.10.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. data/CHANGELOG +190 -0
  2. data/COPYING +339 -0
  3. data/Manifest +160 -0
  4. data/README.textile +233 -0
  5. data/Rakefile +31 -0
  6. data/TODO +104 -0
  7. data/ec2onrails.gemspec +46 -0
  8. data/echoe_config.rb +27 -0
  9. data/examples/Capfile +3 -0
  10. data/examples/deploy.rb +103 -0
  11. data/examples/s3.yml +9 -0
  12. data/lib/ec2onrails.rb +20 -0
  13. data/lib/ec2onrails/capistrano_utils.rb +47 -0
  14. data/lib/ec2onrails/recipes.rb +146 -0
  15. data/lib/ec2onrails/recipes/db.rb +366 -0
  16. data/lib/ec2onrails/recipes/deploy.rb +26 -0
  17. data/lib/ec2onrails/recipes/server.rb +517 -0
  18. data/lib/ec2onrails/version.rb +29 -0
  19. data/server/build +74 -0
  20. data/server/files/etc/README +7 -0
  21. data/server/files/etc/aliases +5 -0
  22. data/server/files/etc/cron.d/ec2onrails +16 -0
  23. data/server/files/etc/cron.daily/app +31 -0
  24. data/server/files/etc/cron.daily/logrotate_post +25 -0
  25. data/server/files/etc/cron.hourly/app +31 -0
  26. data/server/files/etc/cron.monthly/app +31 -0
  27. data/server/files/etc/cron.weekly/app +31 -0
  28. data/server/files/etc/default/varnish +33 -0
  29. data/server/files/etc/default/varnishncsa +11 -0
  30. data/server/files/etc/denyhosts.conf +628 -0
  31. data/server/files/etc/dpkg/dpkg.cfg +13 -0
  32. data/server/files/etc/ec2onrails/rails_env +1 -0
  33. data/server/files/etc/ec2onrails/roles.yml +5 -0
  34. data/server/files/etc/environment +2 -0
  35. data/server/files/etc/event.d/god +8 -0
  36. data/server/files/etc/god/db_primary.god +16 -0
  37. data/server/files/etc/god/dkim_filter.god +17 -0
  38. data/server/files/etc/god/master.conf +40 -0
  39. data/server/files/etc/god/memcache.god +15 -0
  40. data/server/files/etc/god/notifications.god +11 -0
  41. data/server/files/etc/god/proxy.god +40 -0
  42. data/server/files/etc/god/system.god +37 -0
  43. data/server/files/etc/god/web.god +23 -0
  44. data/server/files/etc/init.d/ec2-every-startup +29 -0
  45. data/server/files/etc/init.d/ec2-first-startup +37 -0
  46. data/server/files/etc/init.d/nginx +78 -0
  47. data/server/files/etc/logrotate.d/nginx +10 -0
  48. data/server/files/etc/logrotate.d/rails +8 -0
  49. data/server/files/etc/logrotate.d/varnish +14 -0
  50. data/server/files/etc/memcached.conf +47 -0
  51. data/server/files/etc/motd.tail +13 -0
  52. data/server/files/etc/mysql/my.cnf +152 -0
  53. data/server/files/etc/nginx/conf.d/custom.conf +1 -0
  54. data/server/files/etc/nginx/nginx.conf.erb +152 -0
  55. data/server/files/etc/postfix/main.cf +4 -0
  56. data/server/files/etc/ssh/sshd_config +96 -0
  57. data/server/files/etc/sudoers +31 -0
  58. data/server/files/etc/syslog.conf +63 -0
  59. data/server/files/etc/varnish/default.vcl.erb +140 -0
  60. data/server/files/usr/local/ec2onrails/COPYING +339 -0
  61. data/server/files/usr/local/ec2onrails/bin/archive_file +44 -0
  62. data/server/files/usr/local/ec2onrails/bin/backup_app_db +160 -0
  63. data/server/files/usr/local/ec2onrails/bin/backup_dir +89 -0
  64. data/server/files/usr/local/ec2onrails/bin/ec2_meta_data +80 -0
  65. data/server/files/usr/local/ec2onrails/bin/exec_runner +76 -0
  66. data/server/files/usr/local/ec2onrails/bin/in_role +33 -0
  67. data/server/files/usr/local/ec2onrails/bin/init_services +43 -0
  68. data/server/files/usr/local/ec2onrails/bin/install_system_files +56 -0
  69. data/server/files/usr/local/ec2onrails/bin/optimize_mysql +346 -0
  70. data/server/files/usr/local/ec2onrails/bin/public-hostname +24 -0
  71. data/server/files/usr/local/ec2onrails/bin/rails_env +33 -0
  72. data/server/files/usr/local/ec2onrails/bin/rebundle +62 -0
  73. data/server/files/usr/local/ec2onrails/bin/restore_app_db +58 -0
  74. data/server/files/usr/local/ec2onrails/bin/set_rails_env +36 -0
  75. data/server/files/usr/local/ec2onrails/bin/set_roles +36 -0
  76. data/server/files/usr/local/ec2onrails/bin/uninstall_system_files +34 -0
  77. data/server/files/usr/local/ec2onrails/config +30 -0
  78. data/server/files/usr/local/ec2onrails/lib/aws_helper.rb +75 -0
  79. data/server/files/usr/local/ec2onrails/lib/god_helper.rb +84 -0
  80. data/server/files/usr/local/ec2onrails/lib/mysql_helper.rb +100 -0
  81. data/server/files/usr/local/ec2onrails/lib/roles_helper.rb +156 -0
  82. data/server/files/usr/local/ec2onrails/lib/s3_helper.rb +116 -0
  83. data/server/files/usr/local/ec2onrails/lib/system_files_helper.rb +110 -0
  84. data/server/files/usr/local/ec2onrails/lib/system_files_manifest.rb +107 -0
  85. data/server/files/usr/local/ec2onrails/lib/utils.rb +26 -0
  86. data/server/files/usr/local/ec2onrails/lib/vendor/ini.rb +268 -0
  87. data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/README +5 -0
  88. data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/create-mysqld-pid-dir +26 -0
  89. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/README +5 -0
  90. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/create-dirs +45 -0
  91. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/generate-default-web-cert-and-key +49 -0
  92. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/get-hostname +27 -0
  93. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/misc +27 -0
  94. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/prepare-mysql-data-dir +24 -0
  95. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-credentials +32 -0
  96. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-file-permissions +30 -0
  97. data/server/rakefile-wrapper +26 -0
  98. data/server/rakefile.rb +267 -0
  99. data/test/autobench.conf +60 -0
  100. data/test/spec/lib/s3_helper_spec.rb +154 -0
  101. data/test/spec/lib/s3_old.yml +3 -0
  102. data/test/spec/lib/system_files_manifest_spec.rb +122 -0
  103. data/test/spec/test_files/system_files1/_manifest +13 -0
  104. data/test/spec/test_files/system_files1/test1 +0 -0
  105. data/test/spec/test_files/system_files1/test2 +0 -0
  106. data/test/spec/test_files/system_files1/testfolder/test3 +0 -0
  107. data/test/spec/test_files/system_files2/_manifest +2 -0
  108. data/test/spec/test_files/system_files2/test1 +0 -0
  109. data/test/spec/test_files/system_files2/test2 +0 -0
  110. data/test/spec/test_files/system_files2/testfolder/test3 +0 -0
  111. data/test/spec/test_files/test2 +0 -0
  112. data/test/test_app/Capfile +3 -0
  113. data/test/test_app/README +243 -0
  114. data/test/test_app/Rakefile +10 -0
  115. data/test/test_app/app/controllers/application_controller.rb +10 -0
  116. data/test/test_app/app/controllers/db_fast_controller.rb +6 -0
  117. data/test/test_app/app/controllers/fast_controller.rb +5 -0
  118. data/test/test_app/app/controllers/slow_controller.rb +6 -0
  119. data/test/test_app/app/controllers/very_slow_controller.rb +6 -0
  120. data/test/test_app/app/helpers/application_helper.rb +3 -0
  121. data/test/test_app/config/boot.rb +110 -0
  122. data/test/test_app/config/database.yml +24 -0
  123. data/test/test_app/config/deploy.rb +22 -0
  124. data/test/test_app/config/ec2onrails/config.rb +5 -0
  125. data/test/test_app/config/environment.rb +41 -0
  126. data/test/test_app/config/environments/development.rb +17 -0
  127. data/test/test_app/config/environments/production.rb +28 -0
  128. data/test/test_app/config/environments/test.rb +28 -0
  129. data/test/test_app/config/initializers/backtrace_silencers.rb +7 -0
  130. data/test/test_app/config/initializers/inflections.rb +10 -0
  131. data/test/test_app/config/initializers/mime_types.rb +5 -0
  132. data/test/test_app/config/initializers/new_rails_defaults.rb +19 -0
  133. data/test/test_app/config/initializers/session_store.rb +15 -0
  134. data/test/test_app/config/locales/en.yml +5 -0
  135. data/test/test_app/config/routes.rb +43 -0
  136. data/test/test_app/doc/README_FOR_APP +2 -0
  137. data/test/test_app/public/404.html +30 -0
  138. data/test/test_app/public/422.html +30 -0
  139. data/test/test_app/public/500.html +30 -0
  140. data/test/test_app/public/favicon.ico +0 -0
  141. data/test/test_app/public/images/rails.png +0 -0
  142. data/test/test_app/public/index.html +275 -0
  143. data/test/test_app/public/javascripts/application.js +2 -0
  144. data/test/test_app/public/javascripts/controls.js +963 -0
  145. data/test/test_app/public/javascripts/dragdrop.js +973 -0
  146. data/test/test_app/public/javascripts/effects.js +1128 -0
  147. data/test/test_app/public/javascripts/prototype.js +4320 -0
  148. data/test/test_app/public/robots.txt +5 -0
  149. data/test/test_app/script/about +4 -0
  150. data/test/test_app/script/console +3 -0
  151. data/test/test_app/script/dbconsole +3 -0
  152. data/test/test_app/script/destroy +3 -0
  153. data/test/test_app/script/generate +3 -0
  154. data/test/test_app/script/performance/benchmarker +3 -0
  155. data/test/test_app/script/performance/profiler +3 -0
  156. data/test/test_app/script/plugin +3 -0
  157. data/test/test_app/script/runner +3 -0
  158. data/test/test_app/script/server +3 -0
  159. data/test/test_app/test/performance/browsing_test.rb +9 -0
  160. data/test/test_app/test/test_helper.rb +38 -0
  161. metadata +266 -0
@@ -0,0 +1,13 @@
1
+ # dpkg configuration file
2
+ #
3
+ # This file can contain default options for dpkg. All command-line
4
+ # options are allowed. Values can be specified by putting them after
5
+ # the option, separated by whitespace and/or an `=' sign.
6
+ #
7
+
8
+ # ec2onrails note: if we have a config file already up here, we want to use
9
+ # that over the packages default.
10
+ force-confold
11
+
12
+ # Log status changes and actions to a file.
13
+ log /var/log/dpkg.log
@@ -0,0 +1 @@
1
+ production
@@ -0,0 +1,5 @@
1
+ ---
2
+ :memcache:
3
+ :db_primary:
4
+ :web:
5
+ :proxy:
@@ -0,0 +1,2 @@
1
+ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/ec2onrails/bin"
2
+ RUBYLIB=/usr/lib/ruby/1.8:/usr/local/lib/1.8/i486-linux:/usr/lib/site_ruby
@@ -0,0 +1,8 @@
1
+ description "god monitoring daemon"
2
+
3
+ start on runlevel [2345]
4
+
5
+ stop on runlevel [06]
6
+
7
+ exec /usr/bin/god -D -c /etc/god/master.conf -l /mnt/log/god/god.log
8
+ respawn
@@ -0,0 +1,16 @@
1
+ God.watch do |w|
2
+ w.name = 'mysql'
3
+ w.group = 'db_primary'
4
+ w.autostart = false
5
+
6
+ w.start = "/etc/init.d/mysql start"
7
+ w.stop = "/etc/init.d/mysql stop;"
8
+ w.restart = "/etc/init.d/mysql restart"
9
+
10
+ w.pid_file = "/var/run/mysqld/mysqld.pid"
11
+
12
+ default_configurations(w)
13
+ w.grace = 60.seconds
14
+
15
+ restart_if_resource_hog(w, :memory_usage => false)
16
+ end
@@ -0,0 +1,17 @@
1
+ if File.exists?('/etc/init.d/dkim-filter')
2
+ #we have it installed, so lets register it with God
3
+ God.watch do |w|
4
+ w.name = 'dkim_filter'
5
+ w.group = 'app'
6
+ w.autostart = false
7
+
8
+ w.start = "/etc/init.d/dkim-filter start"
9
+ w.stop = "/etc/init.d/dkim-filter stop"
10
+ w.restart = "/etc/init.d/dkim-filter restart"
11
+
12
+ w.pid_file = "/var/run/dkim-filter/dkim-filter.pid"
13
+
14
+ default_configurations(w)
15
+ restart_if_resource_hog(w, :memory_usage => 20.megabytes, :cpu_usage => 10.percent)
16
+ end
17
+ end
@@ -0,0 +1,40 @@
1
+ # For TextMate users, change the language type (at bottom of window, next to line/column counter, to ruby)
2
+ #
3
+
4
+ # TODO move to event-based config
5
+
6
+ applog(nil, :info, "loading /etc/god/master.conf")
7
+
8
+ require '/usr/local/ec2onrails/lib/god_helper'
9
+ require '/usr/local/ec2onrails/lib/roles_helper'
10
+ require '/usr/local/ec2onrails/lib/utils'
11
+ require "fileutils"
12
+
13
+ include GodHelper
14
+ include Ec2onrails::RolesHelper
15
+
16
+ APP_ROOT = "/mnt/app/current"
17
+
18
+ @configs = GodHelper::Configs.new
19
+
20
+ God.pid_file_directory = "/var/run/god"
21
+
22
+ applog(nil, :info, "About to load system configs at /etc/god/*.god")
23
+ God.load "/etc/god/*.god"
24
+
25
+ applog(nil, :info, "About to load application-specific configs at #{APP_ROOT}/config/god/*.god")
26
+ God.load "#{APP_ROOT}/config/god/*.god"
27
+
28
+
29
+ # at the end, we want to init the correct services
30
+ # need to put it into a thread because god is not finished
31
+ # initalizing at this point, so we need to let it finish
32
+ # so we can call init_services, which calls god directly
33
+ #
34
+ # using a fork copies over the processing space, causing
35
+ # god to reload again..and again...and again...
36
+ Thread.new do
37
+ sleep(2)
38
+ applog(nil, :info, "initializing services....")
39
+ system("/usr/local/ec2onrails/bin/init_services")
40
+ end
@@ -0,0 +1,15 @@
1
+ God.watch do |w|
2
+ w.name = "memcached"
3
+ w.group = 'memcache'
4
+ w.autostart = false
5
+
6
+ w.start = "/etc/init.d/memcached start"
7
+ w.stop = "/etc/init.d/memcached stop"
8
+ w.restart = "/etc/init.d/memcached restart"
9
+ w.pid_file = "/var/run/memcached.pid"
10
+
11
+ default_configurations(w)
12
+ w.grace = 10.seconds
13
+
14
+ restart_if_resource_hog(w, :memory_usage => false)
15
+ end
@@ -0,0 +1,11 @@
1
+ God::Contacts::Email.message_settings = {
2
+ :from => 'root@localhost'
3
+ }
4
+
5
+ God::Contacts::Email.delivery_method = :sendmail
6
+
7
+ God.contact(:email) do |c|
8
+ c.name = 'root'
9
+ c.email = 'root@localhost'
10
+ c.group = 'default'
11
+ end
@@ -0,0 +1,40 @@
1
+ God.watch do |w|
2
+ w.name = "varnish"
3
+ w.group = "proxy"
4
+ w.autostart = false
5
+
6
+ w.start = "/etc/init.d/varnish start"
7
+ w.stop = "/etc/init.d/varnish stop"
8
+ w.restart = "/etc/init.d/varnish restart"
9
+ w.pid_file = "/var/run/varnishd.pid"
10
+ w.grace = 10.seconds
11
+
12
+ default_configurations(w)
13
+
14
+ # I'm not sure if it's very useful to monitor the varnishd memory usage,
15
+ # because it writes the pid of the varnishd parent process in it's pid file,
16
+ # so I assume that's what god is monitoring, and the varnishd parent starts
17
+ # a child process to do the real work.
18
+ # Also, the child process allocates all cache storage with malloc, so the
19
+ # VSS size can get very large and depends on the amount of storage
20
+ # configured. It relies on the OS to page unused portions to disk, but at
21
+ # the moment we don't have much swap configured (just using the defaults
22
+ # from Eric Hammond's base image).
23
+ restart_if_resource_hog(w, :memory_usage => 100.megabytes, :cpu_usage => 50.percent)
24
+ end
25
+
26
+ God.watch do |w|
27
+ w.name = "varnishncsa"
28
+ w.group = "proxy"
29
+ w.autostart = false
30
+
31
+ w.start = "/etc/init.d/varnishncsa start"
32
+ w.stop = "/etc/init.d/varnishncsa stop"
33
+ w.restart = "/etc/init.d/varnishncsa restart"
34
+ w.pid_file = "/var/run/varnishncsa.pid"
35
+ w.grace = 10.seconds
36
+
37
+ default_configurations(w)
38
+
39
+ restart_if_resource_hog(w, :memory_usage => 100.megabytes, :cpu_usage => 50.percent)
40
+ end
@@ -0,0 +1,37 @@
1
+ God.watch do |w|
2
+ w.name = "system-checks"
3
+ w.start = true
4
+ w.interval = 10.minutes
5
+
6
+
7
+ w.behavior(:clean_pid_file)
8
+
9
+
10
+ # lifecycle
11
+ w.lifecycle do |on|
12
+ on.condition(:disk_usage) do |c|
13
+ c.mount_point = "/"
14
+ c.above = 75
15
+ c.notify = {:contacts => ['default'], :category => "RAILS_ENV=#{Ec2onrails::Utils.rails_env}"}
16
+ end
17
+
18
+ on.condition(:disk_usage) do |c|
19
+ c.mount_point = "/mnt"
20
+ c.above = 75
21
+ c.notify = {:contacts => ['default'], :category => "RAILS_ENV=#{Ec2onrails::Utils.rails_env}"}
22
+ end
23
+
24
+ on.condition(:memory_usage) do |c|
25
+ c.above = 80.percent
26
+ c.times = [3, 5] # 3 out of 5 intervals
27
+ c.notify = {:contacts => ['default'], :category => "RAILS_ENV=#{Ec2onrails::Utils.rails_env}"}
28
+ end
29
+
30
+ on.condition(:cpu_usage) do |c|
31
+ c.above = 90.percent
32
+ c.times = [5, 8]
33
+ c.notify = {:contacts => ['default'], :category => "RAILS_ENV=#{Ec2onrails::Utils.rails_env}"}
34
+ end
35
+ end
36
+
37
+ end
@@ -0,0 +1,23 @@
1
+ God.watch do |w|
2
+ w.name = "nginx"
3
+ w.group = 'web'
4
+
5
+ w.start = "/etc/init.d/nginx start"
6
+ w.stop = "/etc/init.d/nginx stop"
7
+ w.restart = "/etc/init.d/nginx restart"
8
+ w.pid_file = "/var/run/nginx.pid"
9
+ w.autostart = false
10
+
11
+ default_configurations(w)
12
+
13
+ restart_if_resource_hog(w, :memory_usage => 250.megabytes) do |restart|
14
+ restart.condition(:http_response_code) do |c|
15
+ c.host = '127.0.0.1'
16
+ c.port = in_role?(:proxy) ? 81 : 80
17
+ c.path = '/nginx_status'
18
+ c.code_is_not = 200
19
+ c.timeout = 5.seconds
20
+ c.times = [3, 5] # 3 out of 5 intervals
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ #!/bin/sh
2
+
3
+ # This file is part of EC2 on Rails.
4
+ # http://rubyforge.org/projects/ec2onrails/
5
+ #
6
+ # Copyright 2007 Paul Dowman, http://pauldowman.com/
7
+ #
8
+ # EC2 on Rails is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # EC2 on Rails is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+
22
+ # This script runs the ec2 startup scripts
23
+
24
+ # this is an ugly hack to make sure DHCP initialization is finished:
25
+ sleep 15
26
+
27
+ for SCRIPT in `ls -I README /usr/local/ec2onrails/startup-scripts/every-startup` ; do
28
+ "/usr/local/ec2onrails/startup-scripts/every-startup/$SCRIPT"
29
+ done
@@ -0,0 +1,37 @@
1
+ #!/bin/sh
2
+
3
+ # This file is part of EC2 on Rails.
4
+ # http://rubyforge.org/projects/ec2onrails/
5
+ #
6
+ # Copyright 2007 Paul Dowman, http://pauldowman.com/
7
+ #
8
+ # EC2 on Rails is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # EC2 on Rails is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+
22
+ # This script runs the ec2 startup scripts
23
+
24
+ FILE=/mnt/.ec2onrails-first-boot
25
+
26
+ if [ ! -e $FILE ] ; then
27
+
28
+ # TODO improve this:
29
+ # this is an ugly hack to make sure DHCP initialization is finished:
30
+ sleep 15
31
+
32
+ for SCRIPT in `ls -I README /usr/local/ec2onrails/startup-scripts/first-startup` ; do
33
+ "/usr/local/ec2onrails/startup-scripts/first-startup/$SCRIPT"
34
+ done
35
+
36
+ touch $FILE
37
+ fi
@@ -0,0 +1,78 @@
1
+ #!/bin/sh
2
+
3
+ #This is a start script for nginx. Tested on Unbuntu Edge.
4
+ #Should work on Ubuntu, Debian and probably a few other Linux distros.
5
+ #Change DAEMON and CONFIG_FILE if neccessary
6
+
7
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin
8
+
9
+
10
+ #Location of nginx binary. Change path as neccessary
11
+ DAEMON=/usr/sbin/nginx
12
+ # DAEMON=/usr/local/nginx/sbin/nginx
13
+ #Location of configuration file. Change path as neccessary
14
+ CONFIG_FILE=/etc/nginx/nginx.conf
15
+ # CONFIG_FILE=/usr/local/nginx/conf/nginx.conf
16
+
17
+
18
+ DAEMON_OPTS="-c $CONFIG_FILE"
19
+ NAME=nginx
20
+ DESC="web server"
21
+ PIDFILE=/var/run/$NAME.pid
22
+ SCRIPTNAME=/etc/init.d/$NAME
23
+
24
+
25
+ #only run if binary can be found
26
+ test -x $DAEMON || exit 0
27
+
28
+ set -e
29
+
30
+ #import init-functions
31
+ . /lib/lsb/init-functions
32
+
33
+ case "$1" in
34
+ start)
35
+ log_daemon_msg "Starting $DESC" $NAME
36
+ if ! start-stop-daemon --start --quiet\
37
+ --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
38
+ log_end_msg 1
39
+ else
40
+ log_end_msg 0
41
+ fi
42
+ ;;
43
+ stop)
44
+ log_daemon_msg "Stopping $DESC" $NAME
45
+ if start-stop-daemon --quiet --stop --oknodo --retry 30\
46
+ --pidfile $PIDFILE --exec $DAEMON; then
47
+ rm -f $PIDFILE
48
+ log_end_msg 0
49
+ else
50
+ log_end_msg 1
51
+ fi
52
+ ;;
53
+ reload)
54
+ log_daemon_msg "Reloading $DESC configuration" $NAME
55
+ if start-stop-daemon --stop --signal 2 --oknodo --retry 30\
56
+ --quiet --pidfile $PIDFILE --exec $DAEMON; then
57
+ if start-stop-daemon --start --quiet \
58
+ --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
59
+ log_end_msg 0
60
+ else
61
+ log_end_msg 1
62
+ fi
63
+ else
64
+ log_end_msg 1
65
+ fi
66
+ ;;
67
+ restart|force-reload)
68
+ $0 stop
69
+ sleep 1
70
+ $0 start
71
+ ;;
72
+ *)
73
+ echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
74
+ exit 1
75
+ ;;
76
+ esac
77
+
78
+ exit 0
@@ -0,0 +1,10 @@
1
+ /mnt/log/nginx/*.log {
2
+ daily
3
+ rotate 7
4
+ missingok
5
+ dateext
6
+ sharedscripts
7
+ postrotate
8
+ test -f /var/run/nginx.pid && kill -USR1 `cat /var/run/nginx.pid`
9
+ endscript
10
+ }
@@ -0,0 +1,8 @@
1
+ # Rotate Rails application logs
2
+ /mnt/app/current/log/*.log {
3
+ daily
4
+ rotate 7
5
+ missingok
6
+ dateext
7
+ copytruncate
8
+ }
@@ -0,0 +1,14 @@
1
+ /mnt/log/varnish/varnish.log /mnt/log/varnish/varnishncsa.log {
2
+ daily
3
+ rotate 7
4
+ missingok
5
+ dateext
6
+ sharedscripts
7
+ postrotate
8
+ for service in varnishlog varnishncsa; do
9
+ if /usr/bin/pgrep -P 1 $service >/dev/null; then
10
+ /usr/sbin/invoke-rc.d $service reload > /dev/null
11
+ fi
12
+ done
13
+ endscript
14
+ }
@@ -0,0 +1,47 @@
1
+ # memcached default config file
2
+ # 2003 - Jay Bonci <jaybonci@debian.org>
3
+ # This configuration file is read by the start-memcached script provided as
4
+ # part of the Debian GNU/Linux distribution.
5
+
6
+ # Run memcached as a daemon. This command is implied, and is not needed for the
7
+ # daemon to run. See the README.Debian that comes with this package for more
8
+ # information.
9
+ -d
10
+
11
+ # Log memcached's output to /var/log/memcached
12
+ logfile /mnt/log/memcached.log
13
+
14
+ # Be verbose
15
+ # -v
16
+
17
+ # Be even more verbose (print client commands as well)
18
+ # -vv
19
+
20
+ # Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
21
+ # Note that the daemon will grow to this size, but does not start out holding this much
22
+ # memory
23
+ -m 128
24
+
25
+ # Default connection port is 11211
26
+ -p 11211
27
+
28
+ # Run the daemon as root. The start-memcached will default to running as root if no
29
+ # -u command is present in this config file
30
+ -u nobody
31
+
32
+ # Specify which IP address to listen on. The default is to listen on all IP addresses
33
+ # This parameter is one of the only security measures that memcached has, so make sure
34
+ # it's listening on a firewalled interface.
35
+ #-l 127.0.0.1
36
+
37
+ # Limit the number of simultaneous incoming connections. The daemon default is 1024
38
+ # -c 1024
39
+
40
+ # Lock down all paged memory. Consult with the README and homepage before you do this
41
+ # -k
42
+
43
+ # Return error when memory is exhausted (rather than removing items)
44
+ # -M
45
+
46
+ # Maximize core file limit
47
+ # -r