capigen 0.1.1

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 (84) hide show
  1. data/Capfile +22 -0
  2. data/History.txt +3 -0
  3. data/License.txt +20 -0
  4. data/Manifest.txt +83 -0
  5. data/README.txt +35 -0
  6. data/Rakefile +4 -0
  7. data/config/hoe.rb +70 -0
  8. data/config/requirements.rb +17 -0
  9. data/init.rb +3 -0
  10. data/lib/capigen/config.rb +84 -0
  11. data/lib/capigen/helper.rb +51 -0
  12. data/lib/capigen/helpers/gem_helper.rb +15 -0
  13. data/lib/capigen/helpers/package_helper.rb +40 -0
  14. data/lib/capigen/helpers/script_helper.rb +30 -0
  15. data/lib/capigen/helpers/wget_helper.rb +17 -0
  16. data/lib/capigen/packagers/yum.rb +46 -0
  17. data/lib/capigen/profiles.rb +19 -0
  18. data/lib/capigen/recipes.yml +14 -0
  19. data/lib/capigen/templates.rb +65 -0
  20. data/lib/capigen/version.rb +9 -0
  21. data/lib/capigen.rb +26 -0
  22. data/recipes/README +12 -0
  23. data/recipes/bootstrap/patch.rb +87 -0
  24. data/recipes/centos.rb +40 -0
  25. data/recipes/deploy.rb +17 -0
  26. data/recipes/gems.rb +8 -0
  27. data/recipes/imagemagick.rb +9 -0
  28. data/recipes/install.rb +13 -0
  29. data/recipes/memcached.rb +15 -0
  30. data/recipes/mongrel_cluster.rb +49 -0
  31. data/recipes/monit.rb +16 -0
  32. data/recipes/mysql.rb +24 -0
  33. data/recipes/nginx.rb +42 -0
  34. data/recipes/profiles/centos-sick.rb +65 -0
  35. data/recipes/rails.rb +14 -0
  36. data/recipes/ruby.rb +14 -0
  37. data/recipes/sphinx.rb +62 -0
  38. data/script/destroy +14 -0
  39. data/script/generate +14 -0
  40. data/script/txt2html +74 -0
  41. data/setup.rb +1585 -0
  42. data/tasks/capigen.rake +13 -0
  43. data/tasks/deployment.rake +34 -0
  44. data/tasks/environment.rake +7 -0
  45. data/tasks/website.rake +17 -0
  46. data/templates/capistrano/Capfile +22 -0
  47. data/templates/capistrano/deploy.rb.erb +61 -0
  48. data/templates/centos/setup.sh +17 -0
  49. data/templates/centos/sudoers +95 -0
  50. data/templates/imagemagick/install.sh +20 -0
  51. data/templates/memcached/install.sh +27 -0
  52. data/templates/memcached/memcached.initd.centos.erb +70 -0
  53. data/templates/memcached/memcached.monitrc.erb +4 -0
  54. data/templates/mongrel/mongrel_cluster.initd.erb +61 -0
  55. data/templates/mongrel/mongrel_cluster.monitrc.erb +15 -0
  56. data/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  57. data/templates/monit/cert.sh +14 -0
  58. data/templates/monit/install.sh +29 -0
  59. data/templates/monit/monit.cnf +34 -0
  60. data/templates/monit/monit.initd.centos.erb +68 -0
  61. data/templates/monit/monitrc.erb +28 -0
  62. data/templates/monit/patch_inittab.sh +15 -0
  63. data/templates/mysql/install.sh.erb +10 -0
  64. data/templates/mysql/install_db.sql.erb +5 -0
  65. data/templates/mysql/mysql.monitrc.erb +6 -0
  66. data/templates/nginx/install.sh.erb +42 -0
  67. data/templates/nginx/nginx.conf.erb +76 -0
  68. data/templates/nginx/nginx.initd.erb +62 -0
  69. data/templates/nginx/nginx.monitrc.erb +4 -0
  70. data/templates/nginx/nginx_vhost.conf.erb +94 -0
  71. data/templates/rails/database.yml.erb +42 -0
  72. data/templates/ruby/ruby_install.sh +26 -0
  73. data/templates/ruby/rubygems_install.sh +13 -0
  74. data/templates/sphinx/install.sh.erb +22 -0
  75. data/templates/sphinx/sphinx.conf.erb +496 -0
  76. data/templates/sphinx/sphinx.monitrc.erb +4 -0
  77. data/templates/sphinx/sphinx_app.initd.centos.erb +67 -0
  78. data/templates/sphinx/sphinx_app.initd.erb +57 -0
  79. data/website/index.html +93 -0
  80. data/website/index.txt +39 -0
  81. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  82. data/website/stylesheets/screen.css +138 -0
  83. data/website/template.rhtml +48 -0
  84. metadata +141 -0
@@ -0,0 +1,10 @@
1
+ #! /bin/sh
2
+
3
+ set -e
4
+ trap ERROR ERR
5
+
6
+ /sbin/chkconfig --level 345 mysqld on
7
+
8
+ /sbin/service mysqld start
9
+
10
+ /usr/bin/mysqladmin -u root password <%= mysql_admin_password %>
@@ -0,0 +1,5 @@
1
+ <% locations_for_grant.each do |location| %>
2
+ GRANT ALL PRIVILEGES ON <%= db_name %>.* TO '<%= db_user %>'@'<%= location %>' IDENTIFIED BY '<%= db_pass %>';
3
+ <% end %>
4
+
5
+ CREATE DATABASE IF NOT EXISTS <%= db_name %>;
@@ -0,0 +1,6 @@
1
+ check process mysql with pidfile <%= mysql_pid_path %>
2
+ group database
3
+ start program = "/sbin/service mysqld start"
4
+ stop program = "/sbin/service mysqld stop"
5
+ if failed host 127.0.0.1 port <%= db_port %> then restart
6
+ if 5 restarts within 5 cycles then timeout
@@ -0,0 +1,42 @@
1
+ #! /bin/bash
2
+
3
+ set -e
4
+ trap ERROR ERR
5
+
6
+ BIN_PATH=<%= nginx_bin_path %>
7
+ CONF_PATH=<%= nginx_conf_path %>
8
+ PID_PATH=<%= nginx_pid_path %>
9
+ ERROR_LOG_PATH=/var/log/nginx_master_error.log
10
+ LOCK_PATH=/var/lock/nginx
11
+ PREFIX_PATH=<%= nginx_prefix_path %>
12
+
13
+ cd /tmp/nginx
14
+
15
+ wget -nv http://sysoev.ru/nginx/nginx-0.5.35.tar.gz
16
+
17
+ tar zxpf nginx-0.5.35.tar.gz
18
+
19
+ cd nginx-0.5.35
20
+ echo "Configuring nginx..."
21
+ ./configure --sbin-path=$BIN_PATH --conf-path=$CONF_PATH --pid-path=$PID_PATH --error-log-path=$ERROR_LOG_PATH --lock-path=$LOCK_PATH --prefix=$PREFIX_PATH --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 --with-http_ssl_module > configure.log
22
+ echo "Compiling nginx..."
23
+ make > make.log
24
+ echo "Installing nginx"
25
+ make install > make_install.log
26
+
27
+ cd ..
28
+ rm -rf nginx-0.5.35*
29
+
30
+ install -o root /tmp/nginx.initd /etc/init.d/nginx
31
+ rm -f /tmp/nginx.initd
32
+
33
+ /sbin/chkconfig --level 345 nginx on
34
+
35
+ mkdir -p /etc/nginx/vhosts
36
+
37
+ echo "# Blank nginx conf; work-around for nginx conf include issue" > /etc/nginx/vhosts/blank.conf
38
+
39
+ install -o root -m 644 /tmp/nginx.conf $CONF_PATH
40
+ rm -f /tmp/nginx.conf
41
+
42
+ id nginx || /usr/sbin/adduser -r nginx
@@ -0,0 +1,76 @@
1
+ ##
2
+ # See http://brainspl.at/articles/2007/01/03/new-nginx-conf-with-optimizations
3
+ # See http://topfunky.net/svn/shovel/nginx
4
+ #
5
+
6
+ # user and group to run as
7
+ user nginx nginx;
8
+
9
+ # number of nginx workers
10
+ worker_processes 6;
11
+
12
+ # pid of nginx master process
13
+ pid <%= nginx_pid_path %>;
14
+
15
+
16
+ events {
17
+ worker_connections 1024;
18
+ }
19
+
20
+
21
+ http {
22
+ include <%= File.dirname(nginx_conf_path) %>/mime.types;
23
+ default_type application/octet-stream;
24
+
25
+ log_format main '$remote_addr - $remote_user [$time_local] $request '
26
+ '"$status" $body_bytes_sent "$http_referer" '
27
+ '"$http_user_agent" "$http_x_forwarded_for"';
28
+
29
+ # main access log
30
+ access_log /var/log/nginx_access.log main;
31
+
32
+ # main error log
33
+ error_log /var/log/nginx_error.log debug;
34
+
35
+ # no sendfile on OSX
36
+ sendfile on;
37
+
38
+ #keepalive_timeout 0;
39
+ keepalive_timeout 65;
40
+
41
+ # These are good default values.
42
+ tcp_nopush on;
43
+ tcp_nodelay off;
44
+ # output compression saves bandwidth
45
+ gzip on;
46
+ gzip_http_version 1.0;
47
+ gzip_comp_level 2;
48
+ gzip_proxied any;
49
+ gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
50
+
51
+ # Auto include
52
+ include /etc/nginx/vhosts/*.conf;
53
+
54
+ # HTTPS server
55
+ #
56
+ #server {
57
+ # listen 443;
58
+ # server_name localhost;
59
+
60
+ # ssl on;
61
+ # ssl_certificate cert.pem;
62
+ # ssl_certificate_key cert.key;
63
+
64
+ # ssl_session_timeout 5m;
65
+
66
+ # ssl_protocols SSLv2 SSLv3 TLSv1;
67
+ # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
68
+ # ssl_prefer_server_ciphers on;
69
+
70
+ # location / {
71
+ # root html;
72
+ # index index.html index.htm;
73
+ # }
74
+ #}
75
+
76
+ }
@@ -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,94 @@
1
+ #
2
+ # Uses cache directory configured for public/cache
3
+ # Re-writes url for iphone user agent to /iphone (so as not to conflict with cache)
4
+ # TODO-gabe: Same for mobile user agents
5
+ #
6
+ # Redirects domain.com to www.domain.com (IMO should be the other way around; ie. www is deprecated)
7
+ #
8
+
9
+ upstream mongrel-cluster-<%= application %> {
10
+ <% ports.each do |port| %>
11
+ server 127.0.0.1:<%= port %>;
12
+ <% end %>
13
+ }
14
+
15
+ server {
16
+ # port to listen on. Can also be set to an IP:PORT.
17
+ listen 80;
18
+
19
+ # Set the max size for file uploads to 50Mb
20
+ client_max_body_size 50M;
21
+
22
+ # sets the domain[s] that this vhost server requests for
23
+ server_name www.<%= domain_name %>;
24
+
25
+ # doc root
26
+ root <%= public_path %>;
27
+
28
+ # vhost specific access log
29
+ access_log <%= shared_path %>/log/nginx.<%= application %>.access.log main;
30
+
31
+ # this rewrites all the requests to the maintenance.html
32
+ # page if it exists in the doc root. This is for capistrano's
33
+ # disable web task
34
+ if (-f $document_root/system/maintenance.html) {
35
+ rewrite ^(.*)$ /system/maintenance.html last;
36
+ break;
37
+ }
38
+
39
+ location / {
40
+ # Uncomment to allow server side includes so nginx can
41
+ # post-process Rails content
42
+ ## ssi on;
43
+
44
+ proxy_set_header X-Real-IP $remote_addr;
45
+
46
+ # needed for HTTPS
47
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
48
+ proxy_set_header Host $http_host;
49
+ proxy_redirect false;
50
+ proxy_max_temp_file_size 0;
51
+
52
+ # For iphone unique url
53
+ if ($http_user_agent ~* "(iPhone|iPod)") {
54
+ rewrite ^/$ /iphone break;
55
+ proxy_pass http://mongrel-cluster-<%= application %>;
56
+ break;
57
+ }
58
+
59
+ if (-f $request_filename) {
60
+ break;
61
+ }
62
+
63
+ if (-f $document_root/cache/$uri/index.html) {
64
+ rewrite (.*) /cache/$1/index.html break;
65
+ }
66
+
67
+ if (-f $document_root/cache/$uri.html) {
68
+ rewrite (.*) /cache/$1.html break;
69
+ }
70
+
71
+ if (-f $document_root/cache/$uri) {
72
+ rewrite (.*) /cache/$1 break;
73
+ }
74
+
75
+ if (!-f $request_filename) {
76
+ proxy_pass http://mongrel-cluster-<%= application %>;
77
+ break;
78
+ }
79
+ }
80
+
81
+ #error_page 404 /404.html;
82
+
83
+ # redirect server error pages to the static page /50x.html
84
+ #
85
+ error_page 500 502 503 504 /500.html;
86
+ location = /500.html {
87
+ root <%= public_path %>;
88
+ }
89
+ }
90
+
91
+ server {
92
+ server_name <%= domain_name %>;
93
+ rewrite ^/(.*) http://www.<%= domain_name %>/$1 permanent;
94
+ }
@@ -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,26 @@
1
+ #! /bin/sh
2
+
3
+ set -e
4
+ trap ERROR ERR
5
+
6
+ cd /usr/src
7
+ #wget -nv ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p110.tar.gz
8
+ tar xzf ruby-1.8.6-p110.tar.gz
9
+ cd ruby-1.8.6-p110
10
+ echo "Configuring ruby..."
11
+ ./configure --prefix=/usr > configure.log
12
+ echo "Compiling ruby..."
13
+ make > make.log
14
+ echo "Installing ruby..."
15
+ make install > make_install.log
16
+
17
+ # Fix openssl
18
+ cd /usr/src/ruby-1.8.6-p110/ext/openssl
19
+ echo "Fix for ruby openssl..."
20
+ ruby extconf.rb > extconf.log
21
+ make clean > make.log
22
+ make >> make.log
23
+ make install >> make.log
24
+
25
+ cd /usr/src
26
+ rm ruby-1.8.6-p110.tar.gz
@@ -0,0 +1,13 @@
1
+ #! /bin/sh
2
+
3
+ set -e
4
+ trap ERROR ERR
5
+
6
+ cd /tmp
7
+ wget -nv http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz
8
+ tar zxpf rubygems-1.0.1.tgz
9
+ cd rubygems-1.0.1
10
+ echo "Installing rubygems..."
11
+ ruby setup.rb > ruby_setup.log
12
+ cd ..
13
+ rm -rf rubygems*
@@ -0,0 +1,22 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+ trap ERROR ERR
5
+
6
+ cd /tmp
7
+
8
+ wget -nv http://www.sphinxsearch.com/downloads/sphinx-0.9.7.tar.gz
9
+
10
+ tar zxpf sphinx-0.9.7.tar.gz
11
+
12
+ cd sphinx-0.9.7
13
+ echo "Configuring sphinx..."
14
+ ./configure --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql --prefix=<%= sphinx_prefix %> > configure.log
15
+ echo "Compiling sphinx..."
16
+ make > make.log
17
+ echo "Installing sphinx..."
18
+ make install > make_install.log
19
+
20
+ cd ..
21
+ rm -rf sphinx-0.9.7*
22
+