ScholarNexus-ec2onrails 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/CHANGELOG +180 -0
  2. data/COPYING +339 -0
  3. data/Manifest +167 -0
  4. data/README.textile +211 -0
  5. data/Rakefile +37 -0
  6. data/TODO +104 -0
  7. data/ec2onrails.gemspec +42 -0
  8. data/examples/Capfile +3 -0
  9. data/examples/deploy.rb +107 -0
  10. data/examples/s3.yml +9 -0
  11. data/lib/ec2onrails/capistrano_utils.rb +43 -0
  12. data/lib/ec2onrails/recipes/db.rb +359 -0
  13. data/lib/ec2onrails/recipes/deploy.rb +30 -0
  14. data/lib/ec2onrails/recipes/server.rb +489 -0
  15. data/lib/ec2onrails/recipes.rb +141 -0
  16. data/lib/ec2onrails/version.rb +31 -0
  17. data/lib/ec2onrails.rb +20 -0
  18. data/server/build-ec2onrails.sh +44 -0
  19. data/server/files/etc/aliases +5 -0
  20. data/server/files/etc/aliases.db +0 -0
  21. data/server/files/etc/apache2/apache2.conf +295 -0
  22. data/server/files/etc/apache2/conf.d/app.proxy_cluster.conf +7 -0
  23. data/server/files/etc/apache2/conf.d/app.proxy_frontend.conf +10 -0
  24. data/server/files/etc/apache2/mods-available/proxy.conf +18 -0
  25. data/server/files/etc/apache2/sites-available/app.common +61 -0
  26. data/server/files/etc/apache2/sites-available/app.custom +0 -0
  27. data/server/files/etc/apache2/sites-available/default +14 -0
  28. data/server/files/etc/apache2/sites-available/default-ssl +19 -0
  29. data/server/files/etc/cron.d/ec2onrails +21 -0
  30. data/server/files/etc/cron.daily/app +24 -0
  31. data/server/files/etc/cron.daily/logrotate_post +19 -0
  32. data/server/files/etc/cron.hourly/app +24 -0
  33. data/server/files/etc/cron.monthly/app +24 -0
  34. data/server/files/etc/cron.weekly/app +24 -0
  35. data/server/files/etc/denyhosts.conf +628 -0
  36. data/server/files/etc/dpkg/dpkg.cfg +13 -0
  37. data/server/files/etc/ec2onrails/README +32 -0
  38. data/server/files/etc/ec2onrails/balancer_members +6 -0
  39. data/server/files/etc/ec2onrails/roles.yml +5 -0
  40. data/server/files/etc/environment +2 -0
  41. data/server/files/etc/god/app.god +40 -0
  42. data/server/files/etc/god/db.god +17 -0
  43. data/server/files/etc/god/dkim_filter.god +20 -0
  44. data/server/files/etc/god/examples/have_god_daemonize.god +18 -0
  45. data/server/files/etc/god/master.conf +35 -0
  46. data/server/files/etc/god/memcache.god +15 -0
  47. data/server/files/etc/god/notifications.god +14 -0
  48. data/server/files/etc/god/system.god +34 -0
  49. data/server/files/etc/god/web.god +38 -0
  50. data/server/files/etc/init.d/ec2-every-startup +29 -0
  51. data/server/files/etc/init.d/ec2-first-startup +36 -0
  52. data/server/files/etc/init.d/god +42 -0
  53. data/server/files/etc/init.d/nginx +78 -0
  54. data/server/files/etc/init.d/set_roles +3 -0
  55. data/server/files/etc/logrotate.d/apache2 +16 -0
  56. data/server/files/etc/logrotate.d/mongrel +11 -0
  57. data/server/files/etc/logrotate.d/nginx +11 -0
  58. data/server/files/etc/memcached.conf +47 -0
  59. data/server/files/etc/mongrel_cluster/app.yml +9 -0
  60. data/server/files/etc/motd.tail +13 -0
  61. data/server/files/etc/mysql/my.cnf +152 -0
  62. data/server/files/etc/nginx/nginx.conf +305 -0
  63. data/server/files/etc/postfix/main.cf +4 -0
  64. data/server/files/etc/rcS.d/S91ec2-first-startup +1 -0
  65. data/server/files/etc/rcS.d/S92ec2-every-startup +1 -0
  66. data/server/files/etc/rcS.d/S99set_roles +1 -0
  67. data/server/files/etc/ssh/sshd_config +94 -0
  68. data/server/files/etc/sudoers +1 -0
  69. data/server/files/etc/sudoers.full_access +26 -0
  70. data/server/files/etc/sudoers.restricted_access +28 -0
  71. data/server/files/etc/syslog.conf +69 -0
  72. data/server/files/usr/bin/god +26 -0
  73. data/server/files/usr/local/ec2onrails/COPYING +339 -0
  74. data/server/files/usr/local/ec2onrails/bin/archive_file.rb +44 -0
  75. data/server/files/usr/local/ec2onrails/bin/backup_app_db.rb +159 -0
  76. data/server/files/usr/local/ec2onrails/bin/ec2_meta_data.rb +80 -0
  77. data/server/files/usr/local/ec2onrails/bin/exec_runner +76 -0
  78. data/server/files/usr/local/ec2onrails/bin/init_services.rb +71 -0
  79. data/server/files/usr/local/ec2onrails/bin/optimize_mysql.rb +348 -0
  80. data/server/files/usr/local/ec2onrails/bin/rails_env +34 -0
  81. data/server/files/usr/local/ec2onrails/bin/rebundle.sh +70 -0
  82. data/server/files/usr/local/ec2onrails/bin/restore_app_db.rb +58 -0
  83. data/server/files/usr/local/ec2onrails/bin/set_rails_env +40 -0
  84. data/server/files/usr/local/ec2onrails/bin/set_roles.rb +87 -0
  85. data/server/files/usr/local/ec2onrails/bin/setup_web_proxy.rb +113 -0
  86. data/server/files/usr/local/ec2onrails/bin/update_hostname +40 -0
  87. data/server/files/usr/local/ec2onrails/config +30 -0
  88. data/server/files/usr/local/ec2onrails/lib/aws_helper.rb +76 -0
  89. data/server/files/usr/local/ec2onrails/lib/god_helper.rb +129 -0
  90. data/server/files/usr/local/ec2onrails/lib/god_patch.rb +43 -0
  91. data/server/files/usr/local/ec2onrails/lib/mysql_helper.rb +101 -0
  92. data/server/files/usr/local/ec2onrails/lib/roles_helper.rb +151 -0
  93. data/server/files/usr/local/ec2onrails/lib/s3_helper.rb +99 -0
  94. data/server/files/usr/local/ec2onrails/lib/utils.rb +16 -0
  95. data/server/files/usr/local/ec2onrails/lib/vendor/ini.rb +268 -0
  96. data/server/files/usr/local/ec2onrails/startup-scripts/every-startup/get-hostname.sh +23 -0
  97. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/README +5 -0
  98. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/create-dirs.sh +39 -0
  99. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/generate-default-web-cert-and-key.sh +49 -0
  100. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/misc.sh +27 -0
  101. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/prepare-mysql-data-dir.sh +24 -0
  102. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-credentials.sh +29 -0
  103. data/server/files/usr/local/ec2onrails/startup-scripts/first-startup/setup-file-permissions.sh +30 -0
  104. data/server/rakefile.rb +249 -0
  105. data/setup.rb +1585 -0
  106. data/test/autobench.conf +60 -0
  107. data/test/spec/lib/s3_helper_spec.rb +134 -0
  108. data/test/spec/lib/s3_old.yml +3 -0
  109. data/test/spec/test_files/test1 +0 -0
  110. data/test/spec/test_files/test2 +0 -0
  111. data/test/test_app/Capfile +3 -0
  112. data/test/test_app/README +182 -0
  113. data/test/test_app/Rakefile +10 -0
  114. data/test/test_app/app/controllers/application.rb +7 -0
  115. data/test/test_app/app/controllers/db_fast_controller.rb +6 -0
  116. data/test/test_app/app/controllers/fast_controller.rb +5 -0
  117. data/test/test_app/app/controllers/slow_controller.rb +6 -0
  118. data/test/test_app/app/controllers/very_slow_controller.rb +6 -0
  119. data/test/test_app/app/helpers/application_helper.rb +3 -0
  120. data/test/test_app/app/helpers/db_fast_helper.rb +2 -0
  121. data/test/test_app/app/helpers/fast_helper.rb +2 -0
  122. data/test/test_app/app/helpers/slow_helper.rb +2 -0
  123. data/test/test_app/app/helpers/very_slow_helper.rb +2 -0
  124. data/test/test_app/config/boot.rb +109 -0
  125. data/test/test_app/config/database.yml +19 -0
  126. data/test/test_app/config/deploy.rb +21 -0
  127. data/test/test_app/config/environment.rb +60 -0
  128. data/test/test_app/config/environments/development.rb +21 -0
  129. data/test/test_app/config/environments/production.rb +18 -0
  130. data/test/test_app/config/environments/test.rb +19 -0
  131. data/test/test_app/config/routes.rb +27 -0
  132. data/test/test_app/db/schema.rb +7 -0
  133. data/test/test_app/doc/README_FOR_APP +2 -0
  134. data/test/test_app/public/404.html +30 -0
  135. data/test/test_app/public/500.html +30 -0
  136. data/test/test_app/public/dispatch.cgi +10 -0
  137. data/test/test_app/public/dispatch.fcgi +24 -0
  138. data/test/test_app/public/dispatch.rb +10 -0
  139. data/test/test_app/public/favicon.ico +0 -0
  140. data/test/test_app/public/images/rails.png +0 -0
  141. data/test/test_app/public/javascripts/application.js +2 -0
  142. data/test/test_app/public/javascripts/controls.js +963 -0
  143. data/test/test_app/public/javascripts/dragdrop.js +972 -0
  144. data/test/test_app/public/javascripts/effects.js +1120 -0
  145. data/test/test_app/public/javascripts/prototype.js +4225 -0
  146. data/test/test_app/public/robots.txt +1 -0
  147. data/test/test_app/script/about +3 -0
  148. data/test/test_app/script/breakpointer +3 -0
  149. data/test/test_app/script/console +3 -0
  150. data/test/test_app/script/destroy +3 -0
  151. data/test/test_app/script/generate +3 -0
  152. data/test/test_app/script/performance/benchmarker +3 -0
  153. data/test/test_app/script/performance/profiler +3 -0
  154. data/test/test_app/script/performance/request +3 -0
  155. data/test/test_app/script/plugin +3 -0
  156. data/test/test_app/script/process/inspector +3 -0
  157. data/test/test_app/script/process/reaper +3 -0
  158. data/test/test_app/script/process/spawner +3 -0
  159. data/test/test_app/script/runner +3 -0
  160. data/test/test_app/script/server +3 -0
  161. data/test/test_app/test/functional/db_fast_controller_test.rb +18 -0
  162. data/test/test_app/test/functional/fast_controller_test.rb +18 -0
  163. data/test/test_app/test/functional/slow_controller_test.rb +18 -0
  164. data/test/test_app/test/functional/very_slow_controller_test.rb +18 -0
  165. data/test/test_app/test/test_helper.rb +28 -0
  166. data/test/test_ec2onrails.rb +11 -0
  167. data/test/test_helper.rb +2 -0
  168. metadata +277 -0
@@ -0,0 +1,152 @@
1
+ #
2
+ # The MySQL database server configuration file.
3
+ #
4
+ # You can copy this to one of:
5
+ # - "/etc/mysql/my.cnf" to set global options,
6
+ # - "~/.my.cnf" to set user-specific options.
7
+ #
8
+ # One can use all long options that the program supports.
9
+ # Run program with --help to get a list of available options and with
10
+ # --print-defaults to see which it would actually understand and use.
11
+ #
12
+ # For explanations see
13
+ # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
14
+
15
+ # This will be passed to all mysql clients
16
+ # It has been reported that passwords should be enclosed with ticks/quotes
17
+ # escpecially if they contain "#" chars...
18
+ # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
19
+ [client]
20
+ port = 3306
21
+ socket = /var/run/mysqld/mysqld.sock
22
+
23
+ # Here is entries for some specific programs
24
+ # The following values assume you have at least 32M ram
25
+
26
+ # This was formally known as [safe_mysqld]. Both versions are currently parsed.
27
+ [mysqld_safe]
28
+ socket = /var/run/mysqld/mysqld.sock
29
+ nice = 0
30
+
31
+ [mysqld]
32
+ #
33
+ # * Basic Settings
34
+ #
35
+ user = mysql
36
+ pid-file = /var/run/mysqld/mysqld.pid
37
+ socket = /var/run/mysqld/mysqld.sock
38
+ port = 3306
39
+ basedir = /usr
40
+ datadir = /mnt/mysql_data
41
+ tmpdir = /mnt/mysql_data/tmp
42
+ language = /usr/share/mysql/english
43
+ skip-external-locking
44
+ default-storage-engine = InnoDB
45
+ character-set-server = utf8
46
+ collation-server = utf8_general_ci
47
+
48
+ #
49
+ # Instead of skip-networking the default is now to listen only on
50
+ # localhost which is more compatible and is not less secure.
51
+ #bind-address = 127.0.0.1
52
+ #
53
+ # * Fine Tuning
54
+ #
55
+ key_buffer_size = 16M
56
+ max_allowed_packet = 16M
57
+ thread_stack = 128K
58
+ thread_cache_size = 8
59
+ #max_connections = 100
60
+ #table_cache = 64
61
+ #thread_concurrency = 10
62
+ #
63
+ # * Query Cache Configuration
64
+ #
65
+ query_cache_limit = 1M
66
+ query_cache_size = 64M
67
+ #
68
+ # * Logging and Replication
69
+ #
70
+ # Both location gets rotated by the cronjob.
71
+ # Be aware that this log type is a performance killer.
72
+ #log = /var/log/mysql/mysql.log
73
+ #
74
+ # Error logging goes to syslog. This is a Debian improvement :)
75
+ #
76
+ # Here you can see queries with especially long duration
77
+ log_slow_queries = /mnt/log/mysql/mysql-slow.log
78
+ long_query_time = 2
79
+ log-queries-not-using-indexes
80
+ #
81
+ # The following can be used as easy to replay backup logs or for replication.
82
+ #server-id = 1
83
+ log_bin = /mnt/log/mysql/mysql-bin.log
84
+ # WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!
85
+ expire_logs_days = 10
86
+ max_binlog_size = 100M
87
+ #binlog_do_db = include_database_name
88
+ #binlog_ignore_db = include_database_name
89
+ #
90
+ # * BerkeleyDB
91
+ #
92
+ # Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
93
+ skip-bdb
94
+ #
95
+ # * InnoDB
96
+ #
97
+ # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
98
+ # Read the manual for more InnoDB related options. There are many!
99
+ # You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
100
+ #skip-innodb
101
+ innodb_data_file_path=ibdata1:100M:autoextend
102
+ innodb_buffer_pool_size=200M
103
+ innodb_additional_mem_pool_size=20M
104
+ innodb_log_file_size=128M
105
+ innodb_log_buffer_size=8M
106
+ innodb_flush_log_at_trx_commit=1
107
+ innodb_lock_wait_timeout=20
108
+ # innodb_flush_method=O_DIRECT
109
+ innodb_file_per_table
110
+
111
+ #
112
+ # * Security Features
113
+ #
114
+ # Read the manual, too, if you want chroot!
115
+ # chroot = /var/lib/mysql/
116
+ #
117
+ # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
118
+ #
119
+ # ssl-ca=/etc/mysql/cacert.pem
120
+ # ssl-cert=/etc/mysql/server-cert.pem
121
+ # ssl-key=/etc/mysql/server-key.pem
122
+
123
+
124
+
125
+ [mysqldump]
126
+ quick
127
+ quote-names
128
+ max_allowed_packet = 16M
129
+
130
+ [mysql]
131
+ default-character-set = utf8
132
+ #no-auto-rehash # faster start of mysql but no tab completition
133
+
134
+ [isamchk]
135
+ key_buffer = 16M
136
+
137
+ #
138
+ # * NDB Cluster
139
+ #
140
+ # See /usr/share/doc/mysql-server-*/README.Debian for more information.
141
+ #
142
+ # The following configuration is read by the NDB Data Nodes (ndbd processes)
143
+ # not from the NDB Management Nodes (ndb_mgmd processes).
144
+ #
145
+ # [MYSQL_CLUSTER]
146
+ # ndb-connectstring=127.0.0.1
147
+
148
+
149
+ #
150
+ # * IMPORTANT: Additional settings that can override those from this file!
151
+ #
152
+ !includedir /etc/mysql/conf.d/
@@ -0,0 +1,305 @@
1
+ # user and group to run as
2
+ user app app;
3
+
4
+ # number of nginx workers
5
+ worker_processes 6;
6
+
7
+ # pid of nginx master process
8
+ pid /var/run/nginx.pid;
9
+
10
+ # Number of worker connections. 1024 is a good default
11
+ events {
12
+ worker_connections 1024;
13
+ use epoll; # linux only!
14
+ }
15
+
16
+ # start the http module where we config http access.
17
+ http {
18
+ # pull in mime-types. You can break out your config
19
+ # into as many include's as you want to make it cleaner
20
+ include /etc/nginx/mime.types;
21
+
22
+ # set a default type for the rare situation that
23
+ # nothing matches from the mimie-type include
24
+ default_type application/octet-stream;
25
+
26
+ # configure log format
27
+ log_format main '$remote_addr [$time_local] '
28
+ '"$scheme $host $request" $status $body_bytes_sent "$http_referer" '
29
+ '"$http_user_agent" "$http_x_forwarded_for" '
30
+ '($request_time');
31
+
32
+ # main access log
33
+ access_log /mnt/log/nginx/access.log main;
34
+
35
+ # main error log - Do not comment out. If you do not want the log file set this to /dev/null
36
+ # use debug instead of notice if you want additional information
37
+ error_log /mnt/log/nginx/error.log notice;
38
+
39
+ # no sendfile on OSX
40
+ sendfile on;
41
+
42
+ # These are good default values.
43
+ tcp_nopush on;
44
+ tcp_nodelay on;
45
+ # output compression saves bandwidth
46
+ gzip on;
47
+ gzip_http_version 1.0;
48
+ gzip_comp_level 5;
49
+ gzip_proxied any;
50
+ gzip_types text/plain \
51
+ text/html \
52
+ text/css \
53
+ application/x-javascript \
54
+ application/json \
55
+ text/xml \
56
+ application/xml \
57
+ application/xml+rss \
58
+ text/javascript;
59
+
60
+
61
+ # this is where you define your mongrel clusters.
62
+ # you need one of these blocks for each cluster
63
+ # and each one needs its own name to refer to it later.
64
+ include /etc/ec2onrails/nginx_upstream_members;
65
+
66
+
67
+ # the server directive is nginx's virtual host directive.
68
+ server {
69
+ # port to listen on. Can also be set to an IP:PORT
70
+ listen 80;
71
+
72
+ # Set the max size for file uploads to 50Mb
73
+ client_max_body_size 50M;
74
+
75
+ # sets the domain[s] that this vhost server requests for
76
+ # server_name www.[ec2onrails].com [ec2onrails].com;
77
+ server_name _;
78
+
79
+ # uncomment to force a redirect to www
80
+ # if ($host ~* "^[ec2onrails].com$"){
81
+ # rewrite ^(.*)$ http://www.[ec2onrails].com$1 permanent;
82
+ # break;
83
+ # }
84
+
85
+ # uncomment if you want to allow or force some or all pages to go to http:// instead of https://
86
+ # if redirecting all to https, you won't need any of the other directives below the rewrite/break
87
+ # set $sub 'www';
88
+ # if ($host ~* "^(.+?)\.[ec2onrails].com$"){
89
+ # set $sub $1;
90
+ # }
91
+ #
92
+ # if ( $uri ~* "^/.+$") {
93
+ # rewrite ^(.*)$ https://$sub.[ec2onrails].com$1 permanent;
94
+ # break;
95
+ # }
96
+
97
+ # doc root
98
+ root /mnt/app/current/public;
99
+
100
+ # vhost specific access log
101
+ access_log /mnt/log/nginx/vhost.access.log main;
102
+ error_page 400 /400.html;
103
+ error_page 500 502 503 504 /500.html;
104
+ location = /500.html {
105
+ root /mnt/app/current/public;
106
+ }
107
+
108
+ #hide hidden files and folders
109
+ location ~ /\..+ {
110
+ deny all;
111
+ }
112
+
113
+ #do not show the nginx version number in the server header
114
+ server_tokens off;
115
+
116
+ # this allows people to use images and css in their maintenance.html file
117
+ if ($request_filename ~* \.(css|jpg|gif|png)$) {
118
+ break;
119
+ }
120
+
121
+ # this rewrites all the requests to the maintenance.html
122
+ # page if it exists in the doc root. This is for capistrano's
123
+ # disable web task
124
+ if (-f $document_root/system/maintenance.html) {
125
+ rewrite ^(.*)$ /system/maintenance.html last;
126
+ break;
127
+ }
128
+
129
+ # see http://wiki.codemongers.com/NginxHttpStubStatusModule
130
+ # for more information
131
+ location /nginx_status {
132
+ # copied from http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/
133
+ stub_status on;
134
+ access_log off;
135
+ #only allow from localhost
136
+ allow 127.0.0.1;
137
+ deny all;
138
+ }
139
+
140
+ location / {
141
+ # FUTURE TODO...enable this and test the hell out of it
142
+ # if ($request_method = GET) {
143
+ # set $memcached_key $uri;
144
+ # memcached_pass 127.0.0.1:11211;
145
+ # error_page 404 502 = @myapp;
146
+ # break;
147
+ # }
148
+
149
+ index index.html index.htm;
150
+
151
+ # needed to forward user's IP address to rails
152
+ proxy_set_header X-Real-IP $remote_addr;
153
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
154
+ proxy_set_header Host $http_host;
155
+ proxy_redirect false;
156
+ proxy_max_temp_file_size 0;
157
+ proxy_next_upstream error; # do not pass along to another mongrel instance if failed or timed out
158
+ proxy_read_timeout 400; # give plenty of time for long-running rails processing tasks
159
+ #the proxy_connect_timeout cannot be more than 75
160
+ proxy_connect_timeout 70;
161
+
162
+ location ~ ^/(images|javascripts|stylesheets)/ {
163
+ expires 10y;
164
+ }
165
+
166
+ if (-f $request_filename) {
167
+ break;
168
+ }
169
+
170
+ # this is the meat of the rails page caching config
171
+ # it adds .html to the end of the url and then checks
172
+ # the filesystem for that file. If it exists, then we
173
+ # rewite the url to have explicit .html on the end
174
+ # and then send it on its way to the next config rule.
175
+ # if there is no file on the fs then it sets all the
176
+ # necessary headers and proxies to our upstream mongrels
177
+ if (-f $request_filename.html) {
178
+ rewrite (.*) $1.html break;
179
+ }
180
+
181
+ #proxy to mongrel
182
+ if (!-f $request_filename) {
183
+ proxy_pass http://mongrel;
184
+ break;
185
+ }
186
+ }
187
+ }
188
+
189
+ # This server is setup for ssl. Uncomment if
190
+ # you are using ssl as well as port 80.
191
+ # server {
192
+ # # port to listen on. Can also be set to an IP:PORT
193
+ # listen 443;
194
+ #
195
+ # # Set the max size for file uploads to 50Mb
196
+ # client_max_body_size 50M;
197
+ #
198
+ # # sets the domain[s] that this vhost server requests for
199
+ # # server_name www.[ec2onrails].com [ec2onrails].com;
200
+ # server_name _;
201
+ #
202
+ # # uncomment to force a redirect to www
203
+ # # if ($host ~* "^[ec2onrails].com$"){
204
+ # # rewrite ^(.*)$ http://www.[ec2onrails].com$1 permanent;
205
+ # # break;
206
+ # # }
207
+ #
208
+ # ssl on;
209
+ # ssl_certificate /etc/nginx/your_cert.crt;
210
+ # ssl_certificate_key /etc/nginx/your_cert.key;
211
+ #
212
+ # # doc root
213
+ # root /mnt/app/current/public;
214
+ #
215
+ # # vhost specific access log
216
+ # access_log /mnt/log/nginx/vhost.access.log main;
217
+ # error_page 400 /400.html;
218
+ # error_page 500 502 503 504 /500.html;
219
+ # location = /500.html {
220
+ # root /mnt/app/current/public;
221
+ # }
222
+ #
223
+ # # this allows people to use images and css in their maintenance.html file
224
+ # if ($request_filename ~* \.(css|jpg|gif|png)$) {
225
+ # break;
226
+ # }
227
+ #
228
+ # # this rewrites all the requests to the maintenance.html
229
+ # # page if it exists in the doc root. This is for capistrano's
230
+ # # disable web task
231
+ # if (-f $document_root/system/maintenance.html) {
232
+ # rewrite ^(.*)$ /system/maintenance.html last;
233
+ # break;
234
+ # }
235
+ #
236
+ # # see http://wiki.codemongers.com/NginxHttpStubStatusModule
237
+ # # for more information
238
+ # location /nginx_status {
239
+ # # copied from http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/
240
+ # stub_status on;
241
+ # access_log off;
242
+ # #only allow from localhost
243
+ # allow 127.0.0.1;
244
+ # deny all;
245
+ # }
246
+ #
247
+ # location / {
248
+ # # FUTURE TODO...enable this and test the hell out of it
249
+ # # if ($request_method = GET) {
250
+ # # set $memcached_key $uri;
251
+ # # memcached_pass 127.0.0.1:11211;
252
+ # # error_page 404 502 = @myapp;
253
+ # # break;
254
+ # # }
255
+ #
256
+ # index index.html index.htm;
257
+ #
258
+ # # needed to forward user's IP address to rails
259
+ # proxy_set_header X-Real-IP $remote_addr;
260
+ # # needed for HTTPS
261
+ # proxy_set_header X_FORWARDED_PROTO https;
262
+ # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
263
+ # proxy_set_header Host $http_host;
264
+ # proxy_redirect false;
265
+ # proxy_max_temp_file_size 0;
266
+ # proxy_next_upstream error; # do not pass along to another mongrel instance if failed or timed out
267
+ # proxy_read_timeout 400; # give plenty of time for long-running rails processing tasks
268
+ # #the proxy_connect_timeout cannot be more than 75
269
+ # proxy_connect_timeout 70;
270
+ #
271
+ # location ~ ^/(images|javascripts|stylesheets)/ {
272
+ # expires 10y;
273
+ # }
274
+ #
275
+ # if (-f $request_filename) {
276
+ # break;
277
+ # }
278
+ #
279
+ # # this is the meat of the rails page caching config
280
+ # # it adds .html to the end of the url and then checks
281
+ # # the filesystem for that file. If it exists, then we
282
+ # # rewite the url to have explicit .html on the end
283
+ # # and then send it on its way to the next config rule.
284
+ # # if there is no file on the fs then it sets all the
285
+ # # necessary headers and proxies to our upstream mongrels
286
+ # if (-f $request_filename.html) {
287
+ # rewrite (.*) $1.html break;
288
+ # }
289
+ #
290
+ # # ok to have this out here because PDF's should never
291
+ # # be fully paged cache anyway
292
+ # if ($request_filename ~* \.pdf$) {
293
+ # proxy_pass http://mongrel_pdf;
294
+ # break;
295
+ # }
296
+ #
297
+ # if (!-f $request_filename) {
298
+ # proxy_pass http://mongrel;
299
+ # break;
300
+ # }
301
+ # }
302
+ #
303
+ # }
304
+ }
305
+
@@ -0,0 +1,4 @@
1
+ mynetworks_style = host
2
+ relay_domains =
3
+ inet_interfaces = 127.0.0.1
4
+ alias_maps = hash:/etc/aliases
@@ -0,0 +1 @@
1
+ ../init.d/ec2-first-startup
@@ -0,0 +1 @@
1
+ ../init.d/ec2-every-startup
@@ -0,0 +1 @@
1
+ ../init.d/set_roles
@@ -0,0 +1,94 @@
1
+ # Package generated configuration file
2
+ # See the sshd(8) manpage for details
3
+
4
+ # HARDEN OpenSSH TODO's
5
+ # * specify AllowUsers
6
+ # * PermitRootLogin no # turn off root login access
7
+ # to do that, we will probably need to create a non-root user to escalate
8
+ # privileges to from capistrano, like 'admin'
9
+ # * change default port to something other than 22
10
+
11
+ # What ports, IPs and protocols we listen for
12
+ Port 22
13
+ # Use these options to restrict which interfaces/protocols sshd will bind to
14
+ #ListenAddress ::
15
+ #ListenAddress 0.0.0.0
16
+ Protocol 2
17
+ # HostKeys for protocol version 2
18
+ HostKey /etc/ssh/ssh_host_rsa_key
19
+ HostKey /etc/ssh/ssh_host_dsa_key
20
+ #Privilege Separation is turned on for security
21
+ UsePrivilegeSeparation yes
22
+
23
+ # Enable to harden the ssh host
24
+ # AllowUsers admin app
25
+
26
+ # Lifetime and size of ephemeral version 1 server key
27
+ KeyRegenerationInterval 3600
28
+ ServerKeyBits 768
29
+
30
+ # Logging
31
+ SyslogFacility AUTH
32
+ LogLevel INFO
33
+
34
+ # Authentication:
35
+ LoginGraceTime 120
36
+ PermitRootLogin without-password
37
+ UseDNS no
38
+ StrictModes yes
39
+
40
+ RSAAuthentication yes
41
+ PubkeyAuthentication yes
42
+ #AuthorizedKeysFile %h/.ssh/authorized_keys
43
+
44
+ # Don't read the user's ~/.rhosts and ~/.shosts files
45
+ IgnoreRhosts yes
46
+ # For this to work you will also need host keys in /etc/ssh_known_hosts
47
+ RhostsRSAAuthentication no
48
+ # similar for protocol version 2
49
+ HostbasedAuthentication no
50
+ # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
51
+ #IgnoreUserKnownHosts yes
52
+
53
+ # To enable empty passwords, change to yes (NOT RECOMMENDED)
54
+ PermitEmptyPasswords no
55
+
56
+ # Change to yes to enable challenge-response passwords (beware issues with
57
+ # some PAM modules and threads)
58
+ ChallengeResponseAuthentication no
59
+
60
+ # Change to no to disable tunnelled clear text passwords
61
+ PasswordAuthentication no
62
+
63
+ # Kerberos options
64
+ #KerberosAuthentication no
65
+ #KerberosGetAFSToken no
66
+ #KerberosOrLocalPasswd yes
67
+ #KerberosTicketCleanup yes
68
+
69
+ # GSSAPI options
70
+ #GSSAPIAuthentication no
71
+ #GSSAPICleanupCredentials yes
72
+
73
+ X11Forwarding yes
74
+ X11DisplayOffset 10
75
+ PrintMotd no
76
+ PrintLastLog yes
77
+ TCPKeepAlive yes
78
+ #UseLogin no
79
+
80
+ #MaxStartups 10:30:60
81
+ #Banner /etc/issue.net
82
+
83
+ # Allow client to pass locale environment variables
84
+ AcceptEnv LANG LC_*
85
+
86
+ Subsystem sftp /usr/lib/openssh/sftp-server
87
+
88
+ UsePAM yes
89
+
90
+ # PermitUserEnvironment yes
91
+ # AcceptEnv PATH
92
+ # AcceptEnv RUBYLIB
93
+
94
+ GatewayPorts clientspecified
@@ -0,0 +1 @@
1
+ sudoers.full_access
@@ -0,0 +1,26 @@
1
+ # /etc/sudoers
2
+ #
3
+ # This file MUST be edited with the 'visudo' command as root.
4
+ #
5
+ # See the man page for details on how to write a sudoers file.
6
+ # Host alias specification
7
+
8
+ # User alias specification
9
+
10
+ # Cmnd alias specification
11
+
12
+ # Defaults
13
+
14
+ Defaults !lecture,tty_tickets,!fqdn
15
+
16
+ # User privilege specification
17
+ root ALL=(ALL) ALL
18
+
19
+ # The 'app' user can run sudo without a password
20
+ # This is a security hole. Use sudoers.restricted when running in regular mode
21
+ app ALL=(ALL) NOPASSWD: ALL
22
+
23
+
24
+ # If you add named administrator accounts, add them to the group 'sudoers'
25
+ # to give them sudo access
26
+ %sudoers ALL=(ALL) ALL
@@ -0,0 +1,28 @@
1
+ # /etc/sudoers
2
+ #
3
+ # This file MUST be edited with the 'visudo' command as root.
4
+ #
5
+ # See the man page for details on how to write a sudoers file.
6
+ # Host alias specification
7
+
8
+ # User alias specification
9
+
10
+ # Cmnd alias specification
11
+
12
+ # Defaults
13
+
14
+ Defaults !lecture,tty_tickets,!fqdn
15
+
16
+ # User privilege specification
17
+ root ALL=(ALL) ALL
18
+
19
+ # The 'app' user can NOT run sudo without a password, except when running god and a rake task.
20
+ # This is safer, but slightly more of a hassle, than running with sudoers.full_access
21
+ app ALL = NOPASSWD: /usr/bin/god
22
+
23
+ # If you add named administrator accounts, add them to the group 'sudoers'
24
+ # to give them sudo access
25
+ %sudoers ALL=(ALL) ALL
26
+
27
+
28
+
@@ -0,0 +1,69 @@
1
+ # /etc/syslog.conf Configuration file for syslogd.
2
+ #
3
+ # For more information see syslog.conf(5)
4
+ # manpage.
5
+
6
+ #
7
+ # First some standard logfiles. Log by facility.
8
+ #
9
+
10
+ auth,authpriv.* /mnt/log/auth.log
11
+ *.*;auth,authpriv.none -/mnt/log/syslog
12
+ #cron.* /mnt/log/cron.log
13
+ daemon.* -/mnt/log/daemon.log
14
+ kern.* -/mnt/log/kern.log
15
+ lpr.* -/mnt/log/lpr.log
16
+ mail.* -/mnt/log/mail.log
17
+ user.* -/mnt/log/user.log
18
+
19
+ #
20
+ # Logging for the mail system. Split it up so that
21
+ # it is easy to write scripts to parse these files.
22
+ #
23
+ mail.info -/mnt/log/mail.info
24
+ mail.warn -/mnt/log/mail.warn
25
+ mail.err /mnt/log/mail.err
26
+
27
+ # Logging for INN news system
28
+ #
29
+ news.crit /mnt/log/news/news.crit
30
+ news.err /mnt/log/news/news.err
31
+ news.notice -/mnt/log/news/news.notice
32
+
33
+ #
34
+ # Some `catch-all' logfiles.
35
+ #
36
+ *.=debug;\
37
+ auth,authpriv.none;\
38
+ news.none;mail.none -/mnt/log/debug
39
+ *.=info;*.=notice;*.=warn;\
40
+ auth,authpriv.none;\
41
+ cron,daemon.none;\
42
+ mail,news.none -/mnt/log/messages
43
+
44
+ #
45
+ # Emergencies are sent to everybody logged in.
46
+ #
47
+ *.emerg *
48
+
49
+ #
50
+ # I like to have messages displayed on the console, but only on a virtual
51
+ # console I usually leave idle.
52
+ #
53
+ #daemon,mail.*;\
54
+ # news.=crit;news.=err;news.=notice;\
55
+ # *.=debug;*.=info;\
56
+ # *.=notice;*.=warn /dev/tty8
57
+
58
+ # The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
59
+ # you must invoke `xconsole' with the `-file' option:
60
+ #
61
+ # $ xconsole -file /dev/xconsole [...]
62
+ #
63
+ # NOTE: adjust the list below, or you'll go crazy if you have a reasonably
64
+ # busy site..
65
+ #
66
+ daemon.*;mail.*;\
67
+ news.err;\
68
+ *.=debug;*.=info;\
69
+ *.=notice;*.=warn |/dev/xconsole