centostrano 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +215 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +166 -0
- data/THANKS +5 -0
- data/bin/centify +137 -0
- data/docs/ANNOUNCE.deprec2 +47 -0
- data/docs/README.install +88 -0
- data/docs/README.nagios +28 -0
- data/docs/README.rails +20 -0
- data/docs/README.svn +31 -0
- data/docs/ROADMAP.txt +74 -0
- data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
- data/docs/deprec-1.x/notes.txt +12 -0
- data/docs/deprec_banner.gif +0 -0
- data/lib/centostrano.rb +9 -0
- data/lib/deprec/capistrano_extensions.rb +391 -0
- data/lib/deprec/centostrano.rb +46 -0
- data/lib/deprec/recipes/apache.rb +188 -0
- data/lib/deprec/recipes/canonical.rb +57 -0
- data/lib/deprec/recipes/deprec.rb +188 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +106 -0
- data/lib/deprec/recipes/gitosis.rb +134 -0
- data/lib/deprec/recipes/logrotate.rb +54 -0
- data/lib/deprec/recipes/memcache.rb +53 -0
- data/lib/deprec/recipes/merb.rb +57 -0
- data/lib/deprec/recipes/mongrel.rb +220 -0
- data/lib/deprec/recipes/monit.rb +139 -0
- data/lib/deprec/recipes/mysql.rb +147 -0
- data/lib/deprec/recipes/nginx.rb +172 -0
- data/lib/deprec/recipes/postgresql.rb +132 -0
- data/lib/deprec/recipes/rails.rb +297 -0
- data/lib/deprec/recipes/ruby.rb +71 -0
- data/lib/deprec/recipes/sphinx.rb +89 -0
- data/lib/deprec/recipes/ssh.rb +93 -0
- data/lib/deprec/recipes/svn.rb +167 -0
- data/lib/deprec/recipes/users.rb +90 -0
- data/lib/deprec/recipes.rb +33 -0
- data/lib/deprec/templates/aoe/aoe-init +55 -0
- data/lib/deprec/templates/aoe/fence_aoemask +351 -0
- data/lib/deprec/templates/apache/httpd-vhost-app.conf.erb +144 -0
- data/lib/deprec/templates/apache/httpd.conf +465 -0
- data/lib/deprec/templates/apache/index.html.erb +37 -0
- data/lib/deprec/templates/apache/master.css +72 -0
- data/lib/deprec/templates/centos/repository.erb +6 -0
- data/lib/deprec/templates/coraid/aoe-init +55 -0
- data/lib/deprec/templates/deprec/caprc.erb +14 -0
- data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
- data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
- data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
- data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/templates/mongrel/logrotate.erb +0 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster.logrotate.d +14 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
- data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
- data/lib/deprec/templates/monit/monit-init-script +104 -0
- data/lib/deprec/templates/monit/monitrc.erb +227 -0
- data/lib/deprec/templates/monit/nothing +0 -0
- data/lib/deprec/templates/mysql/create_databases.sql +20 -0
- data/lib/deprec/templates/mysql/database.yml.prod +6 -0
- data/lib/deprec/templates/mysql/database.yml.stage +6 -0
- data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
- data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
- data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
- data/lib/deprec/templates/nagios/cgi.cfg.erb +321 -0
- data/lib/deprec/templates/nagios/commands.cfg.erb +240 -0
- data/lib/deprec/templates/nagios/contacts.cfg.erb +57 -0
- data/lib/deprec/templates/nagios/hosts.cfg.erb +143 -0
- data/lib/deprec/templates/nagios/htpasswd.users +1 -0
- data/lib/deprec/templates/nagios/localhost.cfg.erb +157 -0
- data/lib/deprec/templates/nagios/nagios.cfg.erb +1274 -0
- data/lib/deprec/templates/nagios/nagios_apache_vhost.conf.erb +45 -0
- data/lib/deprec/templates/nagios/nrpe.cfg.erb +210 -0
- data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
- data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
- data/lib/deprec/templates/nagios/services.cfg.erb +79 -0
- data/lib/deprec/templates/nagios/templates.cfg.erb +9 -0
- data/lib/deprec/templates/nagios/timeperiods.cfg.erb +94 -0
- data/lib/deprec/templates/network/hostname.erb +1 -0
- data/lib/deprec/templates/network/hosts.erb +2 -0
- data/lib/deprec/templates/network/interfaces.erb +22 -0
- data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
- data/lib/deprec/templates/nginx/logrotate.erb +0 -0
- data/lib/deprec/templates/nginx/mime.types.erb +70 -0
- data/lib/deprec/templates/nginx/nginx-init-script +109 -0
- data/lib/deprec/templates/nginx/nginx.conf.erb +120 -0
- data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
- data/lib/deprec/templates/nginx/nothing.conf +1 -0
- data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
- data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
- data/lib/deprec/templates/postfix/aliases.erb +3 -0
- data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
- data/lib/deprec/templates/postfix/main.cf.erb +41 -0
- data/lib/deprec/templates/postfix/master.cf.erb +77 -0
- data/lib/deprec/templates/postgresql/pg_hba.conf.erb +76 -0
- data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
- data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
- data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
- data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
- data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
- data/lib/deprec/templates/trac/trac.ini.erb +106 -0
- data/lib/deprec/templates/trac/trac_deprec.png +0 -0
- data/lib/deprec/templates/trac/tracd-init.erb +43 -0
- data/lib/deprec/templates/xen/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
- data/lib/deprec/templates/xen/xen-tools.conf.erb +220 -0
- data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
- data/lib/deprec/templates/xen/xend-init.erb +69 -0
- data/lib/deprec/templates/xen/xendomains.erb +137 -0
- data/lib/deprec/templates/xen/xm.tmpl.erb +85 -0
- data/lib/deprec_cmd_completion.sh +26 -0
- data/lib/vmbuilder_plugins/all.rb +20 -0
- data/lib/vmbuilder_plugins/apt.rb +93 -0
- data/lib/vmbuilder_plugins/emerge.rb +76 -0
- data/lib/vmbuilder_plugins/gem.rb +90 -0
- data/lib/vmbuilder_plugins/std.rb +203 -0
- metadata +207 -0
@@ -0,0 +1,297 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
|
4
|
+
set :database_yml_in_scm, true
|
5
|
+
set :app_symlinks, nil
|
6
|
+
set :rails_env, 'production'
|
7
|
+
set :gems_for_project, nil # Array of gems to be installed for app
|
8
|
+
set :shared_dirs, nil # Array of directories that should be created under shared/
|
9
|
+
# and linked to in the project
|
10
|
+
|
11
|
+
# Hook into the default capistrano deploy tasks
|
12
|
+
before 'deploy:setup', :except => { :no_release => true } do
|
13
|
+
top.centos.rails.setup_user_perms
|
14
|
+
top.centos.rails.setup_paths
|
15
|
+
top.centos.rails.setup_shared_dirs
|
16
|
+
top.centos.rails.install_gems_for_project
|
17
|
+
end
|
18
|
+
|
19
|
+
after 'deploy:setup', :except => { :no_release => true } do
|
20
|
+
top.centos.rails.setup_servers
|
21
|
+
top.centos.rails.create_config_dir
|
22
|
+
top.centos.rails.set_perms_on_shared_and_releases
|
23
|
+
end
|
24
|
+
|
25
|
+
after 'deploy:symlink', :roles => :app do
|
26
|
+
top.centos.rails.symlink_shared_dirs
|
27
|
+
top.centos.rails.symlink_database_yml unless database_yml_in_scm
|
28
|
+
top.centos.mongrel.set_perms_for_mongrel_dirs
|
29
|
+
end
|
30
|
+
|
31
|
+
after :deploy, :roles => :app do
|
32
|
+
deploy.cleanup
|
33
|
+
end
|
34
|
+
|
35
|
+
namespace :centos do
|
36
|
+
namespace :rails do
|
37
|
+
|
38
|
+
task :install, :roles => :app do
|
39
|
+
install_deps
|
40
|
+
install_gems
|
41
|
+
end
|
42
|
+
|
43
|
+
task :install_deps do
|
44
|
+
apt.install( {:base => %w(sqlite sqlite-devel)}, :stable )
|
45
|
+
apt.install( {:base => %w(mysql-devel)}, :stable )
|
46
|
+
end
|
47
|
+
|
48
|
+
# install some required ruby gems
|
49
|
+
task :install_gems do
|
50
|
+
gem2.install 'sqlite3-ruby'
|
51
|
+
gem2.install 'mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql'
|
52
|
+
gem2.install 'rails'
|
53
|
+
gem2.install 'rspec'
|
54
|
+
end
|
55
|
+
|
56
|
+
desc <<-DESC
|
57
|
+
Install full rails stack on a stock standard CentOS server (5.1 and 5.2 tested)
|
58
|
+
DESC
|
59
|
+
|
60
|
+
task :install_stack do
|
61
|
+
# Ruby everywhere!
|
62
|
+
top.centos.ruby.install
|
63
|
+
top.centos.rubygems.install
|
64
|
+
|
65
|
+
# Stop and deactivate apache 2
|
66
|
+
deprec2.for_roles('web') do
|
67
|
+
top.centos.apache.stop
|
68
|
+
top.centos.apache.deactivate
|
69
|
+
end
|
70
|
+
|
71
|
+
# Install nginx
|
72
|
+
deprec2.for_roles('web') do
|
73
|
+
top.centos.nginx.install
|
74
|
+
end
|
75
|
+
|
76
|
+
deprec2.for_roles('app') do
|
77
|
+
top.centos.svn.install
|
78
|
+
top.centos.git.install
|
79
|
+
top.centos.mongrel.install
|
80
|
+
top.centos.monit.install
|
81
|
+
top.centos.rails.install
|
82
|
+
end
|
83
|
+
|
84
|
+
deprec2.for_roles('web,app') do
|
85
|
+
top.centos.logrotate.install
|
86
|
+
end
|
87
|
+
|
88
|
+
# Install database separately
|
89
|
+
# deprec2.for_roles('db') do
|
90
|
+
# top.centos.mysql.install
|
91
|
+
# top.centos.mysql.start
|
92
|
+
# end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
task :install_rails_stack do
|
97
|
+
puts "deprecated: this task is now called install_stack"
|
98
|
+
install_stack
|
99
|
+
end
|
100
|
+
|
101
|
+
task :install_gems_for_project do
|
102
|
+
if gems_for_project
|
103
|
+
gems_for_project.each { |gem| gem2.install(gem) }
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
PROJECT_CONFIG_FILES[:nginx] = [
|
108
|
+
|
109
|
+
{:template => 'rails_nginx_vhost.conf.erb',
|
110
|
+
:path => "rails_nginx_vhost.conf",
|
111
|
+
:mode => 0644,
|
112
|
+
:owner => 'root:root'},
|
113
|
+
|
114
|
+
{:template => 'logrotate.conf.erb',
|
115
|
+
:path => "logrotate.conf",
|
116
|
+
:mode => 0644,
|
117
|
+
:owner => 'root:root'}
|
118
|
+
]
|
119
|
+
|
120
|
+
desc "Generate config files for rails app."
|
121
|
+
task :config_gen do
|
122
|
+
PROJECT_CONFIG_FILES[:nginx].each do |file|
|
123
|
+
deprec2.render_template(:nginx, file)
|
124
|
+
end
|
125
|
+
top.centos.mongrel.config_gen_project
|
126
|
+
top.centos.mongrel.config_project
|
127
|
+
end
|
128
|
+
|
129
|
+
desc "Push out config files for rails app."
|
130
|
+
task :config, :roles => [:app, :web] do
|
131
|
+
deprec2.push_configs(:nginx, PROJECT_CONFIG_FILES[:nginx])
|
132
|
+
top.centos.mongrel.config_project
|
133
|
+
symlink_nginx_vhost
|
134
|
+
symlink_logrotate_config
|
135
|
+
end
|
136
|
+
|
137
|
+
task :symlink_nginx_vhost, :roles => :web do
|
138
|
+
sudo "ln -sf #{deploy_to}/nginx/rails_nginx_vhost.conf #{nginx_vhost_dir}/#{application}.conf"
|
139
|
+
end
|
140
|
+
|
141
|
+
task :symlink_logrotate_config, :roles => :web do
|
142
|
+
sudo "ln -sf #{deploy_to}/nginx/logrotate.conf /etc/logrotate.d/nginx-#{application}"
|
143
|
+
end
|
144
|
+
|
145
|
+
task :create_config_dir do
|
146
|
+
deprec2.mkdir("#{shared_path}/config", :group => group, :mode => 0775, :via => :sudo)
|
147
|
+
end
|
148
|
+
|
149
|
+
desc "Create deployment group and add current user to it"
|
150
|
+
task :setup_user_perms do
|
151
|
+
deprec2.groupadd(group)
|
152
|
+
deprec2.add_user_to_group(user, group)
|
153
|
+
deprec2.groupadd(mongrel_group)
|
154
|
+
deprec2.add_user_to_group(user, mongrel_group)
|
155
|
+
# we've just added ourself to a group - need to teardown connection
|
156
|
+
# so that next command uses new session where we belong in group
|
157
|
+
deprec2.teardown_connections
|
158
|
+
end
|
159
|
+
|
160
|
+
task :set_perms_on_shared_and_releases, :roles => :app do
|
161
|
+
releases = File.join(deploy_to, 'releases')
|
162
|
+
sudo "chgrp -R #{group} #{shared_path} #{releases}"
|
163
|
+
sudo "chmod -R g+w #{shared_path} #{releases}"
|
164
|
+
end
|
165
|
+
|
166
|
+
# Setup database server.
|
167
|
+
task :setup_db, :roles => :db, :only => { :primary => true } do
|
168
|
+
top.centos.mysql.setup
|
169
|
+
end
|
170
|
+
|
171
|
+
# setup extra paths required for deployment
|
172
|
+
task :setup_paths, :roles => :app do
|
173
|
+
deprec2.mkdir(deploy_to, :mode => 0775, :group => group, :via => :sudo)
|
174
|
+
deprec2.mkdir(shared_path, :mode => 0775, :group => group, :via => :sudo)
|
175
|
+
end
|
176
|
+
|
177
|
+
# Symlink list of files and dirs from shared to current
|
178
|
+
#
|
179
|
+
# XXX write up explanation
|
180
|
+
#
|
181
|
+
desc "Setup shared dirs"
|
182
|
+
task :setup_shared_dirs, :roles => [:app, :web] do
|
183
|
+
if shared_dirs
|
184
|
+
shared_dirs.each { |dir| deprec2.mkdir( "#{shared_path}/#{dir}", :via => :sudo ) }
|
185
|
+
end
|
186
|
+
end
|
187
|
+
#
|
188
|
+
desc "Symlink shared dirs."
|
189
|
+
task :symlink_shared_dirs, :roles => [:app, :web] do
|
190
|
+
if shared_dirs
|
191
|
+
shared_dirs.each do |dir|
|
192
|
+
path = File.split(dir)[0]
|
193
|
+
if path != '.'
|
194
|
+
deprec2.mkdir("#{current_path}/#{path}")
|
195
|
+
end
|
196
|
+
run "ln -nfs #{shared_path}/#{dir} #{current_path}/#{dir}"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# desc "Symlink shared files."
|
202
|
+
# task :symlink_shared_files, :roles => [:app, :web] do
|
203
|
+
# if shared_files
|
204
|
+
# shared_files.each { |file| run "ln -nfs #{shared_path}/#{file} #{current_path}/#{file}" }
|
205
|
+
# end
|
206
|
+
# end
|
207
|
+
|
208
|
+
# database.yml stuff
|
209
|
+
#
|
210
|
+
# XXX DRY this up
|
211
|
+
# I don't know how to let :gen_db_yml check if values have been set.
|
212
|
+
#
|
213
|
+
# if (self.respond_to?("db_host_#{rails_env}".to_sym)) # doesn't seem to work
|
214
|
+
|
215
|
+
set :db_host_default, lambda { Capistrano::CLI.prompt 'Enter database host', 'localhost'}
|
216
|
+
set :db_host_staging, lambda { db_host_default }
|
217
|
+
set :db_host_production, lambda { db_host_default }
|
218
|
+
|
219
|
+
set :db_name_default, lambda { Capistrano::CLI.prompt 'Enter database name', "#{application}_#{rails_env}" }
|
220
|
+
set :db_name_staging, lambda { db_name_default }
|
221
|
+
set :db_name_production, lambda { db_name_default }
|
222
|
+
|
223
|
+
set :db_user_default, lambda { Capistrano::CLI.prompt 'Enter database user', 'root' }
|
224
|
+
set :db_user_staging, lambda { db_user_default }
|
225
|
+
set :db_user_production, lambda { db_user_default }
|
226
|
+
|
227
|
+
set :db_pass_default, lambda { Capistrano::CLI.prompt 'Enter database pass', '' }
|
228
|
+
set :db_pass_staging, lambda { db_pass_default }
|
229
|
+
set :db_pass_production, lambda { db_pass_default }
|
230
|
+
|
231
|
+
set :db_adaptor_default, lambda { Capistrano::CLI.prompt 'Enter database adaptor', 'mysql' }
|
232
|
+
set :db_adaptor_staging, lambda { db_adaptor_default }
|
233
|
+
set :db_adaptor_production, lambda { db_adaptor_default }
|
234
|
+
|
235
|
+
set :db_socket_default, lambda { Capistrano::CLI.prompt('Enter database socket', '')}
|
236
|
+
set :db_socket_staging, lambda { db_socket_default }
|
237
|
+
set :db_socket_production, lambda { db_socket_default }
|
238
|
+
|
239
|
+
task :generate_database_yml, :roles => :app do
|
240
|
+
database_configuration = render :template => <<-EOF
|
241
|
+
#{rails_env}:
|
242
|
+
adapter: #{self.send("db_adaptor_#{rails_env}")}
|
243
|
+
database: #{self.send("db_name_#{rails_env}")}
|
244
|
+
username: #{self.send("db_user_#{rails_env}")}
|
245
|
+
password: #{self.send("db_pass_#{rails_env}")}
|
246
|
+
host: #{self.send("db_host_#{rails_env}")}
|
247
|
+
socket: #{self.send("db_socket_#{rails_env}")}
|
248
|
+
EOF
|
249
|
+
run "mkdir -p #{deploy_to}/#{shared_dir}/config"
|
250
|
+
put database_configuration, "#{deploy_to}/#{shared_dir}/config/database.yml"
|
251
|
+
end
|
252
|
+
|
253
|
+
desc "Link in the production database.yml"
|
254
|
+
task :symlink_database_yml, :roles => :app do
|
255
|
+
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
256
|
+
end
|
257
|
+
|
258
|
+
|
259
|
+
desc "setup and configure servers"
|
260
|
+
task :setup_servers do
|
261
|
+
|
262
|
+
top.centos.nginx.activate
|
263
|
+
top.centos.mongrel.create_mongrel_user_and_group
|
264
|
+
top.centos.mongrel.activate
|
265
|
+
top.centos.monit.activate
|
266
|
+
top.centos.rails.config_gen
|
267
|
+
top.centos.rails.config
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
namespace :db do
|
272
|
+
|
273
|
+
desc "Create database"
|
274
|
+
task :create, :roles => :db do
|
275
|
+
run "cd #{deploy_to}/current && rake db:create RAILS_ENV=#{rails_env}"
|
276
|
+
end
|
277
|
+
|
278
|
+
desc "Run database migrations"
|
279
|
+
task :migrate, :roles => :db do
|
280
|
+
run "cd #{deploy_to}/current && rake db:migrate RAILS_ENV=#{rails_env}"
|
281
|
+
end
|
282
|
+
|
283
|
+
desc "Run database migrations"
|
284
|
+
task :schema_load, :roles => :db do
|
285
|
+
run "cd #{deploy_to}/current && rake db:schema:load RAILS_ENV=#{rails_env}"
|
286
|
+
end
|
287
|
+
|
288
|
+
desc "Roll database back to previous migration"
|
289
|
+
task :rollback, :roles => :db do
|
290
|
+
run "cd #{deploy_to}/current && rake db:rollback RAILS_ENV=#{rails_env}"
|
291
|
+
end
|
292
|
+
|
293
|
+
end
|
294
|
+
|
295
|
+
|
296
|
+
end
|
297
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
|
4
|
+
namespace :centos do
|
5
|
+
namespace :ruby do
|
6
|
+
|
7
|
+
SRC_PACKAGES[:ruby] = {
|
8
|
+
:filename => 'ruby-1.8.6-p111.tar.gz',
|
9
|
+
:md5sum => "c36e011733a3a3be6f43ba27b7cd7485 ruby-1.8.6-p111.tar.gz",
|
10
|
+
:dir => 'ruby-1.8.6-p111',
|
11
|
+
:url => "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz",
|
12
|
+
:unpack => "tar zxf ruby-1.8.6-p111.tar.gz; cd ruby-1.8.6-p111; wget -q -O - wget http://blog.phusion.nl/assets/r8ee-security-patch-20080623-2.txt | patch -p1",
|
13
|
+
:configure => %w(
|
14
|
+
./configure
|
15
|
+
--with-install-readline
|
16
|
+
;
|
17
|
+
).reject{|arg| arg.match '#'}.join(' '),
|
18
|
+
:make => 'make;',
|
19
|
+
:install => 'make install;',
|
20
|
+
:version => 'c1.8.6',
|
21
|
+
:release => '111eephusion'
|
22
|
+
}
|
23
|
+
|
24
|
+
task :install do
|
25
|
+
install_deps
|
26
|
+
deprec2.download_src(SRC_PACKAGES[:ruby], src_dir)
|
27
|
+
yum.install_from_src(SRC_PACKAGES[:ruby], src_dir)
|
28
|
+
end
|
29
|
+
|
30
|
+
task :install_deps do
|
31
|
+
apt.install( {:base => %w(pcre* gcc make openssl openssl-devel readline-devel)}, :stable )
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
namespace :centos do
|
39
|
+
namespace :rubygems do
|
40
|
+
|
41
|
+
SRC_PACKAGES[:rubygems] = {
|
42
|
+
:filename => 'rubygems-1.2.0.tgz',
|
43
|
+
:md5sum => "b77a4234360735174d1692e6fc598402 rubygems-1.2.0.tgz",
|
44
|
+
:dir => 'rubygems-1.2.0',
|
45
|
+
:url => "http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz",
|
46
|
+
:unpack => "tar zxf rubygems-1.2.0.tgz;",
|
47
|
+
:install => 'ruby setup.rb;',
|
48
|
+
:version => 'c1.2.0',
|
49
|
+
:release => '1'
|
50
|
+
}
|
51
|
+
|
52
|
+
task :install do
|
53
|
+
install_deps
|
54
|
+
deprec2.download_src(SRC_PACKAGES[:rubygems], src_dir)
|
55
|
+
yum.install_from_src(SRC_PACKAGES[:rubygems], src_dir)
|
56
|
+
# gem2.upgrade # you may not want to upgrade your gems right now
|
57
|
+
# If we want to selfupdate then we need to
|
58
|
+
# create symlink as latest gems version is broken
|
59
|
+
# gem2.update_system
|
60
|
+
# sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
|
61
|
+
end
|
62
|
+
|
63
|
+
# install dependencies for rubygems
|
64
|
+
task :install_deps do
|
65
|
+
apt.install( {:base => %w(pcre* gcc make openssl openssl-devel)}, :stable )
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :centos do
|
4
|
+
namespace :sphinx do
|
5
|
+
|
6
|
+
SRC_PACKAGES[:sphinx] = {
|
7
|
+
:filename => 'sphinx-0.9.8-rc2.tar.gz',
|
8
|
+
:dir => 'sphinx-0.9.8-rc2',
|
9
|
+
:url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.8-rc2.tar.gz",
|
10
|
+
:unpack => "tar zxf sphinx-0.9.8-rc2.tar.gz;",
|
11
|
+
:configure => %w(
|
12
|
+
./configure
|
13
|
+
--with-mysql
|
14
|
+
--with-pgsql
|
15
|
+
;
|
16
|
+
).reject{|arg| arg.match '#'}.join(' '),
|
17
|
+
:make => 'make;',
|
18
|
+
:install => 'make install;',
|
19
|
+
:version => 'c0.9.8',
|
20
|
+
:release => '0rc2'
|
21
|
+
}
|
22
|
+
|
23
|
+
desc "install Sphinx Search Engine"
|
24
|
+
task :install do
|
25
|
+
install_deps
|
26
|
+
deprec2.download_src(SRC_PACKAGES[:sphinx], src_dir)
|
27
|
+
yum.install_from_src(SRC_PACKAGES[:sphinx], src_dir)
|
28
|
+
end
|
29
|
+
|
30
|
+
# install dependencies for sphinx
|
31
|
+
task :install_deps do
|
32
|
+
# apt.install( {:base => %w(blah)}, :stable )
|
33
|
+
top.centos.postgresql.install
|
34
|
+
end
|
35
|
+
|
36
|
+
SYSTEM_CONFIG_FILES[:sphinx] = []
|
37
|
+
|
38
|
+
PROJECT_CONFIG_FILES[:sphinx] = [
|
39
|
+
|
40
|
+
{:template => 'monit.conf.erb',
|
41
|
+
:path => 'monit.conf',
|
42
|
+
:mode => 0644,
|
43
|
+
:owner => 'root:root'}
|
44
|
+
|
45
|
+
]
|
46
|
+
|
47
|
+
desc <<-DESC
|
48
|
+
Generate sphinx config from template. Note that this does not
|
49
|
+
push the config to the server, it merely generates required
|
50
|
+
configuration files. These should be kept under source control.
|
51
|
+
The can be pushed to the server with the :config task.
|
52
|
+
DESC
|
53
|
+
task :config_gen do
|
54
|
+
PROJECT_CONFIG_FILES[:sphinx].each do |file|
|
55
|
+
deprec2.render_template(:sphinx, file)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Push sphinx config files to server"
|
60
|
+
task :config, :roles => :sphinx do
|
61
|
+
config_project
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Push sphinx config files to server"
|
65
|
+
task :config_project, :roles => :sphinx do
|
66
|
+
deprec2.push_configs(:sphinx, PROJECT_CONFIG_FILES[:sphinx])
|
67
|
+
symlink_monit_config
|
68
|
+
end
|
69
|
+
|
70
|
+
task :symlink_monit_config, :roles => :sphinx do
|
71
|
+
sudo "ln -sf #{deploy_to}/sphinx/monit.conf #{monit_confd_dir}/sphinx_#{application}.conf"
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
# Control
|
76
|
+
|
77
|
+
desc "Restart the sphinx searchd daemon"
|
78
|
+
task :restart, :roles => :app do
|
79
|
+
run("cd #{deploy_to}/current; /usr/bin/rake us:start") ### start or restart? SUDO ? ###
|
80
|
+
end
|
81
|
+
|
82
|
+
desc "Regenerate / Rotate the search index."
|
83
|
+
task :reindex, :roles => :app do
|
84
|
+
run("cd #{deploy_to}/current; /usr/bin/rake us:in") ### SUDO ? ###
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|