le1t0-deprec 2.1.6.001

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. data/CHANGELOG +444 -0
  2. data/COPYING +19 -0
  3. data/LICENSE +339 -0
  4. data/README +154 -0
  5. data/THANKS +17 -0
  6. data/bin/depify +139 -0
  7. data/docs/EXAMPLE-installing_tracks.txt +41 -0
  8. data/docs/README.nagios +22 -0
  9. data/docs/README.rails +17 -0
  10. data/docs/config_gen_explained.txt +39 -0
  11. data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
  12. data/docs/deprec-1.x/notes.txt +12 -0
  13. data/docs/old/deprec_banner.gif +0 -0
  14. data/docs/windows_linux.txt +350 -0
  15. data/docs/xen/traffic_monitoring_with_vnstat.txt +95 -0
  16. data/docs/xen/xen-tools-notes.txt +31 -0
  17. data/docs/xen/xen_on_hardy.txt +39 -0
  18. data/lib/deprec.rb +42 -0
  19. data/lib/deprec/capistrano_extensions.rb +446 -0
  20. data/lib/deprec/recipes.rb +7 -0
  21. data/lib/deprec/recipes/aoe.rb +79 -0
  22. data/lib/deprec/recipes/app/mongrel.rb +213 -0
  23. data/lib/deprec/recipes/app/passenger.rb +190 -0
  24. data/lib/deprec/recipes/ar_sendmail.rb +67 -0
  25. data/lib/deprec/recipes/aspell.rb +22 -0
  26. data/lib/deprec/recipes/canonical.rb +68 -0
  27. data/lib/deprec/recipes/cap.rb +39 -0
  28. data/lib/deprec/recipes/chef.rb +68 -0
  29. data/lib/deprec/recipes/collectd.rb +112 -0
  30. data/lib/deprec/recipes/db/couchdb.rb +107 -0
  31. data/lib/deprec/recipes/db/mysql.rb +194 -0
  32. data/lib/deprec/recipes/db/postgresql.rb +104 -0
  33. data/lib/deprec/recipes/db/sqlite.rb +37 -0
  34. data/lib/deprec/recipes/ddclient.rb +51 -0
  35. data/lib/deprec/recipes/deprec.rb +167 -0
  36. data/lib/deprec/recipes/deprecated.rb +71 -0
  37. data/lib/deprec/recipes/drbd.rb +137 -0
  38. data/lib/deprec/recipes/dummy.rb +22 -0
  39. data/lib/deprec/recipes/example.rb +115 -0
  40. data/lib/deprec/recipes/git.rb +97 -0
  41. data/lib/deprec/recipes/gitosis.rb.disabled +55 -0
  42. data/lib/deprec/recipes/glusterfs.rb +176 -0
  43. data/lib/deprec/recipes/god.rb +70 -0
  44. data/lib/deprec/recipes/haproxy.rb +115 -0
  45. data/lib/deprec/recipes/heartbeat.rb +138 -0
  46. data/lib/deprec/recipes/imagemagick/imagemagick_bin.rb +24 -0
  47. data/lib/deprec/recipes/imagemagick/imagemagick_src.rb +39 -0
  48. data/lib/deprec/recipes/integrity.rb +108 -0
  49. data/lib/deprec/recipes/iptables.rb +94 -0
  50. data/lib/deprec/recipes/java.rb +23 -0
  51. data/lib/deprec/recipes/keepalived.rb +78 -0
  52. data/lib/deprec/recipes/ldap.rb +52 -0
  53. data/lib/deprec/recipes/logrotate.rb +56 -0
  54. data/lib/deprec/recipes/lvm.rb +20 -0
  55. data/lib/deprec/recipes/memcache.rb +49 -0
  56. data/lib/deprec/recipes/mongodb.rb +94 -0
  57. data/lib/deprec/recipes/monit.rb +135 -0
  58. data/lib/deprec/recipes/mysql_proxy.rb +67 -0
  59. data/lib/deprec/recipes/nagios.rb +361 -0
  60. data/lib/deprec/recipes/network.rb +116 -0
  61. data/lib/deprec/recipes/ntp.rb +103 -0
  62. data/lib/deprec/recipes/php.rb +58 -0
  63. data/lib/deprec/recipes/postfix.rb +115 -0
  64. data/lib/deprec/recipes/profiles.rb +125 -0
  65. data/lib/deprec/recipes/raid/amcc_3ware.rb +21 -0
  66. data/lib/deprec/recipes/rails.rb +330 -0
  67. data/lib/deprec/recipes/redhat_cluster.rb +228 -0
  68. data/lib/deprec/recipes/redis.rb +90 -0
  69. data/lib/deprec/recipes/ruby/mri.rb +55 -0
  70. data/lib/deprec/recipes/ruby/ree.rb +40 -0
  71. data/lib/deprec/recipes/rvm.rb +32 -0
  72. data/lib/deprec/recipes/s3utils.rb +63 -0
  73. data/lib/deprec/recipes/sphinx/thinking_sphinx.rb +105 -0
  74. data/lib/deprec/recipes/sphinx/ultrasphinx.rb +86 -0
  75. data/lib/deprec/recipes/ssh.rb +147 -0
  76. data/lib/deprec/recipes/ssl.rb +56 -0
  77. data/lib/deprec/recipes/starling.rb +119 -0
  78. data/lib/deprec/recipes/svn.rb +171 -0
  79. data/lib/deprec/recipes/syslog.rb +63 -0
  80. data/lib/deprec/recipes/trac.rb.disabled +277 -0
  81. data/lib/deprec/recipes/tsung.rb +74 -0
  82. data/lib/deprec/recipes/ubuntu.rb +90 -0
  83. data/lib/deprec/recipes/users.rb +90 -0
  84. data/lib/deprec/recipes/utils.rb +58 -0
  85. data/lib/deprec/recipes/vnstat.rb +85 -0
  86. data/lib/deprec/recipes/web/apache.rb +143 -0
  87. data/lib/deprec/recipes/web/nginx.rb +172 -0
  88. data/lib/deprec/recipes/wordpress.rb.notworking +96 -0
  89. data/lib/deprec/recipes/wpmu.rb +103 -0
  90. data/lib/deprec/recipes/xen.rb +364 -0
  91. data/lib/deprec/recipes/xentools.rb +101 -0
  92. data/lib/deprec/recipes_minus_rails.rb +125 -0
  93. data/lib/deprec/templates/aoe/aoe-init +55 -0
  94. data/lib/deprec/templates/aoe/fence_aoemask +351 -0
  95. data/lib/deprec/templates/apache/namevirtualhosts.conf +5 -0
  96. data/lib/deprec/templates/apache/ports.conf.erb +5 -0
  97. data/lib/deprec/templates/apache/status.conf.erb +17 -0
  98. data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
  99. data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
  100. data/lib/deprec/templates/chef/chef.json.erb +1 -0
  101. data/lib/deprec/templates/chef/solo.rb +2 -0
  102. data/lib/deprec/templates/collectd/collectd-init.d +153 -0
  103. data/lib/deprec/templates/collectd/collectd.conf.erb +686 -0
  104. data/lib/deprec/templates/ddclient/ddclient.conf.erb +11 -0
  105. data/lib/deprec/templates/ddclient/ddclient.erb +15 -0
  106. data/lib/deprec/templates/deprec/caprc.erb +14 -0
  107. data/lib/deprec/templates/drbd/drbd.conf.erb +531 -0
  108. data/lib/deprec/templates/glusterfs/glusterfsd-init.erb +95 -0
  109. data/lib/deprec/templates/gnbd_client/cluster.conf.erb +21 -0
  110. data/lib/deprec/templates/gnbd_client/clvm-default.erb +3 -0
  111. data/lib/deprec/templates/gnbd_client/cman-default.erb +6 -0
  112. data/lib/deprec/templates/gnbd_client/gnbdimports.conf.erb +1 -0
  113. data/lib/deprec/templates/gnbd_server/cluster.conf.erb +20 -0
  114. data/lib/deprec/templates/gnbd_server/clvm-default.erb +3 -0
  115. data/lib/deprec/templates/gnbd_server/cman-default.erb +6 -0
  116. data/lib/deprec/templates/gnbd_server/gnbd-server-default.erb +1 -0
  117. data/lib/deprec/templates/gnbd_server/gnbdexports.conf.erb +1 -0
  118. data/lib/deprec/templates/god/god-conf.erb +2 -0
  119. data/lib/deprec/templates/god/god-init.erb +47 -0
  120. data/lib/deprec/templates/haproxy/haproxy-init.d +120 -0
  121. data/lib/deprec/templates/haproxy/haproxy.cfg.erb +31 -0
  122. data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
  123. data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
  124. data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
  125. data/lib/deprec/templates/integrity/apache_vhost.erb +4 -0
  126. data/lib/deprec/templates/integrity/config.ru.erb +21 -0
  127. data/lib/deprec/templates/integrity/config.yml.erb +43 -0
  128. data/lib/deprec/templates/iptables/firewall-default.erb +13 -0
  129. data/lib/deprec/templates/iptables/firewall-init.erb +171 -0
  130. data/lib/deprec/templates/keepalived/keepalived.conf.erb +18 -0
  131. data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
  132. data/lib/deprec/templates/mongodb/mongodb-init.d +88 -0
  133. data/lib/deprec/templates/mongrel/apache_vhost.conf.erb +148 -0
  134. data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
  135. data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
  136. data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  137. data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
  138. data/lib/deprec/templates/mongrel/nginx_vhost.conf.erb +41 -0
  139. data/lib/deprec/templates/monit/monit-init-script +104 -0
  140. data/lib/deprec/templates/monit/monitrc.erb +250 -0
  141. data/lib/deprec/templates/monit/nothing.monitrc +0 -0
  142. data/lib/deprec/templates/mysql/create_databases.sql +20 -0
  143. data/lib/deprec/templates/mysql/database.yml.prod +6 -0
  144. data/lib/deprec/templates/mysql/database.yml.stage +6 -0
  145. data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
  146. data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
  147. data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
  148. data/lib/deprec/templates/mysql_proxy/mysql-proxy-default.erb +4 -0
  149. data/lib/deprec/templates/nagios/README +32 -0
  150. data/lib/deprec/templates/nagios/cgi.cfg.erb +357 -0
  151. data/lib/deprec/templates/nagios/check_linux_free_memory.pl +118 -0
  152. data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -0
  153. data/lib/deprec/templates/nagios/htpasswd.users +1 -0
  154. data/lib/deprec/templates/nagios/mrtg.cfg +180 -0
  155. data/lib/deprec/templates/nagios/nagios.cfg.erb +1325 -0
  156. data/lib/deprec/templates/nagios/nrpe.cfg.erb +222 -0
  157. data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
  158. data/lib/deprec/templates/nagios/objects/commands.cfg.erb +265 -0
  159. data/lib/deprec/templates/nagios/objects/contacts.cfg.erb +89 -0
  160. data/lib/deprec/templates/nagios/objects/hosts.cfg.erb +114 -0
  161. data/lib/deprec/templates/nagios/objects/localhost.cfg.erb +116 -0
  162. data/lib/deprec/templates/nagios/objects/services.cfg.erb +165 -0
  163. data/lib/deprec/templates/nagios/objects/timeperiods.cfg.erb +94 -0
  164. data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
  165. data/lib/deprec/templates/network/hostname.erb +1 -0
  166. data/lib/deprec/templates/network/hosts.erb +2 -0
  167. data/lib/deprec/templates/network/interfaces.erb +18 -0
  168. data/lib/deprec/templates/network/resolv.conf.erb +6 -0
  169. data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
  170. data/lib/deprec/templates/nginx/mime.types.erb +70 -0
  171. data/lib/deprec/templates/nginx/nginx-init-script +62 -0
  172. data/lib/deprec/templates/nginx/nginx.conf.erb +125 -0
  173. data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
  174. data/lib/deprec/templates/nginx/nothing.conf +1 -0
  175. data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
  176. data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
  177. data/lib/deprec/templates/passenger/apache_vhost.erb +29 -0
  178. data/lib/deprec/templates/passenger/logrotate.conf.erb +12 -0
  179. data/lib/deprec/templates/passenger/passenger.conf.erb +21 -0
  180. data/lib/deprec/templates/passenger/passenger.load.erb +3 -0
  181. data/lib/deprec/templates/postfix/aliases.erb +3 -0
  182. data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
  183. data/lib/deprec/templates/postfix/main.cf.erb +36 -0
  184. data/lib/deprec/templates/postfix/master.cf.erb +77 -0
  185. data/lib/deprec/templates/redis/redis-conf.erb +132 -0
  186. data/lib/deprec/templates/redis/redis-init.erb +50 -0
  187. data/lib/deprec/templates/s3utils/s3cfg +35 -0
  188. data/lib/deprec/templates/s3utils/s3config.yml +3 -0
  189. data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
  190. data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
  191. data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
  192. data/lib/deprec/templates/ssl/make-ssl-cert +138 -0
  193. data/lib/deprec/templates/ssl/ssl-cert-snakeoil.key +15 -0
  194. data/lib/deprec/templates/ssl/ssl-cert-snakeoil.pem +19 -0
  195. data/lib/deprec/templates/starling/monit.conf.erb +14 -0
  196. data/lib/deprec/templates/starling/starling-init-script.erb +71 -0
  197. data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
  198. data/lib/deprec/templates/syslog/syslog.conf.erb +71 -0
  199. data/lib/deprec/templates/syslog/syslogd.erb +13 -0
  200. data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
  201. data/lib/deprec/templates/trac/nginx_vhost.conf.erb +26 -0
  202. data/lib/deprec/templates/trac/trac.ini.erb +169 -0
  203. data/lib/deprec/templates/trac/trac_deprec.png +0 -0
  204. data/lib/deprec/templates/trac/tracd-init.erb +43 -0
  205. data/lib/deprec/templates/trac/users.htdigest.erb +0 -0
  206. data/lib/deprec/templates/tsung/tsung.xml.erb +47 -0
  207. data/lib/deprec/templates/vnstat/config.php +57 -0
  208. data/lib/deprec/templates/wordpress/apache2_wordpress_vhost.conf.erb +31 -0
  209. data/lib/deprec/templates/wordpress/wp-config.php.erb +31 -0
  210. data/lib/deprec/templates/wpmu/apache_vhost.conf.erb +13 -0
  211. data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
  212. data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
  213. data/lib/deprec/templates/xen/xend-init.erb +57 -0
  214. data/lib/deprec/templates/xen/xendomains.erb +137 -0
  215. data/lib/deprec/templates/xentools/100-ubuntu-setup +26 -0
  216. data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
  217. data/lib/deprec/templates/xentools/30-disable-gettys +57 -0
  218. data/lib/deprec/templates/xentools/31-ubuntu-setup +32 -0
  219. data/lib/deprec/templates/xentools/40-setup-networking +145 -0
  220. data/lib/deprec/templates/xentools/98-custom +17 -0
  221. data/lib/deprec/templates/xentools/xen-tools.conf.erb +278 -0
  222. data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
  223. data/lib/deprec_cmd_completion.sh +26 -0
  224. data/lib/deprec_minus_rails.rb +12 -0
  225. data/lib/vmbuilder_plugins/all.rb +20 -0
  226. data/lib/vmbuilder_plugins/apt.rb +93 -0
  227. data/lib/vmbuilder_plugins/emerge.rb +76 -0
  228. data/lib/vmbuilder_plugins/gem.rb +100 -0
  229. data/lib/vmbuilder_plugins/std.rb +203 -0
  230. metadata +304 -0
data/THANKS ADDED
@@ -0,0 +1,17 @@
1
+ Big thanks go to the following people. Apologies to any I have missed! - Mike
2
+
3
+ 20080226 Chris Turner for an excellent HOWTO http://crackthenut.cracklabs.com/deprec2-your-slice-from-windows/
4
+ 20080206 Eric Harris-Braun for some great testing, bug reports and suggestions.
5
+ 20071004 Gus Gollings for helping restore www.deprec.org
6
+
7
+ Seen on github http://github.com/mbailey/deprec/network
8
+
9
+ isaac
10
+ jasherai Pritesh (London)
11
+ zippy Eric Harris-Braun (NY) <eric@harris-braun.com> http://eric.harris-braun.com
12
+ kovacs Michael Kovacs (SF) <michael@mkovacs.com> http://javathehutt.blogspot.com
13
+ robc Rob Caporetto (Melbourne) rcaporetto@gmail.com http://www.rob-caporetto.com
14
+
15
+
16
+
17
+
data/bin/depify ADDED
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+
5
+ def unindent(string)
6
+ indentation = string[/\A\s*/]
7
+ string.strip.gsub(/^#{indentation}/, "")
8
+ end
9
+
10
+
11
+ caprc = unindent(<<-FILE)
12
+ # .caprc - Capistrano configs (added by deprec gem [www.deprec.org])
13
+ #
14
+ # Include settings that you want active whenever you use Capistrano
15
+ # You can over ride these for particular projects by putting entries
16
+ # into Capfile or deploy.rb for those projects
17
+ #
18
+ # Uncomment any of the following entries to enable them.
19
+
20
+ # Include deprec - deployment recipes for Capistrano (www.deprec.org)
21
+ #
22
+ # This loads all recipes minus the ones in rails.rb
23
+ # The recipes in rails.rb add 'before' and 'after' tasks to
24
+ # some of the builtin cap deploy tasks which are not appropriate
25
+ # for deploying a project that isn't setup to use deprec.
26
+ #
27
+ require 'deprec_minus_rails'
28
+
29
+ FILE
30
+
31
+ files = {
32
+ "Capfile" => unindent(<<-FILE),
33
+ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
34
+ Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
35
+ Dir['config/*/recipes.rb'].each { |plugin| load(plugin) }
36
+ load 'config/deploy'
37
+ FILE
38
+
39
+ "config/deploy.rb" => unindent(<<-FILE),
40
+ require 'deprec'
41
+
42
+ set :application, "set your application name here"
43
+ set :domain, "set domain name project will be served on here"
44
+ set :repository, "git://github.com/\#{user}/\#{application}.git"
45
+
46
+ # If you aren't using Subversion to manage your source code, specify
47
+ # your SCM below:
48
+ set :scm, :git
49
+
50
+ set :ruby_vm_type, :ree # :ree, :mri
51
+ set :web_server_type, :apache # :apache, :nginx
52
+ set :app_server_type, :passenger # :passenger, :mongrel
53
+ set :db_server_type, :mysql # :mysql, :postgresql, :sqlite
54
+
55
+ # set :packages_for_project, %w(libmagick9-dev imagemagick libfreeimage3) # list of packages to be installed
56
+ # set :gems_for_project, %w(rmagick mini_magick image_science) # list of gems to be installed
57
+
58
+ # Update these if you're not running everything on one host.
59
+ role :app, domain
60
+ role :web, domain
61
+ role :db, domain, :primary => true, :no_release => true
62
+
63
+ # If you aren't deploying to /opt/apps/\#{application} on the target
64
+ # servers (which is the deprec default), you can specify the actual location
65
+ # via the :deploy_to variable:
66
+ # set :deploy_to, "/opt/apps/\#{application}"
67
+
68
+ namespace :deploy do
69
+ task :restart, :roles => :app, :except => { :no_release => true } do
70
+ top.deprec.app.restart
71
+ end
72
+ end
73
+
74
+ FILE
75
+ }
76
+
77
+ def create_file(file, content)
78
+ if !File.exists?(File.dirname(file))
79
+ puts "[add] creating directory `#{File.dirname(file)}'"
80
+ Dir.mkdir(File.dirname(file))
81
+ end
82
+ if File.exists?(file)
83
+ warn "[skip] `#{file}' already exists"
84
+ elsif File.exists?(file.downcase)
85
+ warn "[skip] `#{file.downcase}' exists, which could conflict with `#{file}'"
86
+ else
87
+ puts "[add] writing `#{file}'"
88
+ File.open(file, "w") { |f| f.write(content) }
89
+ end
90
+ end
91
+
92
+
93
+ OptionParser.new do |opts|
94
+ opts.banner = "Usage: #{File.basename($0)} [path]"
95
+
96
+ opts.on("-c", "Install ~/.caprc file") do
97
+ create_file(File.join(ENV['HOME'], '.caprc'), caprc)
98
+ exit 0
99
+ end
100
+
101
+ opts.on("-h", "--help", "Displays this help info") do
102
+ puts opts
103
+ exit 0
104
+ end
105
+
106
+ begin
107
+ opts.parse!(ARGV)
108
+ rescue OptionParser::ParseError => e
109
+ warn e.message
110
+ puts opts
111
+ exit 1
112
+ end
113
+ end
114
+
115
+ if ARGV.empty?
116
+ abort "Please specify the directory to depify, e.g. `#{File.basename($0)} .'"
117
+ elsif !File.exists?(ARGV.first)
118
+ abort "`#{ARGV.first}' does not exist."
119
+ elsif !File.directory?(ARGV.first)
120
+ abort "`#{ARGV.first}' is not a directory."
121
+ elsif ARGV.length > 1
122
+ abort "Too many arguments; please specify only the directory to capify."
123
+ end
124
+
125
+ create_file(File.join(ENV['HOME'], '.caprc'), caprc)
126
+
127
+ base = ARGV.shift
128
+ config_dir = File.join(base,'config')
129
+ if File.directory?(config_dir)
130
+ files.each do |file, content|
131
+ create_file(File.join(base, file), content)
132
+ end
133
+ else
134
+ warn "[warn] directory `#{config_dir}' does not exist"
135
+ warn "[skip] '#{base}/Capfile'"
136
+ warn "[skip] '#{base}/config/deploy.rb'"
137
+ end
138
+
139
+ puts "[done] depified!"
@@ -0,0 +1,41 @@
1
+ #
2
+ # Install tracks locally
3
+ #
4
+ git clone git://github.com/bsag/tracks.git
5
+ cd tracks
6
+
7
+ cp config/database.yml.tmpl config/database.yml
8
+ cp config/site.yml.tmpl config/site.yml
9
+ cp -r log.tmpl log -u
10
+ rake db:create
11
+ rake db:migrate
12
+ ./script/server # Test locally
13
+
14
+
15
+ #
16
+ # Install deprec
17
+ #
18
+ sudo gem install deprec
19
+ cap deprec:users:passwd HOSTS=192.168.0.135 USER=root # Change root password
20
+ cap deprec:users:add HOSTS=192.168.0.135 USER=root # Add personal account
21
+
22
+
23
+ #
24
+ # Create deploy.rb file for tracks
25
+ #
26
+ depify .
27
+ curl -o config/deploy.rb http://mbailey.github.com/deprec/deploy.rb-tracks
28
+ # Edit config/deploy.rb specifying the domain name to serve the app on.
29
+
30
+
31
+ #
32
+ # Install on remote server
33
+ #
34
+
35
+ cap deprec:rails:install_stack
36
+ cap deprec:db:install
37
+ cap deploy:setup
38
+ cap deploy
39
+ cap deploy:migrate
40
+
41
+ # Tracks is now running on your server. Enjoy!
@@ -0,0 +1,22 @@
1
+ deprec: Install and configure Nagios on Ubuntu 7.10 (gutsy), 8.04 (hardy)
2
+ =========================================================================
3
+
4
+ * Quickstart
5
+
6
+ # You need the following item defined in config/deploy.rb (or ~/.caprc)
7
+ role :nagios, 'monitor.blah.com'
8
+
9
+ # Run the following on your workstation
10
+ export HOSTS=nagios.domain.name # replace with desired domain
11
+ cap deprec:apache:install
12
+ cap deprec:nagios:install
13
+ cap deprec:nagios_plugins:install
14
+ cap deprec:nagios:config_gen
15
+ cap deprec:nagios:htpass # create web logins
16
+ cap deprec:nagios:config
17
+ cap deprec:apache:restart
18
+
19
+
20
+ * The detail
21
+
22
+ TBC
data/docs/README.rails ADDED
@@ -0,0 +1,17 @@
1
+ deprec: Install Ruby on Rails app on fresh Ubuntu 7.10 (gutsy), 8.04 (hardy)
2
+ ============================================================================
3
+
4
+ * Quickstart
5
+
6
+ cd your_rails_app
7
+ depify .
8
+ # Edit config/deploy.rb
9
+ cap deprec:rails:install_stack
10
+
11
+ # WARNING! Don't run the following command if you are using a shared
12
+ # database server that has already been installed.
13
+ cap deprec:db:install
14
+
15
+ cap deploy:setup
16
+ cap deploy
17
+ cap deploy:migrate
@@ -0,0 +1,39 @@
1
+ == Configuration
2
+
3
+ deprec2 has a two stage process for generating/deploying configuration files.
4
+ Configuration files for web, app, db servers (and more) are generated from
5
+ templates and put under the config/ tree in your Rails apps source tree.
6
+ Alternatively you could create a non-rails-app tree to hold them. The second
7
+ stage is pushing the files out to the destination servers. This used to be a
8
+ one stage process in deprec1 however the change has been made so that:
9
+
10
+ - all config files for a project can be kept under source control
11
+ - you can make changes to config files that are not available through deprec
12
+
13
+ Many of the settings in these config files are based on values in the projects
14
+ deploy.rb file. Others reflect defaults in deprec that you can override by adding
15
+ fields to deploy.rb. This means you may never need to edit the generated config
16
+ files directly. You can generate a set of config files with the following:
17
+
18
+ cap deprec:nginx:config_gen # generates config files for trac from templates
19
+
20
+ config_gen is re-runnable and will prompt you before overwriting a file. It will
21
+ also show you what changes overwriting would make (in diff format) to help you
22
+ decide whether you want it to do so.
23
+
24
+ Changes to service configuration should never be made on the server. Deprec
25
+ acknowledges this by offering no assistance to people who want to copy config
26
+ files back from servers. But pushing the files out couldn't be simpler!
27
+
28
+ cap deprec:nginx:config # pushes out all config files for nginx
29
+
30
+ deprec2 takes into consideration the fact that that some services are used to
31
+ host more than one application. For example, a webserver will often have one
32
+ main configuration and a number of virtual host configurations. Monit has a
33
+ single config file (/etc/monitrc) but will also load other configs it finds in
34
+ a certain directory (/etc/monit.d).
35
+
36
+ When you deploy a Ruby on Rails app with deprec it drops configs for your project
37
+ into the config/ directory for your project and symlinks them into a shared path
38
+ on the server. This means you can install multiple apps on a remote server and
39
+ they shouldn't stop on each other.
@@ -0,0 +1,50 @@
1
+ #
2
+ # Old notes - YMMV
3
+ #
4
+
5
+ == deprec quickstart (with svn, trac and deployment to apache/mongrel/mysql)
6
+
7
+ Here are instructions that will take a fresh install of Ubuntu Dapper (6.06.1 server), create a working rails app, create an SVN repository and trac installation for it and deploy it using apache, mongrel and mysql.
8
+
9
+ All commands below are run on your local host. You will *never* be requested
10
+ to log into the remote server manually. Capistrano does all the work.
11
+
12
+ - Mike
13
+
14
+ # Install deprec on workstation
15
+ sudo gem install deprec --include-dependencies
16
+ echo 'require "deprec/recipes"' >> ~/.caprc
17
+ echo "ssh_options[:keys] = %w(${HOME}/.ssh/id_dsa)" >> ~/.caprc
18
+ echo 'ssh_options[:paranoid] = false' >> ~/.caprc
19
+ echo 'ssh_options[:forward_agent] = true' >> ~/.caprc
20
+
21
+ # Create rails project on workstation and configure for deprec
22
+ # (alternatively use an existing project)
23
+ rails example
24
+ cd example
25
+ ./script/generate scaffold_resource person name:string age:integer
26
+ deprec --apply-to . --name example --domain www.example.com
27
+
28
+ # NOTE! Use following two commands if you only have 'root' account on server
29
+ # Some VPS services provide you with this when you sign up
30
+ cap change_root_password_as_root # '_as_root' means run this as 'root' user
31
+ cap setup_admin_account_as_root
32
+
33
+ # Copy your ssh keys to remote server to avoid having to type passwords
34
+ cap setup_ssh_keys
35
+
36
+ # Install all required software on remote server
37
+ cap install_rails_stack svn_install trac_install
38
+
39
+ # Import application into subversion respository and setup trac
40
+ cap svn_setup
41
+ cap trac_setup
42
+ cap trac_user_add # this command allows you to create other trac users
43
+ cap trac_start # trac is now available on http://www.example.com:9000/
44
+ cap trac_stop # if you had the need
45
+
46
+ # Deploy application
47
+ cap setup
48
+ cap deploy_with_migrations
49
+ cap apache_restart
50
+ # application is now running on http://www.example.com/people
@@ -0,0 +1,12 @@
1
+ # update timezone on gutsy
2
+ # dpkg-reconfigure tzdata
3
+
4
+
5
+ # Building Edge Capistrano
6
+ You can build an edge gem by cd'ing to that directory and doing:
7
+
8
+ 1. svn info. Find the line that says "Revision:" and mark the revision number.
9
+ 2. rake PKG_BUILD=<rev> gem. Replace <rev> with the revision number.
10
+ 3. Look in the pkg subdirectory. Install that gem file via "gem install pkg/<gem file>"
11
+
12
+ - Jamis
Binary file
@@ -0,0 +1,350 @@
1
+ http://cheat.errtheblog.com/s/deprec2/
2
+
3
+ This is a copy of Chris Turners deprec2 howto (found here
4
+ http://crackthenut.cracklabs.com/deprec2-your-slice/). I'm adding it here
5
+ because his site is down at the moment and I almost cried myself to sleep at the
6
+ thought of losing it (thank you google cache)
7
+
8
+ ------------------------------
9
+
10
+ This is a summary of how we build our servers and deploy our Rails apps from
11
+ Ubuntu with the the current pre-release version of deprec2 + capistrano2.
12
+
13
+ We use Slicehost to host our Rails apps (highly recommended) and we use deprec +
14
+ capistrano to build our slices and deploy our apps. Mike Bailey has been hard at
15
+ work on deprec2, which builds on capistrano2 by Jamis Buck. Thank you to Mike
16
+ and Jamis for making these great tools that make life easier.
17
+
18
+ The machine I was deploying from here (my “development” machine) is an
19
+ Ubuntu Dapper slice with Ruby 1.8.6 and rubygems 1.0.1.
20
+
21
+ The target machine here was a Slicehost slice with Ubuntu Gutsy.
22
+
23
+ This will build the slice with Ruby 1.8.6 and latest rails (2.0.2 as of this
24
+ writing) For serving up your app it installs mongrel+nginx (not apache - though
25
+ it can easily be modified to use it)
26
+
27
+ We use another remote machine to hold our source repositories and access those
28
+ via the svn+ssh protocol. That is reflected in these instructions.
29
+
30
+ Step 1 gets your development machine set up properly and is a one-time deal. You
31
+ won’t have to repeat it for each new slice you build/deploy to.
32
+
33
+ Step 2 installs everything you’ll need on your slice and deploys your app
34
+
35
+ I wanted to get this posted sooner rather than later - it may be a bit terse -
36
+ let me know if anything is confusing or inaccurate. I’ll TRY to keep these
37
+ instruction updated as deprec2 moves into full release and other things change.
38
+ Step 1 - Set Up The Machine You Are Deploying From (running Ubuntu in this case)
39
+
40
+ This will make sure your development machine is set up the right way so that
41
+ building your slice goes smoothly. You won’t have to repeat this when you
42
+ build/deploy to future slices.
43
+ 1.1. Download the pre-release deprec2 gem
44
+
45
+ Deprec 2.0 isn’t quite released yet, but there is a pre-release gem available.
46
+ As of this writing it is at version 1.99-13. You can find it at deprec.org.
47
+
48
+ The URL is almost guaranteed to change, but I’ve been grabbing the gem by:
49
+
50
+ wget
51
+ http://www.deprec.org/attachment/wiki/WikiStart/deprec-1.99.13.gem?format=raw -O
52
+ deprec-1.99.13.gem
53
+
54
+ 1.2. Install Deprec
55
+
56
+ sudo gem install deprec-1.99.13.gem
57
+
58
+ Make sure you run this command from the same directory where you downloaded the
59
+ deprec gem to.
60
+ This will also install the latest version of capistrano, should you not already
61
+ have it.
62
+ 1.3. Install fastthread
63
+
64
+ sudo gem install fastthread
65
+
66
+ Fastthread is necessary if you are using Ruby 1.8.6 to avoid possible deadlocks
67
+ when using capistrano (or so I hear)
68
+ 1.4. Generate keys
69
+
70
+ ssh-keygen -t rsa
71
+
72
+ Accept the default name/location.
73
+
74
+ Enter a passphrase if you wish.
75
+
76
+ On my machine this creates my keys in /home/username/.ssh
77
+ 1.5. Setup a directory we can use for holding slice config files
78
+
79
+ This directory is not specific to any one rails project and once we set it up we
80
+ can use
81
+ it in the future to do some of the initial setup for other slices we may build.
82
+
83
+ From within /home/username:
84
+
85
+ mkdir -p config_slices/config
86
+
87
+ 1.6. Create some files for Deprec/Capistrano
88
+
89
+ Change to your config_slices directory and:
90
+
91
+ depify .
92
+
93
+ This creates:
94
+ ~/.caprc
95
+ ~/config_slices/Capfile
96
+ ~/config_slices/config/deploy.rb
97
+
98
+ 1.7. Edit your .caprc
99
+
100
+ Open up ~/.caprc with a text editor
101
+
102
+ Uncomment and update this line to point at the appropriate directory
103
+
104
+ ssh_options[:keys] = %w(/path/to/your_home_dir/.ssh/id_rsa)
105
+
106
+ like this on my machine:
107
+
108
+ ssh_options[:keys] = %w(/home/username/.ssh/id_rsa)
109
+
110
+ and uncomment these lines:
111
+
112
+ ssh_options[:forward_agent] = ...
113
+ ssh_options[:paranoid] = ...
114
+
115
+ 1.8. Generate some config files locally that will be pushed out to your slice in
116
+ a future step
117
+
118
+ Make sure you are still in config_slices directory
119
+
120
+ cap deprec:ssh:config_gen
121
+
122
+ This step generates configuration files which will be used to configure the ssh
123
+ client and server on the slice.
124
+ It also makes a directory to hold public keys for you and other users so deprec
125
+ can find your keys and copy those out to the slice for you.
126
+ 1.9. (optional) Make some changes to the sshd_config before you send it to the
127
+ slice
128
+
129
+ This step changes a couple settings in the the file that will be used to
130
+ configure the slice’s ssh server.
131
+ It will be more secure if you don’t make either of these changes, but there is
132
+ a chance you might find them to be useful.
133
+
134
+ Edit ~/config_slices/config/ssh/etc/ssh/sshd_config
135
+
136
+ If you still want to be able to ssh into your slice with a password (not only
137
+ keys), change the line from
138
+
139
+ PasswordAuthentication no
140
+
141
+ to
142
+
143
+ PasswordAuthentication yes
144
+
145
+ If you still want to be able to ssh into your slice as root, change the line
146
+ from
147
+
148
+ PermitRootLogin no
149
+
150
+ to
151
+
152
+ PermitRootLogin yes
153
+
154
+ 1.10. Make some changes to the ssh_config before you send it to the slice
155
+
156
+ This step changes a couple settings in the the file that will be used to
157
+ configure the slice’s ssh client.
158
+ This prevents the slice from getting a host key error when it uses ssh to check
159
+ out your code from the svn repo.
160
+
161
+ Edit ~/config_slices/config/ssh/etc/ssh/ssh_config
162
+
163
+ Change:
164
+
165
+ #StrictHostKeyChecking ask
166
+
167
+ to
168
+
169
+ StrictHostKeyChecking no
170
+
171
+ 1.11. Copy your public key to a place where deprec can find it
172
+
173
+ cp ~/.ssh/id_rsa.pub ~/config_slices/config/ssh/authorized_keys/deploy_user
174
+
175
+ Note: this copies and renames the file from id_rsa.pub to deploy_user
176
+
177
+ You can put whatever you want for deploy_user - this will be the username we
178
+ create on the slice later. I just use my last name. deprec makes it easy to
179
+ add/manage additional users on the slice in the future - no need to have a
180
+ single, dedicated “deploy” user.
181
+ 1.12. Copy your public key out to your svn machine
182
+
183
+ PUT SOMETHING HERE
184
+
185
+ Step 2 - Set up your slice and deploy your app
186
+
187
+ Now that our development machine is set up we can move on to dealing with our
188
+ slice.
189
+ 2.1. Create a new slice or rebuild one from SliceManager
190
+
191
+ Note your slice’s IP address and new root password.
192
+ 2.2. Change the root password on the slice
193
+
194
+ From within config_slices directory:
195
+
196
+ cap deprec:users:passwd USER=root HOSTS=your.slice.ip.address
197
+
198
+ 1. You will be prompted for which user to change the password for - default
199
+ is root, which is what we want - so just hit enter
200
+ 2. You will be prompted for root’s new password - type one in
201
+ 3. You will be prompted for the slice’s current root password - enter the
202
+ password slicehost emailed you
203
+
204
+ Your slice’s root password has been changed.
205
+ 2.3. Create a new user on the slice to do your deployment with
206
+
207
+ From within config_slices directory:
208
+
209
+ cap deprec:users:add USER=root HOSTS=your.slice.ip.address
210
+
211
+ 1. You will be prompted for a new username - enter whatever you used for
212
+ deploy_user in step 1.11
213
+ 2. You will be asked if this should be an admin account -> enter yes
214
+ 3. It should tell you it has found the key you copied above (if not you named
215
+ the key wrong or did not copy it to the correct place in 1.11) and ask if you
216
+ want to copy it out to the slice - default is yes - so hit enter
217
+ 4. You will be prompted for a new password for deploy_user -> enter one
218
+ 5. You will be prompted for a password - enter your slice’s new root
219
+ password from previous step
220
+
221
+ Your deploy_user has now been created on the slice and that users public key has
222
+ been copied over.
223
+ 2.4. (optional) Make sure your keys work and some stuff about ssh-agent
224
+
225
+ At this point your user has been created on the slice and you should be able to
226
+ ssh into the
227
+ slice from your development machine.
228
+
229
+ If you want to make sure your keys are working properly:
230
+
231
+ PLACEHOLDER:
232
+
233
+ -test ssh into your slice with no password
234
+
235
+ -instruction for running ssh-agent to eliminate passphrases and make sure key
236
+ can get forwarded to svn if applicable
237
+
238
+ -also test you can also ssh into your svn (if you use svn+ssh) - if not then add
239
+ public key to authorized_keys on svn machine
240
+ 2.5. Copy the ssh/sshd configs over to the slice
241
+
242
+ From within config_slices directory:
243
+
244
+ cap deprec:ssh:config USER=deploy_user HOSTS=my.slice.ip.address
245
+
246
+ This configures the ssh client and server on the slice according to the config
247
+ files we generated/edited in Step 1.
248
+ 2.6. Setup your deploy.rb
249
+
250
+ cd my_rails_project
251
+ depify .
252
+
253
+ Edit my_rails_project/config/deploy.rb:
254
+
255
+ If you do not keep database.yml under source control add this line at the top
256
+ (after require ‘deprec’):
257
+
258
+ set :database_yml_in_scm, false
259
+
260
+ This will make sure that database.yml is symlinked from the shared/config dir
261
+ (we’ll create that file later)
262
+ If you keep database.yml in source control you should not put this line in.
263
+
264
+ Now change the following lines to match your specifics:
265
+
266
+ set :user, "deploy_user"
267
+ set :application, "my_rails_project"
268
+ set :repository,
269
+ "svn+ssh://my_svn_useruser@my_svn/path_to/my_rails_project/trunk" #or whatever
270
+ set :domain, "my.slice.ip.address" #or domain name if you have that setup
271
+ role :app, domain
272
+ role :web, domain
273
+ role :db, domain, :primary => true
274
+
275
+ 2.7. Install ruby/rails/mysql/mongrel/nginx and everything else you need on the
276
+ slice
277
+
278
+ From within my_rails_project directory:
279
+
280
+ cap deprec:rails:install_rails_stack
281
+
282
+ And you thought that would be hard…
283
+ This step saves you a LOT of work (thank you Mike Bailey)
284
+ It takes a little while, ~10 min when I ran it.
285
+ 2.8. Run the initial deploy to get things configured
286
+
287
+ From within my_rails_project directory:
288
+
289
+ cap deploy:setup
290
+ cap deploy
291
+
292
+ This sets up your application on the slice and does an initial check out from
293
+ your svn.
294
+ 2.9. Create database.yml on the slice if you don’t keep it in source control
295
+
296
+ Skip this step if database.yml is under source control.
297
+
298
+ Add the following to my_rails_project/config/deploy.rb inside the
299
+ namespace:deploy block
300
+
301
+ db_params = {
302
+ "adapter"=>"mysql",
303
+ "database"=>"#{application}_#{rails_env}",
304
+ "username"=>"root",
305
+ "password"=>"",
306
+ "host"=>"localhost",
307
+ "socket"=>""
308
+ }
309
+
310
+ db_params.each do |param, default_val|
311
+ set "db_#{param}".to_sym,
312
+ lambda { Capistrano::CLI.ui.ask "Enter database #{param}" do |q|
313
+ q.default=default_val end}
314
+ end
315
+
316
+ task :my_generate_database_yml, :roles => :app do
317
+ database_configuration = "#{rails_env}:\n"
318
+ db_params.each do |param, default_val|
319
+ val=self.send("db_#{param}")
320
+ database_configuration<<" #{param}: #{val}\n"
321
+ end
322
+ run "mkdir -p #{deploy_to}/#{shared_dir}/config"
323
+ put database_configuration, "#{deploy_to}/#{shared_dir}/config/database.yml"
324
+ end
325
+
326
+ Now run this task to create database.yml
327
+
328
+ cap deploy:my_generate_database_yml
329
+
330
+ Follow the prompts - this makes database.yml - the defaults are likely ok (just
331
+ hit enter) at all of the prompts.
332
+
333
+ 2.10. Create the database and apply migrations
334
+
335
+ Still from within my_rails_project directory:
336
+
337
+ cap deprec:db:create
338
+ cap deprec:db:migrate
339
+
340
+ This creates your database and applies your migrations.
341
+
342
+ 2.11. Restart mongrel+nginx
343
+
344
+ Still from within my_rails_project directory:
345
+
346
+ cap deprec:mongrel:restart
347
+ cap deprec:nginx:restart
348
+
349
+ Now you should be able to point your browser at your slice and see your app
350
+ running. Congrats!