Agiley-ec2onrails 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. data/{History.txt → CHANGELOG} +0 -0
  2. data/{COPYING.txt → COPYING} +0 -0
  3. data/Manifest +161 -0
  4. data/{website/index.txt → README.textile} +33 -5
  5. data/Rakefile +36 -4
  6. data/TODO +91 -0
  7. data/ec2onrails.gemspec +279 -0
  8. data/examples/Capfile +3 -0
  9. data/examples/deploy.rb +88 -0
  10. data/examples/s3.yml +9 -0
  11. data/lib/ec2onrails/capistrano_utils.rb +0 -11
  12. data/lib/ec2onrails/recipes.rb +165 -59
  13. data/lib/ec2onrails/version.rb +1 -1
  14. data/server/build-ec2onrails.sh +44 -0
  15. data/server/files/etc/aliases +5 -0
  16. data/server/files/etc/aliases.db +0 -0
  17. data/server/files/etc/apache2/apache2.conf +295 -0
  18. data/server/files/etc/apache2/conf.d/app.proxy_cluster.conf +7 -0
  19. data/server/files/etc/apache2/conf.d/app.proxy_frontend.conf +10 -0
  20. data/server/files/etc/apache2/mods-available/proxy.conf +18 -0
  21. data/server/files/etc/apache2/sites-available/app.common +56 -0
  22. data/server/files/etc/apache2/sites-available/app.custom +0 -0
  23. data/server/files/etc/apache2/sites-available/default +14 -0
  24. data/server/files/etc/apache2/sites-available/default-ssl +18 -0
  25. data/server/files/etc/cron.d/backup_app_db_to_s3 +6 -0
  26. data/server/files/etc/cron.daily/app +9 -0
  27. data/server/files/etc/cron.daily/logrotate_post +19 -0
  28. data/server/files/etc/cron.hourly/app +10 -0
  29. data/server/files/etc/cron.monthly/app +10 -0
  30. data/server/files/etc/cron.weekly/app +10 -0
  31. data/server/files/etc/ec2onrails/balancer_members +6 -0
  32. data/server/files/etc/ec2onrails/roles.yml +5 -0
  33. data/server/files/etc/environment +2 -0
  34. data/server/files/etc/event.d/monit +13 -0
  35. data/server/files/etc/init.d/ec2-every-startup +29 -0
  36. data/server/files/etc/init.d/ec2-first-startup +36 -0
  37. data/server/files/etc/init.d/mongrel +91 -0
  38. data/server/files/etc/init.d/nginx +78 -0
  39. data/server/files/etc/init.d/set_roles +3 -0
  40. data/server/files/etc/logrotate.d/apache2 +16 -0
  41. data/server/files/etc/logrotate.d/mongrel +11 -0
  42. data/server/files/etc/logrotate.d/nginx +11 -0
  43. data/server/files/etc/memcached.conf +47 -0
  44. data/server/files/etc/mongrel_cluster/app.yml +9 -0
  45. data/server/files/etc/monit/README +5 -0
  46. data/server/files/etc/monit/app.monitrc.erb +13 -0
  47. data/server/files/etc/monit/db_primary.monitrc.erb +10 -0
  48. data/server/files/etc/monit/memcache.monitrc +8 -0
  49. data/server/files/etc/monit/monitrc +12 -0
  50. data/server/files/etc/monit/system.monitrc +15 -0
  51. data/server/files/etc/monit/web.monitrc.erb +23 -0
  52. data/server/files/etc/motd.tail +13 -0
  53. data/server/files/etc/mysql/my.cnf +149 -0
  54. data/server/files/etc/nginx/nginx.conf +296 -0
  55. data/server/files/etc/postfix/main.cf +4 -0
  56. data/server/files/etc/rc0.d/K10mongrel +1 -0
  57. data/server/files/etc/rc1.d/K10mongrel +1 -0
  58. data/server/files/etc/rc2.d/S90mongrel +1 -0
  59. data/server/files/etc/rc3.d/S90mongrel +1 -0
  60. data/server/files/etc/rc4.d/S90mongrel +1 -0
  61. data/server/files/etc/rc5.d/S90mongrel +1 -0
  62. data/server/files/etc/rc6.d/K10mongrel +1 -0
  63. data/server/files/etc/rcS.d/S91ec2-first-startup +1 -0
  64. data/server/files/etc/rcS.d/S92ec2-every-startup +1 -0
  65. data/server/files/etc/rcS.d/S99set_roles +1 -0
  66. data/server/files/etc/ssh/sshd_config +94 -0
  67. data/server/files/etc/sudoers +1 -0
  68. data/server/files/etc/sudoers.full_access +26 -0
  69. data/server/files/etc/sudoers.restricted_access +28 -0
  70. data/server/files/etc/syslog.conf +69 -0
  71. data/server/files/usr/local/ec2onrails/COPYING +339 -0
  72. data/server/files/usr/local/ec2onrails/bin/archive_file.rb +44 -0
  73. data/server/files/usr/local/ec2onrails/bin/backup_app_db.rb +68 -0
  74. data/server/files/usr/local/ec2onrails/bin/init_services.rb +57 -0
  75. data/server/files/usr/local/ec2onrails/bin/mongrel_start +8 -0
  76. data/server/files/usr/local/ec2onrails/bin/mongrel_stop +8 -0
  77. data/server/files/usr/local/ec2onrails/bin/optimize_mysql.rb +339 -0
  78. data/server/files/usr/local/ec2onrails/bin/rails_env +35 -0
  79. data/server/files/usr/local/ec2onrails/bin/rebundle.sh +70 -0
  80. data/server/files/usr/local/ec2onrails/bin/restore_app_db.rb +58 -0
  81. data/server/files/usr/local/ec2onrails/bin/set_rails_env +40 -0
  82. data/server/files/usr/local/ec2onrails/bin/set_roles.rb +76 -0
  83. data/server/files/usr/local/ec2onrails/bin/setup_web_proxy.rb +106 -0
  84. data/server/files/usr/local/ec2onrails/config +30 -0
  85. data/server/files/usr/local/ec2onrails/lib/mysql_helper.rb +82 -0
  86. data/server/files/usr/local/ec2onrails/lib/roles_helper.rb +137 -0
  87. data/server/files/usr/local/ec2onrails/lib/s3_helper.rb +126 -0
  88. data/server/files/usr/local/ec2onrails/lib/utils.rb +16 -0
  89. data/server/files/usr/local/ec2onrails/lib/vendor/ini.rb +268 -0
  90. data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/get-hostname.sh +27 -0
  91. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/README +5 -0
  92. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/create-dirs.sh +42 -0
  93. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/generate-default-web-cert-and-key.sh +49 -0
  94. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/misc.sh +27 -0
  95. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/prepare-mysql-data-dir.sh +24 -0
  96. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-credentials.sh +29 -0
  97. data/server/rakefile.rb +222 -0
  98. data/test/autobench.conf +60 -0
  99. data/test/spec/lib/s3_helper_spec.rb +134 -0
  100. data/test/spec/lib/s3_old.yml +3 -0
  101. data/test/spec/test_files/test1 +0 -0
  102. data/test/spec/test_files/test2 +0 -0
  103. data/test/test_app/Capfile +3 -0
  104. data/test/test_app/README +182 -0
  105. data/test/test_app/Rakefile +10 -0
  106. data/test/test_app/app/controllers/application.rb +7 -0
  107. data/test/test_app/app/controllers/db_fast_controller.rb +6 -0
  108. data/test/test_app/app/controllers/fast_controller.rb +5 -0
  109. data/test/test_app/app/controllers/slow_controller.rb +6 -0
  110. data/test/test_app/app/controllers/very_slow_controller.rb +6 -0
  111. data/test/test_app/app/helpers/application_helper.rb +3 -0
  112. data/test/test_app/app/helpers/db_fast_helper.rb +2 -0
  113. data/test/test_app/app/helpers/fast_helper.rb +2 -0
  114. data/test/test_app/app/helpers/slow_helper.rb +2 -0
  115. data/test/test_app/app/helpers/very_slow_helper.rb +2 -0
  116. data/test/test_app/config/boot.rb +109 -0
  117. data/test/test_app/config/database.yml +19 -0
  118. data/test/test_app/config/deploy.rb +21 -0
  119. data/test/test_app/config/environment.rb +60 -0
  120. data/test/test_app/config/environments/development.rb +21 -0
  121. data/test/test_app/config/environments/production.rb +18 -0
  122. data/test/test_app/config/environments/test.rb +19 -0
  123. data/test/test_app/config/routes.rb +27 -0
  124. data/test/test_app/db/schema.rb +7 -0
  125. data/test/test_app/doc/README_FOR_APP +2 -0
  126. data/test/test_app/public/404.html +30 -0
  127. data/test/test_app/public/500.html +30 -0
  128. data/test/test_app/public/dispatch.cgi +10 -0
  129. data/test/test_app/public/dispatch.fcgi +24 -0
  130. data/test/test_app/public/dispatch.rb +10 -0
  131. data/test/test_app/public/favicon.ico +0 -0
  132. data/test/test_app/public/images/rails.png +0 -0
  133. data/test/test_app/public/javascripts/application.js +2 -0
  134. data/test/test_app/public/javascripts/controls.js +963 -0
  135. data/test/test_app/public/javascripts/dragdrop.js +972 -0
  136. data/test/test_app/public/javascripts/effects.js +1120 -0
  137. data/test/test_app/public/javascripts/prototype.js +4225 -0
  138. data/test/test_app/public/robots.txt +1 -0
  139. data/test/test_app/script/about +3 -0
  140. data/test/test_app/script/breakpointer +3 -0
  141. data/test/test_app/script/console +3 -0
  142. data/test/test_app/script/destroy +3 -0
  143. data/test/test_app/script/generate +3 -0
  144. data/test/test_app/script/performance/benchmarker +3 -0
  145. data/test/test_app/script/performance/profiler +3 -0
  146. data/test/test_app/script/performance/request +3 -0
  147. data/test/test_app/script/plugin +3 -0
  148. data/test/test_app/script/process/inspector +3 -0
  149. data/test/test_app/script/process/reaper +3 -0
  150. data/test/test_app/script/process/spawner +3 -0
  151. data/test/test_app/script/runner +3 -0
  152. data/test/test_app/script/server +3 -0
  153. data/test/test_app/test/functional/db_fast_controller_test.rb +18 -0
  154. data/test/test_app/test/functional/fast_controller_test.rb +18 -0
  155. data/test/test_app/test/functional/slow_controller_test.rb +18 -0
  156. data/test/test_app/test/functional/very_slow_controller_test.rb +18 -0
  157. metadata +193 -36
  158. data/Manifest.txt +0 -25
  159. data/README.txt +0 -1
  160. data/config/hoe.rb +0 -70
  161. data/config/requirements.rb +0 -17
  162. data/script/destroy +0 -14
  163. data/script/generate +0 -14
  164. data/script/txt2html +0 -74
  165. data/tasks/deployment.rake +0 -27
  166. data/tasks/environment.rake +0 -7
  167. data/tasks/website.rake +0 -17
  168. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  169. data/website/stylesheets/screen.css +0 -144
  170. data/website/template.rhtml +0 -53
@@ -0,0 +1,14 @@
1
+ # Based on http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/
2
+
3
+ NameVirtualHost *:80
4
+ <VirtualHost *:80>
5
+
6
+ Include /etc/apache2/sites-available/app.custom
7
+ Include /etc/apache2/sites-available/app.common
8
+
9
+ ErrorLog /mnt/log/apache2/error.log
10
+ LogLevel warn
11
+
12
+ CustomLog /mnt/log/apache2/access.log combined
13
+
14
+ </VirtualHost>
@@ -0,0 +1,18 @@
1
+ # Based on http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/
2
+
3
+ NameVirtualHost *:443
4
+ <VirtualHost *:443>
5
+
6
+ Include /etc/apache2/sites-available/app.custom
7
+ Include /etc/apache2/sites-available/app.common
8
+
9
+ ErrorLog /mnt/log/apache2/error.log
10
+ LogLevel warn
11
+
12
+ CustomLog /mnt/log/apache2/access.log combined
13
+
14
+ # see http://httpd.apache.org/docs/2.2/ssl/ssl_intro.html and http://httpd.apache.org/docs/2.2/mod/mod_ssl.html
15
+ SSLEngine On
16
+ SSLCertificateFile /etc/ec2onrails/ssl/cert/ec2onrails-default.crt
17
+ SSLCertificateKeyFile /etc/ec2onrails/ssl/private/ec2onrails-default.key
18
+ </VirtualHost>
@@ -0,0 +1,6 @@
1
+ # Incremental backup every 5 minutes
2
+ */5 * * * * root /usr/local/ec2onrails/bin/backup_app_db.rb --incremental
3
+
4
+ # Full backup every day at 05:01, reset the binary logs.
5
+ # First kill any incremental backup that happens to be in progress
6
+ 1 5 * * * root killall -q -u root backup_app_db.rb ; /usr/local/ec2onrails/bin/backup_app_db.rb --reset
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+
3
+ #NOTE: you can also call
4
+ # /usr/local/ec2onrails/bin/exec_runner
5
+ # to run a script under a specific role
6
+ # see the file for details
7
+ test -e /mnt/app/current/script/daily || exit 0
8
+ cd /mnt/app/current
9
+ sudo -u app /usr/local/ec2onrails/bin/rails_env script/daily
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ RAILS_ENV=`/usr/local/ec2onrails/bin/rails_env`
4
+
5
+ if [ -x /mnt/app/current ] ; then
6
+ logfile=/mnt/app/current/log/$RAILS_ENV.log-`date +%Y%m%d`
7
+ if [ -e $logfile ] ; then
8
+ gzip $logfile
9
+ /usr/local/ec2onrails/bin/archive_file.rb --file $logfile.gz --dir logs/rails && rm $logfile.gz
10
+ fi
11
+ fi
12
+
13
+ for f in `ls /mnt/log/web_proxy/*.log` ; do
14
+ logfile=$f-`date +%Y%m%d`
15
+ if [ -e $logfile ] ; then
16
+ gzip $logfile
17
+ /usr/local/ec2onrails/bin/archive_file.rb --file $logfile.gz --dir logs/web_proxy && rm $logfile.gz
18
+ fi
19
+ done
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ #NOTE: you can also call
4
+ # /usr/local/ec2onrails/bin/exec_runner
5
+ # to run a script under a specific role
6
+ # see the file for details
7
+
8
+ test -e /mnt/app/current/script/hourly || exit 0
9
+ cd /mnt/app/current
10
+ sudo -u app /usr/local/ec2onrails/bin/rails_env script/hourly
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ #NOTE: you can also call
4
+ # /usr/local/ec2onrails/bin/exec_runner
5
+ # to run a script under a specific role
6
+ # see the file for details
7
+
8
+ test -e /mnt/app/current/script/monthly || exit 0
9
+ cd /mnt/app/current
10
+ sudo -u app /usr/local/ec2onrails/bin/rails_env script/monthly
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ #NOTE: you can also call
4
+ # /usr/local/ec2onrails/bin/exec_runner
5
+ # to run a script under a specific role
6
+ # see the file for details
7
+
8
+ test -e /mnt/app/current/script/weekly || exit 0
9
+ cd /mnt/app/current
10
+ sudo -u app /usr/local/ec2onrails/bin/rails_env script/weekly
@@ -0,0 +1,6 @@
1
+ BalancerMember http://127.0.0.1:8000
2
+ BalancerMember http://127.0.0.1:8001
3
+ BalancerMember http://127.0.0.1:8002
4
+ BalancerMember http://127.0.0.1:8003
5
+ BalancerMember http://127.0.0.1:8004
6
+ BalancerMember http://127.0.0.1:8005
@@ -0,0 +1,5 @@
1
+ ---
2
+ :memcache:
3
+ :db_primary:
4
+ :app:
5
+ :web:
@@ -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,13 @@
1
+ description "monit daemon"
2
+ author "Paul Dowman <paul@pauldowman.com>"
3
+
4
+ start on runlevel 2
5
+ start on runlevel 3
6
+ start on runlevel 4
7
+ start on runlevel 5
8
+
9
+ stop on runlevel 0
10
+ stop on runlevel 6
11
+
12
+ exec /usr/local/bin/monit -I
13
+ respawn
@@ -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,36 @@
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=/ec2onrails-first-boot
25
+
26
+ if [ -e $FILE ] ; then
27
+
28
+ # this is an ugly hack to make sure DHCP initialization is finished:
29
+ sleep 15
30
+
31
+ for SCRIPT in `ls -I README /usr/local/ec2onrails/startup-scripts/first-startup` ; do
32
+ "/usr/local/ec2onrails/startup-scripts/first-startup/$SCRIPT"
33
+ done
34
+
35
+ rm $FILE
36
+ fi
@@ -0,0 +1,91 @@
1
+ #!/bin/sh -e
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
+ #
23
+ # This is the init script to start/stop mongrel
24
+ #
25
+
26
+ NAME="mongrel cluster"
27
+ NO_START=0
28
+
29
+ ########################################
30
+
31
+ if [ ! -d /mnt/app/current ] ; then
32
+ echo "/mnt/app/current doesn't exist, not starting mongrel..."
33
+ exit 0
34
+ fi
35
+
36
+ start_cmd() {
37
+ /usr/local/ec2onrails/bin/mongrel_start
38
+ return $?
39
+ }
40
+
41
+ stop_cmd() {
42
+ /usr/local/ec2onrails/bin/mongrel_stop
43
+ return $?
44
+ }
45
+
46
+ restart_cmd() {
47
+ /usr/local/ec2onrails/bin/mongrel_stop && /usr/local/ec2onrails/bin/mongrel_start
48
+ return $?
49
+ }
50
+
51
+
52
+ ########################################
53
+
54
+ . /lib/lsb/init-functions
55
+
56
+ test -f /etc/default/rcS && . /etc/default/rcS
57
+
58
+ if [ "$NO_START" != "0" -a "$1" != "stop" ]; then
59
+ [ "$VERBOSE" != no ] && log_warning_msg "Not starting $NAME - edit $0 and change NO_START to be 0.";
60
+ exit 0;
61
+ fi
62
+
63
+ case "$1" in
64
+ start)
65
+ log_begin_msg "Starting $NAME..."
66
+ if start_cmd; then
67
+ log_end_msg 0
68
+ else
69
+ log_end_msg 1
70
+ fi
71
+ ;;
72
+ stop)
73
+ log_begin_msg "Stopping $NAME..."
74
+ if stop_cmd; then
75
+ log_end_msg 0
76
+ else
77
+ log_end_msg 1
78
+ fi
79
+ ;;
80
+ restart)
81
+ log_begin_msg "Restarting $NAME..."
82
+ if restart_cmd; then
83
+ log_end_msg 0
84
+ else
85
+ log_end_msg 1
86
+ fi
87
+ ;;
88
+ *)
89
+ log_success_msg "Usage: $0 {start|stop|restart}"
90
+ ;;
91
+ esac
@@ -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,3 @@
1
+ #!/bin/sh
2
+
3
+ /usr/local/ec2onrails/bin/set_roles.rb
@@ -0,0 +1,16 @@
1
+ /mnt/log/apache2/*.log {
2
+ daily
3
+ missingok
4
+ dateext
5
+ create 640 root app
6
+ compress
7
+ notifempty
8
+ sharedscripts
9
+ extension gz
10
+ copytruncate
11
+ postrotate
12
+ if [ -f /var/run/apache2.pid ]; then
13
+ /etc/init.d/apache2 reload > /dev/null
14
+ fi
15
+ endscript
16
+ }
@@ -0,0 +1,11 @@
1
+ /mnt/app/current/log/*/*.log /mnt/app/current/log/*.log {
2
+ daily
3
+ missingok
4
+ dateext
5
+ rotate 365
6
+ compress
7
+ notifempty
8
+ sharedscripts
9
+ extension gz
10
+ copytruncate
11
+ }
@@ -0,0 +1,11 @@
1
+ /mnt/log/nginx/*.log {
2
+ daily
3
+ missingok
4
+ dateext
5
+ compress
6
+ create 640 root app
7
+ notifempty
8
+ sharedscripts
9
+ extension gz
10
+ copytruncate
11
+ }
@@ -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