visfleet-deprec 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. data/CHANGELOG +398 -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 +8 -0
  19. data/lib/deprec/capistrano_extensions.rb +438 -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 +270 -0
  24. data/lib/deprec/recipes/ar_sendmail.rb +67 -0
  25. data/lib/deprec/recipes/canonical.rb +68 -0
  26. data/lib/deprec/recipes/chef.rb +68 -0
  27. data/lib/deprec/recipes/collectd.rb +112 -0
  28. data/lib/deprec/recipes/db/couchdb.rb +107 -0
  29. data/lib/deprec/recipes/db/mysql.rb +139 -0
  30. data/lib/deprec/recipes/db/postgresql.rb +104 -0
  31. data/lib/deprec/recipes/db/sqlite.rb +37 -0
  32. data/lib/deprec/recipes/ddclient.rb +51 -0
  33. data/lib/deprec/recipes/deprec.rb +199 -0
  34. data/lib/deprec/recipes/deprecated.rb +71 -0
  35. data/lib/deprec/recipes/example.rb +115 -0
  36. data/lib/deprec/recipes/git.rb +97 -0
  37. data/lib/deprec/recipes/gitosis.rb +55 -0
  38. data/lib/deprec/recipes/haproxy.rb +106 -0
  39. data/lib/deprec/recipes/heartbeat.rb +138 -0
  40. data/lib/deprec/recipes/integrity.rb +108 -0
  41. data/lib/deprec/recipes/logrotate.rb +54 -0
  42. data/lib/deprec/recipes/lvm.rb +20 -0
  43. data/lib/deprec/recipes/memcache.rb +49 -0
  44. data/lib/deprec/recipes/monit.rb +143 -0
  45. data/lib/deprec/recipes/nagios.rb +330 -0
  46. data/lib/deprec/recipes/network.rb +93 -0
  47. data/lib/deprec/recipes/ntp.rb +103 -0
  48. data/lib/deprec/recipes/php.rb +58 -0
  49. data/lib/deprec/recipes/postfix.rb +115 -0
  50. data/lib/deprec/recipes/rails.rb +337 -0
  51. data/lib/deprec/recipes/ruby/mri.rb +55 -0
  52. data/lib/deprec/recipes/ruby/ree.rb +40 -0
  53. data/lib/deprec/recipes/sphinx.rb +86 -0
  54. data/lib/deprec/recipes/ssh.rb +111 -0
  55. data/lib/deprec/recipes/ssl.rb +56 -0
  56. data/lib/deprec/recipes/starling.rb +119 -0
  57. data/lib/deprec/recipes/svn.rb +171 -0
  58. data/lib/deprec/recipes/syslog.rb +63 -0
  59. data/lib/deprec/recipes/trac.rb +277 -0
  60. data/lib/deprec/recipes/ubuntu.rb +35 -0
  61. data/lib/deprec/recipes/users.rb +90 -0
  62. data/lib/deprec/recipes/utils.rb +58 -0
  63. data/lib/deprec/recipes/vnstat.rb +85 -0
  64. data/lib/deprec/recipes/web/apache.rb +143 -0
  65. data/lib/deprec/recipes/web/nginx.rb +172 -0
  66. data/lib/deprec/recipes/wordpress.rb +96 -0
  67. data/lib/deprec/recipes/wpmu.rb +103 -0
  68. data/lib/deprec/recipes/xen.rb +278 -0
  69. data/lib/deprec/recipes/xentools.rb +75 -0
  70. data/lib/deprec/recipes_minus_rails.rb +61 -0
  71. data/lib/deprec/templates/aoe/aoe-init +55 -0
  72. data/lib/deprec/templates/aoe/fence_aoemask +351 -0
  73. data/lib/deprec/templates/apache/namevirtualhosts.conf +5 -0
  74. data/lib/deprec/templates/apache/ports.conf.erb +5 -0
  75. data/lib/deprec/templates/apache/status.conf.erb +17 -0
  76. data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
  77. data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
  78. data/lib/deprec/templates/chef/chef.json.erb +1 -0
  79. data/lib/deprec/templates/chef/solo.rb +2 -0
  80. data/lib/deprec/templates/collectd/collectd-init.d +153 -0
  81. data/lib/deprec/templates/collectd/collectd.conf.erb +686 -0
  82. data/lib/deprec/templates/ddclient/ddclient.conf.erb +11 -0
  83. data/lib/deprec/templates/ddclient/ddclient.erb +15 -0
  84. data/lib/deprec/templates/deprec/caprc.erb +14 -0
  85. data/lib/deprec/templates/haproxy/haproxy-init.d +120 -0
  86. data/lib/deprec/templates/haproxy/haproxy.cfg.erb +42 -0
  87. data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
  88. data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
  89. data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
  90. data/lib/deprec/templates/integrity/apache_vhost.erb +4 -0
  91. data/lib/deprec/templates/integrity/config.ru.erb +21 -0
  92. data/lib/deprec/templates/integrity/config.yml.erb +43 -0
  93. data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
  94. data/lib/deprec/templates/mongrel/apache_vhost.conf.erb +148 -0
  95. data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
  96. data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
  97. data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  98. data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
  99. data/lib/deprec/templates/mongrel/nginx_vhost.conf.erb +41 -0
  100. data/lib/deprec/templates/monit/monit-init-script +104 -0
  101. data/lib/deprec/templates/monit/monitrc.erb +227 -0
  102. data/lib/deprec/templates/monit/nothing +0 -0
  103. data/lib/deprec/templates/mysql/create_databases.sql +20 -0
  104. data/lib/deprec/templates/mysql/database.yml.prod +6 -0
  105. data/lib/deprec/templates/mysql/database.yml.stage +6 -0
  106. data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
  107. data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
  108. data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
  109. data/lib/deprec/templates/nagios/README +32 -0
  110. data/lib/deprec/templates/nagios/cgi.cfg.erb +357 -0
  111. data/lib/deprec/templates/nagios/check_linux_free_memory.pl +118 -0
  112. data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -0
  113. data/lib/deprec/templates/nagios/htpasswd.users +1 -0
  114. data/lib/deprec/templates/nagios/mrtg.cfg +180 -0
  115. data/lib/deprec/templates/nagios/nagios.cfg.erb +1325 -0
  116. data/lib/deprec/templates/nagios/nrpe.cfg.erb +222 -0
  117. data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
  118. data/lib/deprec/templates/nagios/objects/commands.cfg.erb +265 -0
  119. data/lib/deprec/templates/nagios/objects/contacts.cfg.erb +89 -0
  120. data/lib/deprec/templates/nagios/objects/hosts.cfg.erb +114 -0
  121. data/lib/deprec/templates/nagios/objects/localhost.cfg.erb +116 -0
  122. data/lib/deprec/templates/nagios/objects/services.cfg.erb +165 -0
  123. data/lib/deprec/templates/nagios/objects/timeperiods.cfg.erb +94 -0
  124. data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
  125. data/lib/deprec/templates/network/hostname.erb +1 -0
  126. data/lib/deprec/templates/network/hosts.erb +2 -0
  127. data/lib/deprec/templates/network/interfaces.erb +18 -0
  128. data/lib/deprec/templates/network/resolv.conf.erb +6 -0
  129. data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
  130. data/lib/deprec/templates/nginx/mime.types.erb +70 -0
  131. data/lib/deprec/templates/nginx/nginx-init-script +62 -0
  132. data/lib/deprec/templates/nginx/nginx.conf.erb +125 -0
  133. data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
  134. data/lib/deprec/templates/nginx/nothing.conf +1 -0
  135. data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
  136. data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
  137. data/lib/deprec/templates/passenger/apache_vhost.erb +29 -0
  138. data/lib/deprec/templates/passenger/apache_vhost_disabled.erb +18 -0
  139. data/lib/deprec/templates/passenger/logrotate.conf.erb +12 -0
  140. data/lib/deprec/templates/passenger/passenger.conf.erb +21 -0
  141. data/lib/deprec/templates/passenger/passenger.load.erb +3 -0
  142. data/lib/deprec/templates/postfix/aliases.erb +3 -0
  143. data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
  144. data/lib/deprec/templates/postfix/main.cf.erb +36 -0
  145. data/lib/deprec/templates/postfix/master.cf.erb +77 -0
  146. data/lib/deprec/templates/postgresql/pg_hba.conf.erb +3 -0
  147. data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
  148. data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
  149. data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
  150. data/lib/deprec/templates/ssl/make-ssl-cert +138 -0
  151. data/lib/deprec/templates/ssl/ssl-cert-snakeoil.key +15 -0
  152. data/lib/deprec/templates/ssl/ssl-cert-snakeoil.pem +19 -0
  153. data/lib/deprec/templates/starling/monit.conf.erb +14 -0
  154. data/lib/deprec/templates/starling/starling-init-script.erb +71 -0
  155. data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
  156. data/lib/deprec/templates/syslog/syslog.conf.erb +71 -0
  157. data/lib/deprec/templates/syslog/syslogd.erb +13 -0
  158. data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
  159. data/lib/deprec/templates/trac/nginx_vhost.conf.erb +26 -0
  160. data/lib/deprec/templates/trac/trac.ini.erb +169 -0
  161. data/lib/deprec/templates/trac/trac_deprec.png +0 -0
  162. data/lib/deprec/templates/trac/tracd-init.erb +43 -0
  163. data/lib/deprec/templates/trac/users.htdigest.erb +0 -0
  164. data/lib/deprec/templates/vnstat/config.php +57 -0
  165. data/lib/deprec/templates/wordpress/apache2_wordpress_vhost.conf.erb +31 -0
  166. data/lib/deprec/templates/wordpress/wp-config.php.erb +31 -0
  167. data/lib/deprec/templates/wpmu/apache_vhost.conf.erb +13 -0
  168. data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
  169. data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
  170. data/lib/deprec/templates/xen/xend-init.erb +57 -0
  171. data/lib/deprec/templates/xen/xendomains.erb +137 -0
  172. data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
  173. data/lib/deprec/templates/xentools/40-setup-networking +145 -0
  174. data/lib/deprec/templates/xentools/xen-tools.conf.erb +276 -0
  175. data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
  176. data/lib/deprec_cmd_completion.sh +26 -0
  177. data/lib/deprec_minus_rails.rb +12 -0
  178. data/lib/vmbuilder_plugins/all.rb +20 -0
  179. data/lib/vmbuilder_plugins/apt.rb +93 -0
  180. data/lib/vmbuilder_plugins/emerge.rb +76 -0
  181. data/lib/vmbuilder_plugins/gem.rb +97 -0
  182. data/lib/vmbuilder_plugins/std.rb +203 -0
  183. metadata +245 -0
data/README ADDED
@@ -0,0 +1,154 @@
1
+ ------------------------------------------
2
+ deprec - Deployment Recipes for Capistrano
3
+ ------------------------------------------
4
+
5
+ == Introduction
6
+
7
+ The deprec [1] gem is a set of tasks for Capistrano [2]. These tasks provide
8
+ for the installation, configuration and control of system services on servers
9
+ running Ubuntu linux. Deprec was created in 2006 by Mike Bailey to setup an
10
+ environment for running Ruby on Rails web applications on Ubuntu servers. Since
11
+ then its uses have grown to installing Xen virtualization, mail, monitoring, high
12
+ availability IP failover and other services.
13
+
14
+ The tasks are run at the command line on your workstation and connect to
15
+ remote servers via ssh to run commands and copy out files.
16
+
17
+ Deprec-2.x is a complete rewrite of the project that achieves the following:
18
+
19
+ - support for Capistrano 2
20
+ - generated config files are stored locally to enable editing and version control
21
+ - support for more services (heartbeat, nagios, nginx, ntp, postfix, etc)
22
+ - multiple Rails deployment options (Passenger+Apache, Mongrel+Apache/Nginx)
23
+ - creation of a standard base set of task names
24
+ - tasks are cleanly separated into namespaced units (one file per service)
25
+ - interactive prompting for missing config values
26
+
27
+ Deprec and Capistrano are written in the Ruby programming language [3] however
28
+ no knowledge of Ruby is required to use it. Users should be able to write
29
+ new tasks and modify existing options without prior knowledge of Ruby.
30
+
31
+
32
+ == Installation
33
+
34
+ Deprec can be obtained from rubyforge[4] and installed using rubygems[5].
35
+
36
+ sudo gem install deprec # installs deprec and dependancies
37
+ cap depify . # creates ~/.caprc which you may edit
38
+ cap -T # should list lots of deprec tasks
39
+
40
+ The .caprc file is loaded every time you use Capistrano. It in turn loads
41
+ the deprec tasks so you always have them available. Editing the .caprc file
42
+ in your home directory allows you to specify the location of your ssh key
43
+ and enable some other useful options (documented in the comments). You can
44
+ also put tasks here that you want access to, regardless of the current working
45
+ directory.
46
+
47
+
48
+ == Getting a Ruby on Rails app running on a fresh Ubuntu server
49
+
50
+ This is still what brings people to deprec. You can install a full Rails stack
51
+ and get multiple apps running on it in much less time than it would take to
52
+ do it manually (e.g. an hour vs. a weekend).
53
+
54
+ Get your app running on a fresh Ubuntu (7.10, 8.04) server with these commands:
55
+
56
+ cd your_rails_app
57
+ depify .
58
+ # Edit config/deploy.rb
59
+ cap deprec:rails:install_stack
60
+
61
+ # WARNING! Don't run the following command if you are using a shared
62
+ # database server that has already been installed.
63
+ cap deprec:db:install
64
+
65
+ cap deploy:setup
66
+ cap deploy
67
+ cap deploy:migrate
68
+
69
+ Recorded times for complete install on Ubuntu hardy server (7.10 amd64)
70
+
71
+ * Passenger+REE+Apache : 14m29s
72
+ * Passenger+ruby-1.8.7+Apache : 17m51s
73
+ * nginx+mongrel : 16m25s
74
+
75
+ Note you can choose combinations of:
76
+
77
+ * Ruby Enterprise Edition or ruby-1.8.7
78
+ * Passenger or mongrel (passenger requires you choose to the apache option)
79
+ * Apache or nginx
80
+
81
+ You can find documentation on the deprec site. http://www.deprec.org/
82
+
83
+
84
+ == Installing other things
85
+
86
+ I plan to document other things I use deprec for on http://www.deprec.org/.
87
+ Feel free to poke around and see what's there. I use deprec to provision and
88
+ manage servers so you might find some things in there I haven't documented. Lucky you.
89
+
90
+
91
+ == Disclaimer
92
+
93
+ The tasks run commands that may make changes to your workstation and remote server.
94
+ You are advised to read the source and use at your own risk.
95
+
96
+
97
+ == Credits
98
+
99
+ Deprec is written and maintained by Mike Bailey <mike@bailey.net.au>.
100
+ More about me here: [http://mike.bailey.net.au/]
101
+
102
+ Deprec was inspired and uses the brilliantly executed Capistrano. Thanks Jamis!
103
+ This gem includes a modified copy of Neil Wilson's very useful vmbuilder_plugins gem.
104
+
105
+
106
+ == Thanks
107
+
108
+ Deprec wouldn't be what it is without the contributions of many people, a few of whom are listed here:
109
+
110
+ Square Circle Triangle: commissioned work that has included in the project.
111
+ Eric Harris-Braun: great testing, bug reports and suggestions
112
+ Gus Gollings: helped restore www.deprec.org
113
+ Craig Ambrose: testing, documentation and beer
114
+
115
+ github forks of note:
116
+ isaac
117
+ paulreimer
118
+ jasherai
119
+ saimonmoore
120
+ zippy
121
+
122
+
123
+ == License
124
+
125
+ Deprec is licenced under the GPL. This means that you can use it in commercial
126
+ or open source applications. More details found here:
127
+ http://www.gnu.org/licenses/gpl.html
128
+
129
+ deprec - deployment recipes for capistrano
130
+ Copyright (C) 2006-2008 Mike Bailey
131
+
132
+ This program is free software; you can redistribute it and/or
133
+ modify it under the terms of the GNU General Public License
134
+ as published by the Free Software Foundation; either version 2
135
+ of the License, or (at your option) any later version.
136
+
137
+ This program is distributed in the hope that it will be useful,
138
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
139
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
140
+ GNU General Public License for more details.
141
+
142
+ You should have received a copy of the GNU General Public License
143
+ along with this program; if not, write to the Free Software
144
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
145
+
146
+
147
+ [1] http://www.deprec.org/
148
+ [2] http://www.capify.org/
149
+ [3] http://www.ruby-lang.org/en/
150
+ [4] http://rubyforge.org/
151
+ [5] http://rubygems.org/
152
+ [6] http://www.sct.com.au/
153
+
154
+ foo
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