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
@@ -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!
@@ -0,0 +1,95 @@
1
+ # vnstat
2
+
3
+ # install vnstat
4
+ http://humdi.net/vnstat/vnstat-1.6.tar.gz
5
+ sudo apt-get install vnstat
6
+
7
+ # initialize it for a virtual interface
8
+ vnstat -u -i vif-apt
9
+
10
+ # generate images
11
+ http://humdi.net/vnstat/vnstati-beta3.tar.gz
12
+ apt-get install libgd2-noxpm-dev libgd2-noxpm
13
+ vnstati -s -i vif-apt -o /tmp/vnstat.png
14
+
15
+ # php web frontend
16
+ http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.3.tar.gz
17
+
18
+
19
+ # Steps for setting up vnstat on a new Xen dom0
20
+
21
+ 1. Install vnstat on host
22
+
23
+ # Steps for adding a new server to vnstat monitoring
24
+
25
+ 1. Add it to vnstat monitoring
26
+
27
+ vnstat -u -i web2-eth0
28
+
29
+ 2.
30
+
31
+
32
+ #
33
+ # Add all eth interfaces
34
+ #
35
+ for x in `ls /proc/sys/net/ipv4/conf | grep eth | cut -f 1 -d' '`; do
36
+ vnstat -u -i $x
37
+ done
38
+
39
+ #!/bin/bash
40
+ #
41
+ # Dump vnstat data
42
+ #
43
+ dump_dir=/var/lib/vnstat_dumps
44
+
45
+ test -d $dump_dir || mkdir -p $dump_dir
46
+
47
+ for x in `ls /var/lib/vnstat/*-eth*`; do
48
+ vnstat --dumpdb -i `basename $x` > ${dump_dir}/vnstat_dump_`basename $x`
49
+ done
50
+
51
+ for x in eth0 eth1; do
52
+ vnstat --dumpdb -i $x > ${dump_dir}/vnstat_dump_`hostname`-$x
53
+ done
54
+
55
+
56
+
57
+ #!/bin/bash
58
+ #
59
+ # Pull vnstat metrics back from Xen dom0's
60
+ #
61
+
62
+ dump_dir=/var/lib/vnstat_dumps
63
+
64
+ test -d $dump_dir || mkdir -p $dump_dir
65
+ for x in sm03; do
66
+ rsync -avz ${x}:${dump_dir}/ /var/www/vnstat/dumps/
67
+ done
68
+
69
+
70
+
71
+ #
72
+ # Separate internal and external traffic on NAT'ed slices
73
+ #
74
+
75
+ The following in /etc/network/interfaces will allow us to monitor
76
+ internal and external traffic by reading separate interface counters
77
+ on the domU.
78
+
79
+ # First IP on internal network (for external traffic)
80
+ auto eth0
81
+ iface eth0 inet static
82
+ address 192.168.1.70
83
+ netmask 255.255.255.255
84
+
85
+ # Second IP on internal network (for internal traffic only)
86
+ auto eth1
87
+ iface eth1 inet static
88
+ address 192.168.1.71
89
+ netmask 255.255.255.0
90
+
91
+ # Route external traffic out eth0
92
+ up route add -net 192.168.1.1 netmask 255.255.255.255 dev eth0
93
+ up route add default gw 192.168.1.1
94
+
95
+