capitate 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. data/Capfile +24 -0
  2. data/History.txt +22 -0
  3. data/License.txt +20 -0
  4. data/Manifest.txt +100 -0
  5. data/README.txt +1 -0
  6. data/Rakefile +4 -0
  7. data/bin/capitate +46 -0
  8. data/config/hoe.rb +70 -0
  9. data/config/requirements.rb +17 -0
  10. data/lib/capitate/cap_ext/connections.rb +95 -0
  11. data/lib/capitate/cap_ext/extension_proxy.rb +15 -0
  12. data/lib/capitate/cap_ext/variables.rb +59 -0
  13. data/lib/capitate/config.rb +106 -0
  14. data/lib/capitate/plugins/base.rb +85 -0
  15. data/lib/capitate/plugins/gem.rb +25 -0
  16. data/lib/capitate/plugins/package.rb +30 -0
  17. data/lib/capitate/plugins/profiles.rb +33 -0
  18. data/lib/capitate/plugins/script.rb +118 -0
  19. data/lib/capitate/plugins/templates.rb +98 -0
  20. data/lib/capitate/plugins/wget.rb +23 -0
  21. data/lib/capitate/plugins/yum.rb +87 -0
  22. data/lib/capitate/recipes.rb +9 -0
  23. data/lib/capitate/version.rb +9 -0
  24. data/lib/capitate.rb +32 -0
  25. data/lib/doc/centos/memcached.yml +18 -0
  26. data/lib/doc/centos/mongrel_cluster.yml +11 -0
  27. data/lib/doc/centos/monit.yml +12 -0
  28. data/lib/doc/centos/mysql.yml +6 -0
  29. data/lib/doc/centos/nginx.yml +25 -0
  30. data/lib/doc/centos/sphinx.yml +14 -0
  31. data/lib/doc/gems.yml +7 -0
  32. data/lib/doc/install.yml +11 -0
  33. data/lib/doc/memcached.yml +13 -0
  34. data/lib/doc/mongrel_cluster.yml +12 -0
  35. data/lib/doc/mysql.yml +46 -0
  36. data/lib/doc/nginx.yml +23 -0
  37. data/lib/doc/packages.yml +17 -0
  38. data/lib/doc/rails.yml +15 -0
  39. data/lib/profiles/centos-sick.rb +114 -0
  40. data/lib/recipes/README +5 -0
  41. data/lib/recipes/centos/README +3 -0
  42. data/lib/recipes/centos/centos.rb +44 -0
  43. data/lib/recipes/centos/imagemagick.rb +19 -0
  44. data/lib/recipes/centos/memcached.rb +31 -0
  45. data/lib/recipes/centos/mongrel_cluster.rb +34 -0
  46. data/lib/recipes/centos/monit.rb +42 -0
  47. data/lib/recipes/centos/mysql.rb +25 -0
  48. data/lib/recipes/centos/nginx.rb +45 -0
  49. data/lib/recipes/centos/ruby.rb +37 -0
  50. data/lib/recipes/centos/sphinx.rb +49 -0
  51. data/lib/recipes/deploy.rb +18 -0
  52. data/lib/recipes/gems.rb +11 -0
  53. data/lib/recipes/install.rb +18 -0
  54. data/lib/recipes/memcached.rb +14 -0
  55. data/lib/recipes/mongrel_cluster.rb +33 -0
  56. data/lib/recipes/mysql.rb +33 -0
  57. data/lib/recipes/nginx.rb +40 -0
  58. data/lib/recipes/packages.rb +24 -0
  59. data/lib/recipes/rails.rb +20 -0
  60. data/lib/recipes/sphinx.rb +38 -0
  61. data/lib/templates/capistrano/Capfile +26 -0
  62. data/lib/templates/centos/setup_for_web.sh +17 -0
  63. data/lib/templates/centos/sudoers +95 -0
  64. data/lib/templates/memcached/memcached.initd.centos.erb +70 -0
  65. data/lib/templates/memcached/memcached.monitrc.erb +4 -0
  66. data/lib/templates/mongrel/mongrel_cluster.initd.erb +61 -0
  67. data/lib/templates/mongrel/mongrel_cluster.monitrc.erb +15 -0
  68. data/lib/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  69. data/lib/templates/monit/cert.sh +14 -0
  70. data/lib/templates/monit/monit.cnf +34 -0
  71. data/lib/templates/monit/monit.initd.centos.erb +68 -0
  72. data/lib/templates/monit/monitrc.erb +28 -0
  73. data/lib/templates/monit/patch_inittab.sh +15 -0
  74. data/lib/templates/mysql/install_db.sql.erb +7 -0
  75. data/lib/templates/mysql/mysql.monitrc.erb +6 -0
  76. data/lib/templates/nginx/nginx.conf.erb +88 -0
  77. data/lib/templates/nginx/nginx.initd.erb +62 -0
  78. data/lib/templates/nginx/nginx.monitrc.erb +4 -0
  79. data/lib/templates/nginx/nginx_vhost.conf.erb +95 -0
  80. data/lib/templates/rails/database.yml.erb +42 -0
  81. data/lib/templates/ruby/fix_openssl.sh +12 -0
  82. data/lib/templates/sphinx/sphinx.conf.erb +498 -0
  83. data/lib/templates/sphinx/sphinx.monitrc.erb +4 -0
  84. data/lib/templates/sphinx/sphinx_app.initd.centos.erb +67 -0
  85. data/script/destroy +14 -0
  86. data/script/generate +14 -0
  87. data/script/txt2html +74 -0
  88. data/setup.rb +1585 -0
  89. data/tasks/capitate.rake +10 -0
  90. data/tasks/deployment.rake +34 -0
  91. data/tasks/environment.rake +7 -0
  92. data/tasks/website.rake +17 -0
  93. data/test/test_helper.rb +2 -0
  94. data/test/test_recipes.rb +11 -0
  95. data/test/test_templates.rb +29 -0
  96. data/website/index.html +161 -0
  97. data/website/index.txt +86 -0
  98. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  99. data/website/stylesheets/screen.css +138 -0
  100. data/website/template.rhtml +48 -0
  101. metadata +160 -0
@@ -0,0 +1,62 @@
1
+ #! /bin/sh
2
+ # nginx Startup script for nginx
3
+ #
4
+ # chkconfig: - 86 14
5
+ # description: nginx web server
6
+ #
7
+ # Author: Ryan Norbauer <ryan.norbauer@gmail.com>
8
+ # Modified: Geoffrey Grosenbach http://topfunky.com
9
+ # Modified: Gabriel Handford http://ducktyper.com
10
+
11
+ set -e
12
+
13
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
14
+ DESC="nginx daemon"
15
+ NAME=nginx
16
+ DAEMON=<%= nginx_bin_path %>
17
+ CONFIGFILE=<%= nginx_conf_path %>
18
+ PIDFILE=<%= nginx_pid_path %>
19
+
20
+ # Gracefully exit if the package has been removed.
21
+ test -x $DAEMON || exit 0
22
+
23
+ start() {
24
+ $DAEMON -c $CONFIGFILE || echo -n " already running"
25
+ }
26
+
27
+ stop() {
28
+ kill -QUIT `cat $PIDFILE` || echo -n " not running"
29
+ }
30
+
31
+ reload() {
32
+ kill -HUP `cat $PIDFILE` || echo -n " can't reload"
33
+ }
34
+
35
+ case "$1" in
36
+ start)
37
+ echo -n "Starting $DESC: $NAME"
38
+ start
39
+ ;;
40
+ stop)
41
+ echo -n "Stopping $DESC: $NAME"
42
+ stop
43
+ ;;
44
+ reload)
45
+ echo -n "Reloading $DESC configuration..."
46
+ reload
47
+ echo "reloaded."
48
+ ;;
49
+ restart)
50
+ echo -n "Restarting $DESC: $NAME"
51
+ stop
52
+ # Sleep before start
53
+ sleep 1
54
+ start
55
+ ;;
56
+ *)
57
+ echo "Usage: $0 {start|stop|restart|reload}" >&2
58
+ exit 3
59
+ ;;
60
+ esac
61
+
62
+ exit 0
@@ -0,0 +1,4 @@
1
+ check process nginx with pidfile <%= nginx_pid_path %>
2
+ group www
3
+ start program = "/sbin/service nginx start"
4
+ stop program = "/sbin/service nginx stop"
@@ -0,0 +1,95 @@
1
+ #
2
+ # Nginx virtual host conf
3
+ #
4
+ # * Uses cache directory configured for public/cache
5
+ # * Re-writes url for iphone user agent to /iphone (so as not to conflict with cache)
6
+ # * TODO-gabe: Same for mobile user agents
7
+ # * Redirects domain.com to www.domain.com (IMO should be the other way around; www is deprecated)
8
+ #
9
+
10
+ upstream mongrel-cluster-<%= application %> {
11
+ <% ports.each do |port| %>
12
+ server 127.0.0.1:<%= port %>;
13
+ <% end %>
14
+ }
15
+
16
+ server {
17
+ # port to listen on. Can also be set to an IP:PORT.
18
+ listen 80;
19
+
20
+ # Set the max size for file uploads to 50Mb
21
+ client_max_body_size 50M;
22
+
23
+ # sets the domain[s] that this vhost server requests for
24
+ server_name www.<%= domain_name %>;
25
+
26
+ # doc root
27
+ root <%= public_path %>;
28
+
29
+ # vhost specific access log
30
+ access_log <%= shared_path %>/log/nginx.<%= application %>.access.log main;
31
+
32
+ # this rewrites all the requests to the maintenance.html
33
+ # page if it exists in the doc root. This is for capistrano's
34
+ # disable web task
35
+ if (-f $document_root/system/maintenance.html) {
36
+ rewrite ^(.*)$ /system/maintenance.html last;
37
+ break;
38
+ }
39
+
40
+ location / {
41
+ # Uncomment to allow server side includes so nginx can
42
+ # post-process Rails content
43
+ ## ssi on;
44
+
45
+ proxy_set_header X-Real-IP $remote_addr;
46
+
47
+ # needed for HTTPS
48
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
49
+ proxy_set_header Host $http_host;
50
+ proxy_redirect false;
51
+ proxy_max_temp_file_size 0;
52
+
53
+ # For iphone unique url
54
+ if ($http_user_agent ~* "(iPhone|iPod)") {
55
+ rewrite ^/$ /iphone break;
56
+ proxy_pass http://mongrel-cluster-<%= application %>;
57
+ break;
58
+ }
59
+
60
+ if (-f $request_filename) {
61
+ break;
62
+ }
63
+
64
+ if (-f $document_root/cache/$uri/index.html) {
65
+ rewrite (.*) /cache/$1/index.html break;
66
+ }
67
+
68
+ if (-f $document_root/cache/$uri.html) {
69
+ rewrite (.*) /cache/$1.html break;
70
+ }
71
+
72
+ if (-f $document_root/cache/$uri) {
73
+ rewrite (.*) /cache/$1 break;
74
+ }
75
+
76
+ if (!-f $request_filename) {
77
+ proxy_pass http://mongrel-cluster-<%= application %>;
78
+ break;
79
+ }
80
+ }
81
+
82
+ #error_page 404 /404.html;
83
+
84
+ # redirect server error pages to the static page /50x.html
85
+ #
86
+ error_page 500 502 503 504 /500.html;
87
+ location = /500.html {
88
+ root <%= public_path %>;
89
+ }
90
+ }
91
+
92
+ server {
93
+ server_name <%= domain_name %>;
94
+ rewrite ^/(.*) http://www.<%= domain_name %>/$1 permanent;
95
+ }
@@ -0,0 +1,42 @@
1
+ # MySQL (default setup). Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Install the MySQL driver:
4
+ # gem install mysql
5
+ # On Mac OS X:
6
+ # sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
7
+ # On Mac OS X Leopard:
8
+ # sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
9
+ # This sets the ARCHFLAGS environment variable to your native architecture
10
+ # On Windows:
11
+ # gem install mysql
12
+ # Choose the win32 build.
13
+ # Install MySQL and put its /bin directory on your path.
14
+ #
15
+ # And be sure to use new-style password hashing:
16
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
17
+ development:
18
+ adapter: mysql
19
+ encoding: utf8
20
+ database: <%= db_name %>_development
21
+ username: root
22
+ password:
23
+ socket: /tmp/mysql.sock
24
+
25
+ # Warning: The database defined as 'test' will be erased and
26
+ # re-generated from your development database when you run 'rake'.
27
+ # Do not set this db to the same as development or production.
28
+ test:
29
+ adapter: mysql
30
+ encoding: utf8
31
+ database: <%= db_name %>_test
32
+ username: root
33
+ password:
34
+ socket: /tmp/mysql.sock
35
+
36
+ production:
37
+ adapter: mysql
38
+ encoding: utf8
39
+ database: <%= db_name %>
40
+ username: <%= db_user %>
41
+ password: <%= db_pass %>
42
+ socket: /var/lib/mysql/mysql.sock
@@ -0,0 +1,12 @@
1
+ #! /bin/sh
2
+
3
+ set -e
4
+ trap ERROR ERR
5
+
6
+ # Fix openssl
7
+ cd /usr/src/ruby-1.8.6-p110/ext/openssl
8
+ echo "Fix for ruby openssl..."
9
+ ruby extconf.rb > extconf.log
10
+ make clean > make.log
11
+ make >> make.log
12
+ make install >> make.log