hennk-hennk-ec2onrails 0.9.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. data/CHANGELOG +0 -0
  2. data/COPYING +339 -0
  3. data/Manifest +148 -0
  4. data/README.textile +214 -0
  5. data/Rakefile +36 -0
  6. data/TODO +5 -0
  7. data/ec2onrails.gemspec +44 -0
  8. data/lib/ec2onrails/capistrano_utils.rb +33 -0
  9. data/lib/ec2onrails/recipes.rb +460 -0
  10. data/lib/ec2onrails/version.rb +32 -0
  11. data/lib/ec2onrails.rb +20 -0
  12. data/server/build-ec2onrails.sh +44 -0
  13. data/server/files/etc/aliases +6 -0
  14. data/server/files/etc/aliases.db +0 -0
  15. data/server/files/etc/apache2/apache2.conf +295 -0
  16. data/server/files/etc/apache2/conf.d/app.proxy_cluster.conf +7 -0
  17. data/server/files/etc/apache2/conf.d/app.proxy_frontend.conf +10 -0
  18. data/server/files/etc/apache2/mods-available/proxy.conf +18 -0
  19. data/server/files/etc/apache2/sites-available/app.common +58 -0
  20. data/server/files/etc/apache2/sites-available/app.custom +0 -0
  21. data/server/files/etc/apache2/sites-available/default +17 -0
  22. data/server/files/etc/apache2/sites-available/default-ssl +18 -0
  23. data/server/files/etc/cron.d/backup_app_db_to_s3 +6 -0
  24. data/server/files/etc/cron.daily/app +5 -0
  25. data/server/files/etc/cron.daily/logrotate_post +27 -0
  26. data/server/files/etc/cron.hourly/app +5 -0
  27. data/server/files/etc/cron.monthly/app +5 -0
  28. data/server/files/etc/cron.weekly/app +5 -0
  29. data/server/files/etc/denyhosts.conf +628 -0
  30. data/server/files/etc/dpkg/dpkg.cfg +13 -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/set_roles +3 -0
  39. data/server/files/etc/logrotate.d/apache2 +13 -0
  40. data/server/files/etc/logrotate.d/mysql-server +23 -0
  41. data/server/files/etc/logrotate.d/rails +7 -0
  42. data/server/files/etc/memcached.conf +47 -0
  43. data/server/files/etc/mongrel_cluster/app.yml +9 -0
  44. data/server/files/etc/monit/app.monitrc +71 -0
  45. data/server/files/etc/monit/db_primary.monitrc +10 -0
  46. data/server/files/etc/monit/memcache.monitrc +8 -0
  47. data/server/files/etc/monit/monitrc +13 -0
  48. data/server/files/etc/monit/system.monitrc +15 -0
  49. data/server/files/etc/monit/web.monitrc +10 -0
  50. data/server/files/etc/motd.tail +13 -0
  51. data/server/files/etc/mysql/my.cnf +149 -0
  52. data/server/files/etc/postfix/main.cf +4 -0
  53. data/server/files/etc/rc0.d/K10mongrel +91 -0
  54. data/server/files/etc/rc1.d/K10mongrel +91 -0
  55. data/server/files/etc/rc2.d/S90mongrel +91 -0
  56. data/server/files/etc/rc3.d/S90mongrel +91 -0
  57. data/server/files/etc/rc4.d/S90mongrel +91 -0
  58. data/server/files/etc/rc5.d/S90mongrel +91 -0
  59. data/server/files/etc/rc6.d/K10mongrel +91 -0
  60. data/server/files/etc/rcS.d/S91ec2-first-startup +36 -0
  61. data/server/files/etc/rcS.d/S92ec2-every-startup +29 -0
  62. data/server/files/etc/rcS.d/S99set_roles +3 -0
  63. data/server/files/etc/ssh/sshd_config +94 -0
  64. data/server/files/etc/sudoers +24 -0
  65. data/server/files/etc/syslog.conf +69 -0
  66. data/server/files/usr/local/ec2onrails/COPYING +339 -0
  67. data/server/files/usr/local/ec2onrails/bin/archive_file.rb +44 -0
  68. data/server/files/usr/local/ec2onrails/bin/backup_app_db.rb +83 -0
  69. data/server/files/usr/local/ec2onrails/bin/backup_files.rb +51 -0
  70. data/server/files/usr/local/ec2onrails/bin/mongrel_start +8 -0
  71. data/server/files/usr/local/ec2onrails/bin/mongrel_stop +8 -0
  72. data/server/files/usr/local/ec2onrails/bin/rails_env +35 -0
  73. data/server/files/usr/local/ec2onrails/bin/rebundle.sh +70 -0
  74. data/server/files/usr/local/ec2onrails/bin/restore_app_db.rb +58 -0
  75. data/server/files/usr/local/ec2onrails/bin/restore_files.rb +59 -0
  76. data/server/files/usr/local/ec2onrails/bin/set_rails_env +40 -0
  77. data/server/files/usr/local/ec2onrails/bin/set_roles.rb +156 -0
  78. data/server/files/usr/local/ec2onrails/config +30 -0
  79. data/server/files/usr/local/ec2onrails/lib/mysql_helper.rb +101 -0
  80. data/server/files/usr/local/ec2onrails/lib/s3_helper.rb +126 -0
  81. data/server/files/usr/local/ec2onrails/lib/utils.rb +16 -0
  82. data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/get-hostname.sh +25 -0
  83. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/create-dirs.sh +39 -0
  84. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/generate-default-web-cert-and-key.sh +49 -0
  85. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/misc.sh +30 -0
  86. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/prepare-mysql-data-dir.sh +24 -0
  87. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup_credentials.sh +33 -0
  88. data/server/rakefile.rb +245 -0
  89. data/setup.rb +1585 -0
  90. data/test/autobench.conf +60 -0
  91. data/test/spec/lib/s3_helper_spec.rb +134 -0
  92. data/test/spec/lib/s3_old.yml +3 -0
  93. data/test/spec/test_files/test1 +0 -0
  94. data/test/spec/test_files/test2 +0 -0
  95. data/test/test_app/Capfile +3 -0
  96. data/test/test_app/README +182 -0
  97. data/test/test_app/Rakefile +10 -0
  98. data/test/test_app/app/controllers/application.rb +7 -0
  99. data/test/test_app/app/controllers/db_fast_controller.rb +6 -0
  100. data/test/test_app/app/controllers/fast_controller.rb +5 -0
  101. data/test/test_app/app/controllers/slow_controller.rb +6 -0
  102. data/test/test_app/app/controllers/very_slow_controller.rb +6 -0
  103. data/test/test_app/app/helpers/application_helper.rb +3 -0
  104. data/test/test_app/app/helpers/db_fast_helper.rb +2 -0
  105. data/test/test_app/app/helpers/fast_helper.rb +2 -0
  106. data/test/test_app/app/helpers/slow_helper.rb +2 -0
  107. data/test/test_app/app/helpers/very_slow_helper.rb +2 -0
  108. data/test/test_app/config/boot.rb +109 -0
  109. data/test/test_app/config/database.yml +36 -0
  110. data/test/test_app/config/deploy.rb +21 -0
  111. data/test/test_app/config/environment.rb +60 -0
  112. data/test/test_app/config/environments/development.rb +21 -0
  113. data/test/test_app/config/environments/production.rb +18 -0
  114. data/test/test_app/config/environments/test.rb +19 -0
  115. data/test/test_app/config/routes.rb +27 -0
  116. data/test/test_app/db/schema.rb +7 -0
  117. data/test/test_app/doc/README_FOR_APP +2 -0
  118. data/test/test_app/public/404.html +30 -0
  119. data/test/test_app/public/500.html +30 -0
  120. data/test/test_app/public/dispatch.cgi +10 -0
  121. data/test/test_app/public/dispatch.fcgi +24 -0
  122. data/test/test_app/public/dispatch.rb +10 -0
  123. data/test/test_app/public/favicon.ico +0 -0
  124. data/test/test_app/public/images/rails.png +0 -0
  125. data/test/test_app/public/javascripts/application.js +2 -0
  126. data/test/test_app/public/javascripts/controls.js +963 -0
  127. data/test/test_app/public/javascripts/dragdrop.js +972 -0
  128. data/test/test_app/public/javascripts/effects.js +1120 -0
  129. data/test/test_app/public/javascripts/prototype.js +4225 -0
  130. data/test/test_app/public/robots.txt +1 -0
  131. data/test/test_app/script/about +3 -0
  132. data/test/test_app/script/breakpointer +3 -0
  133. data/test/test_app/script/console +3 -0
  134. data/test/test_app/script/destroy +3 -0
  135. data/test/test_app/script/generate +3 -0
  136. data/test/test_app/script/performance/benchmarker +3 -0
  137. data/test/test_app/script/performance/profiler +3 -0
  138. data/test/test_app/script/performance/request +3 -0
  139. data/test/test_app/script/plugin +3 -0
  140. data/test/test_app/script/process/inspector +3 -0
  141. data/test/test_app/script/process/reaper +3 -0
  142. data/test/test_app/script/process/spawner +3 -0
  143. data/test/test_app/script/runner +3 -0
  144. data/test/test_app/script/server +3 -0
  145. data/test/test_app/test/functional/db_fast_controller_test.rb +18 -0
  146. data/test/test_app/test/functional/fast_controller_test.rb +18 -0
  147. data/test/test_app/test/functional/slow_controller_test.rb +18 -0
  148. data/test/test_app/test/functional/very_slow_controller_test.rb +18 -0
  149. data/test/test_app/test/test_helper.rb +28 -0
  150. metadata +263 -0
@@ -0,0 +1,295 @@
1
+ #
2
+ # Based upon the NCSA server configuration files originally by Rob McCool.
3
+ #
4
+ # This is the main Apache server configuration file. It contains the
5
+ # configuration directives that give the server its instructions.
6
+ # See http://httpd.apache.org/docs/2.2/ for detailed information about
7
+ # the directives.
8
+ #
9
+ # Do NOT simply read the instructions in here without understanding
10
+ # what they do. They're here only as hints or reminders. If you are unsure
11
+ # consult the online docs. You have been warned.
12
+ #
13
+ # The configuration directives are grouped into three basic sections:
14
+ # 1. Directives that control the operation of the Apache server process as a
15
+ # whole (the 'global environment').
16
+ # 2. Directives that define the parameters of the 'main' or 'default' server,
17
+ # which responds to requests that aren't handled by a virtual host.
18
+ # These directives also provide default values for the settings
19
+ # of all virtual hosts.
20
+ # 3. Settings for virtual hosts, which allow Web requests to be sent to
21
+ # different IP addresses or hostnames and have them handled by the
22
+ # same Apache server process.
23
+ #
24
+ # Configuration and logfile names: If the filenames you specify for many
25
+ # of the server's control files begin with "/" (or "drive:/" for Win32), the
26
+ # server will use that explicit path. If the filenames do *not* begin
27
+ # with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.log"
28
+ # with ServerRoot set to "" will be interpreted by the
29
+ # server as "//var/log/apache2/foo.log".
30
+ #
31
+
32
+ ### Section 1: Global Environment
33
+ #
34
+ # The directives in this section affect the overall operation of Apache,
35
+ # such as the number of concurrent requests it can handle or where it
36
+ # can find its configuration files.
37
+ #
38
+
39
+ #
40
+ # ServerRoot: The top of the directory tree under which the server's
41
+ # configuration, error, and log files are kept.
42
+ #
43
+ # NOTE! If you intend to place this on an NFS (or otherwise network)
44
+ # mounted filesystem then please read the LockFile documentation (available
45
+ # at <URL:http://httpd.apache.org/docs-2.1/mod/mpm_common.html#lockfile>);
46
+ # you will save yourself a lot of trouble.
47
+ #
48
+ # Do NOT add a slash at the end of the directory path.
49
+ #
50
+ ServerRoot "/etc/apache2"
51
+
52
+ #
53
+ # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
54
+ #
55
+ #<IfModule !mpm_winnt.c>
56
+ #<IfModule !mpm_netware.c>
57
+ LockFile /var/lock/apache2/accept.lock
58
+ #</IfModule>
59
+ #</IfModule>
60
+
61
+ #
62
+ # PidFile: The file in which the server should record its process
63
+ # identification number when it starts.
64
+ #
65
+ PidFile /var/run/apache2.pid
66
+
67
+ #
68
+ # Timeout: The number of seconds before receives and sends time out.
69
+ #
70
+ Timeout 300
71
+
72
+ #
73
+ # KeepAlive: Whether or not to allow persistent connections (more than
74
+ # one request per connection). Set to "Off" to deactivate.
75
+ #
76
+ KeepAlive On
77
+
78
+ #
79
+ # MaxKeepAliveRequests: The maximum number of requests to allow
80
+ # during a persistent connection. Set to 0 to allow an unlimited amount.
81
+ # We recommend you leave this number high, for maximum performance.
82
+ #
83
+ MaxKeepAliveRequests 100
84
+
85
+ #
86
+ # KeepAliveTimeout: Number of seconds to wait for the next request from the
87
+ # same client on the same connection.
88
+ #
89
+ KeepAliveTimeout 15
90
+
91
+ ##
92
+ ## Server-Pool Size Regulation (MPM specific)
93
+ ##
94
+
95
+ # prefork MPM
96
+ # StartServers: number of server processes to start
97
+ # MinSpareServers: minimum number of server processes which are kept spare
98
+ # MaxSpareServers: maximum number of server processes which are kept spare
99
+ # MaxClients: maximum number of server processes allowed to start
100
+ # MaxRequestsPerChild: maximum number of requests a server process serves
101
+ <IfModule mpm_prefork_module>
102
+ StartServers 5
103
+ MinSpareServers 5
104
+ MaxSpareServers 10
105
+ MaxClients 250
106
+ MaxRequestsPerChild 0
107
+ </IfModule>
108
+
109
+ # worker MPM
110
+ # StartServers: initial number of server processes to start
111
+ # MaxClients: maximum number of simultaneous client connections
112
+ # MinSpareThreads: minimum number of worker threads which are kept spare
113
+ # MaxSpareThreads: maximum number of worker threads which are kept spare
114
+ # ThreadsPerChild: constant number of worker threads in each server process
115
+ # MaxRequestsPerChild: maximum number of requests a server process serves
116
+ <IfModule mpm_worker_module>
117
+ StartServers 2
118
+ MaxClients 150
119
+ MinSpareThreads 25
120
+ MaxSpareThreads 75
121
+ ThreadsPerChild 25
122
+ MaxRequestsPerChild 0
123
+ </IfModule>
124
+
125
+ User www-data
126
+ Group www-data
127
+
128
+ #
129
+ # AccessFileName: The name of the file to look for in each directory
130
+ # for additional configuration directives. See also the AllowOverride
131
+ # directive.
132
+ #
133
+
134
+ AccessFileName .htaccess
135
+
136
+ #
137
+ # The following lines prevent .htaccess and .htpasswd files from being
138
+ # viewed by Web clients.
139
+ #
140
+ <Files ~ "^\.ht">
141
+ Order allow,deny
142
+ Deny from all
143
+ </Files>
144
+
145
+ #
146
+ # DefaultType is the default MIME type the server will use for a document
147
+ # if it cannot otherwise determine one, such as from filename extensions.
148
+ # If your server contains mostly text or HTML documents, "text/plain" is
149
+ # a good value. If most of your content is binary, such as applications
150
+ # or images, you may want to use "application/octet-stream" instead to
151
+ # keep browsers from trying to display binary files as though they are
152
+ # text.
153
+ #
154
+ DefaultType text/plain
155
+
156
+
157
+ #
158
+ # HostnameLookups: Log the names of clients or just their IP addresses
159
+ # e.g., www.apache.org (on) or 204.62.129.132 (off).
160
+ # The default is off because it'd be overall better for the net if people
161
+ # had to knowingly turn this feature on, since enabling it means that
162
+ # each client request will result in AT LEAST one lookup request to the
163
+ # nameserver.
164
+ #
165
+ HostnameLookups Off
166
+
167
+ # ErrorLog: The location of the error log file.
168
+ # If you do not specify an ErrorLog directive within a <VirtualHost>
169
+ # container, error messages relating to that virtual host will be
170
+ # logged here. If you *do* define an error logfile for a <VirtualHost>
171
+ # container, that host's errors will be logged there and not here.
172
+ #
173
+ ErrorLog /mnt/log/apache2/error.log
174
+
175
+ #
176
+ # LogLevel: Control the number of messages logged to the error_log.
177
+ # Possible values include: debug, info, notice, warn, error, crit,
178
+ # alert, emerg.
179
+ #
180
+ LogLevel warn
181
+
182
+ # Include module configuration:
183
+ Include /etc/apache2/mods-enabled/*.load
184
+ Include /etc/apache2/mods-enabled/*.conf
185
+
186
+ # Include all the user configurations:
187
+ Include /etc/apache2/httpd.conf
188
+
189
+ # Include ports listing
190
+ Include /etc/apache2/ports.conf
191
+
192
+ #
193
+ # The following directives define some format nicknames for use with
194
+ # a CustomLog directive (see below).
195
+ #
196
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
197
+ LogFormat "%h %l %u %t \"%r\" %>s %b" common
198
+ LogFormat "%{Referer}i -> %U" referer
199
+ LogFormat "%{User-agent}i" agent
200
+
201
+ #
202
+ # ServerTokens
203
+ # This directive configures what you return as the Server HTTP response
204
+ # Header. The default is 'Full' which sends information about the OS-Type
205
+ # and compiled in modules.
206
+ # Set to one of: Full | OS | Minor | Minimal | Major | Prod
207
+ # where Full conveys the most information, and Prod the least.
208
+ #
209
+ ServerTokens Prod
210
+
211
+ #
212
+ # Optionally add a line containing the server version and virtual host
213
+ # name to server-generated pages (internal error documents, FTP directory
214
+ # listings, mod_status and mod_info output etc., but not CGI generated
215
+ # documents or custom error documents).
216
+ # Set to "EMail" to also include a mailto: link to the ServerAdmin.
217
+ # Set to one of: On | Off | EMail
218
+ #
219
+ ServerSignature Off
220
+
221
+
222
+
223
+ #
224
+ # Customizable error responses come in three flavors:
225
+ # 1) plain text 2) local redirects 3) external redirects
226
+ #
227
+ # Some examples:
228
+ #ErrorDocument 500 "The server made a boo boo."
229
+ #ErrorDocument 404 /missing.html
230
+ #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
231
+ #ErrorDocument 402 http://www.example.com/subscription_info.html
232
+ #
233
+
234
+ #
235
+ # Putting this all together, we can internationalize error responses.
236
+ #
237
+ # We use Alias to redirect any /error/HTTP_<error>.html.var response to
238
+ # our collection of by-error message multi-language collections. We use
239
+ # includes to substitute the appropriate text.
240
+ #
241
+ # You can modify the messages' appearance without changing any of the
242
+ # default HTTP_<error>.html.var files by adding the line:
243
+ #
244
+ # Alias /error/include/ "/your/include/path/"
245
+ #
246
+ # which allows you to create your own set of files by starting with the
247
+ # /usr/share/apache2/error/include/ files and copying them to /your/include/path/,
248
+ # even on a per-VirtualHost basis. The default include files will display
249
+ # your Apache version number and your ServerAdmin email address regardless
250
+ # of the setting of ServerSignature.
251
+ #
252
+ # The internationalized error documents require mod_alias, mod_include
253
+ # and mod_negotiation. To activate them, uncomment the following 30 lines.
254
+
255
+ # Alias /error/ "/usr/share/apache2/error/"
256
+ #
257
+ # <Directory "/usr/share/apache2/error">
258
+ # AllowOverride None
259
+ # Options IncludesNoExec
260
+ # AddOutputFilter Includes html
261
+ # AddHandler type-map var
262
+ # Order allow,deny
263
+ # Allow from all
264
+ # LanguagePriority en cs de es fr it nl sv pt-br ro
265
+ # ForceLanguagePriority Prefer Fallback
266
+ # </Directory>
267
+ #
268
+ # ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
269
+ # ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
270
+ # ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
271
+ # ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
272
+ # ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
273
+ # ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
274
+ # ErrorDocument 410 /error/HTTP_GONE.html.var
275
+ # ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
276
+ # ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
277
+ # ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
278
+ # ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
279
+ # ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
280
+ # ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
281
+ # ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
282
+ # ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
283
+ # ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
284
+ # ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
285
+
286
+
287
+
288
+ # Include of directories ignores editors' and dpkg's backup files,
289
+ # see README.Debian for details.
290
+
291
+ # Include generic snippets of statements
292
+ Include /etc/apache2/conf.d/
293
+
294
+ # Include the virtual host configurations:
295
+ Include /etc/apache2/sites-enabled/
@@ -0,0 +1,7 @@
1
+ # Based on http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/
2
+
3
+ <Proxy balancer://mongrel_cluster>
4
+ Include /etc/ec2onrails/balancer_members
5
+ SetEnv force-proxy-request-1.0 1
6
+ SetEnv proxy-nokeepalive 1
7
+ </Proxy>
@@ -0,0 +1,10 @@
1
+ # Based on http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/
2
+
3
+ Listen 8080
4
+ <VirtualHost *:8080>
5
+ <Location />
6
+ SetHandler balancer-manager
7
+ Deny from all
8
+ Allow from localhost
9
+ </Location>
10
+ </VirtualHost>
@@ -0,0 +1,18 @@
1
+ <IfModule mod_proxy.c>
2
+ #turning ProxyRequests on and allowing proxying from all may allow
3
+ #spammers to use your proxy to send email.
4
+
5
+ ProxyRequests Off
6
+
7
+ <Proxy *>
8
+ AddDefaultCharset off
9
+ Order deny,allow
10
+ Allow from all
11
+ </Proxy>
12
+
13
+ # Enable/disable the handling of HTTP/1.1 "Via:" headers.
14
+ # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
15
+ # Set to one of: Off | On | Full | Block
16
+
17
+ ProxyVia Off
18
+ </IfModule>
@@ -0,0 +1,58 @@
1
+ ServerSignature Off
2
+
3
+ <Directory />
4
+ Options FollowSymLinks
5
+ AllowOverride None
6
+ </Directory>
7
+
8
+ DocumentRoot /mnt/app/current/public
9
+
10
+ <Directory "/mnt/app/current/public">
11
+ Options FollowSymLinks
12
+ AllowOverride None
13
+ Order allow,deny
14
+ Allow from all
15
+ </Directory>
16
+
17
+ # Disallow browsing of Subversion working copy administrative dirs.
18
+ <DirectoryMatch "^/.*/\.svn/">
19
+ Order allow,deny
20
+ Deny from all
21
+ </DirectoryMatch>
22
+
23
+ RewriteEngine On
24
+
25
+ # Uncomment for rewrite debugging
26
+ #RewriteLog /mnt/log/apache2/app_rewrite_log
27
+ #RewriteLogLevel 9
28
+
29
+ # Check for maintenance file and redirect all requests
30
+ RewriteCond %{REQUEST_URI} !\.(png|jpg|jpeg|gif|css)$
31
+ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
32
+ RewriteCond %{SCRIPT_FILENAME} !maintenance.html
33
+ RewriteRule ^.*$ /system/maintenance.html [L]
34
+
35
+ # Rewrite index to check for static
36
+ RewriteRule ^/$ /index.html [QSA]
37
+
38
+ # Rewrite to check for Rails cached page
39
+ RewriteRule ^([^.]+)$ $1.html [QSA]
40
+
41
+ # Redirect all non-static requests to cluster
42
+ RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
43
+ RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
44
+
45
+ # Deflate
46
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript application/x-javascript text/css
47
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
48
+ BrowserMatch ^Mozilla/4.0[678] no-gzip
49
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
50
+ # Make sure proxies don't deliver the wrong content
51
+ Header append Vary User-Agent env=!dont-vary
52
+
53
+ # Uncomment for deflate debugging
54
+ #DeflateFilterNote Input input_info
55
+ #DeflateFilterNote Output output_info
56
+ #DeflateFilterNote Ratio ratio_info
57
+ #LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
58
+ #CustomLog logs/myapp_deflate_log deflate
@@ -0,0 +1,17 @@
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
+ RewriteEngine on
6
+ RewriteCond %{HTTP_HOST} ^3sellers\.com [nc]
7
+ RewriteRule ^(.*)$ http://www.3sellers.com$1 [R=permanent,L]
8
+
9
+ Include /etc/apache2/sites-available/app.custom
10
+ Include /etc/apache2/sites-available/app.common
11
+
12
+ ErrorLog /mnt/log/apache2/error.log
13
+ LogLevel warn
14
+
15
+ CustomLog /mnt/log/apache2/access.log combined
16
+
17
+ </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,5 @@
1
+ #!/bin/sh
2
+
3
+ test -e /mnt/app/current/script/daily || exit 0
4
+ cd /mnt/app/current
5
+ sudo -u app /usr/local/ec2onrails/bin/rails_env script/daily
@@ -0,0 +1,27 @@
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/apache2/*.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/apache && rm $logfile.gz
18
+ fi
19
+ done
20
+
21
+ for f in `ls /mnt/log/mysql/*.log` ; do
22
+ logfile=$f-`date +%Y%m%d`
23
+ if [ -e $logfile ] ; then
24
+ gzip $logfile
25
+ /usr/local/ec2onrails/bin/archive_file.rb --file $logfile.gz --dir logs/mysql && rm $logfile.gz
26
+ fi
27
+ done
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ test -e /mnt/app/current/script/hourly || exit 0
4
+ cd /mnt/app/current
5
+ sudo -u app /usr/local/ec2onrails/bin/rails_env script/hourly
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ test -e /mnt/app/current/script/monthly || exit 0
4
+ cd /mnt/app/current
5
+ sudo -u app /usr/local/ec2onrails/bin/rails_env script/monthly
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ test -e /mnt/app/current/script/weekly || exit 0
4
+ cd /mnt/app/current
5
+ sudo -u app /usr/local/ec2onrails/bin/rails_env script/weekly