deprec 1.9.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +280 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +152 -0
- data/THANKS +17 -0
- data/bin/depify +128 -0
- data/docs/EXAMPLE-installing_tracks.txt +41 -0
- data/docs/README.nagios +22 -0
- data/docs/README.rails +17 -0
- data/docs/config_gen_explained.txt +39 -0
- data/docs/{README.quickstart → deprec-1.x/deprec-1.x.quickstart} +4 -1
- data/docs/{building_edge_capistrano.txt → deprec-1.x/notes.txt} +6 -3
- data/docs/old/deprec_banner.gif +0 -0
- data/docs/windows_linux.txt +350 -0
- data/docs/xen/traffic_monitoring_with_vnstat.txt +95 -0
- data/docs/xen/xen-tools-notes.txt +31 -0
- data/docs/xen/xen_on_hardy.txt +39 -0
- data/lib/deprec.rb +8 -1
- data/lib/deprec/capistrano_extensions.rb +442 -0
- data/lib/deprec/recipes.rb +50 -233
- data/lib/deprec/recipes/aoe.rb +79 -0
- data/lib/deprec/recipes/app/mongrel.rb +213 -0
- data/lib/deprec/recipes/app/passenger.rb +197 -0
- data/lib/deprec/recipes/apt_mirror.rb +99 -0
- data/lib/deprec/recipes/ar_sendmail.rb +67 -0
- data/lib/deprec/recipes/canonical.rb +68 -0
- data/lib/deprec/recipes/db/mysql.rb +144 -0
- data/lib/deprec/recipes/db/postgresql.rb +104 -0
- data/lib/deprec/recipes/db/sqlite.rb +37 -0
- data/lib/deprec/recipes/ddclient.rb +51 -0
- data/lib/deprec/recipes/deprec.rb +199 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +97 -0
- data/lib/deprec/recipes/gitosis.rb +48 -0
- data/lib/deprec/recipes/heartbeat.rb +138 -0
- data/lib/deprec/recipes/logrotate.rb +54 -0
- data/lib/deprec/recipes/lvm.rb +20 -0
- data/lib/deprec/recipes/memcache.rb +6 -2
- data/lib/deprec/recipes/monit.rb +143 -0
- data/lib/deprec/recipes/nagios.rb +305 -0
- data/lib/deprec/recipes/network.rb +93 -0
- data/lib/deprec/recipes/ntp.rb +103 -0
- data/lib/deprec/recipes/php.rb +58 -0
- data/lib/deprec/recipes/postfix.rb +115 -0
- data/lib/deprec/recipes/rails.rb +300 -55
- data/lib/deprec/recipes/ruby/mri.rb +55 -0
- data/lib/deprec/recipes/ruby/ree.rb +41 -0
- data/lib/deprec/recipes/sphinx.rb +86 -0
- data/lib/deprec/recipes/ssh.rb +85 -18
- data/lib/deprec/recipes/ssl.rb +55 -0
- data/lib/deprec/recipes/starling.rb +119 -0
- data/lib/deprec/recipes/svn.rb +163 -183
- data/lib/deprec/recipes/trac.rb +239 -62
- data/lib/deprec/recipes/ubuntu.rb +18 -100
- data/lib/deprec/recipes/users.rb +90 -0
- data/lib/deprec/recipes/utils.rb +58 -0
- data/lib/deprec/recipes/vnstat.rb +85 -0
- data/lib/deprec/recipes/web/apache.rb +119 -0
- data/lib/deprec/recipes/web/nginx.rb +172 -0
- data/lib/deprec/recipes/wordpress.rb +96 -0
- data/lib/deprec/recipes/wpmu.rb +103 -0
- data/lib/deprec/recipes/xen.rb +267 -0
- data/lib/deprec/recipes/xentools.rb +75 -0
- data/lib/deprec/templates/aoe/aoe-init +55 -0
- data/lib/deprec/templates/aoe/fence_aoemask +351 -0
- data/lib/deprec/templates/apache/namevirtualhosts.conf +5 -0
- data/lib/deprec/templates/apt/sources.list +18 -0
- data/lib/deprec/templates/apt_mirror/apt-mirror-cron +4 -0
- data/lib/deprec/templates/apt_mirror/mirror.list +33 -0
- data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
- data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
- data/lib/deprec/templates/ddclient/ddclient.conf.erb +11 -0
- data/lib/deprec/templates/ddclient/ddclient.erb +15 -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/apache_vhost.erb +148 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/{third_party/mongrel_cluster/resources/mongrel_cluster → templates/mongrel/mongrel_cluster-init-script} +19 -6
- 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/mongrel/nginx_vhost.erb +41 -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/check_linux_free_memory.pl +118 -0
- data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -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 +18 -0
- data/lib/deprec/templates/network/resolv.conf.erb +6 -0
- data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
- data/lib/deprec/templates/nginx/mime.types.erb +70 -0
- data/lib/deprec/templates/nginx/nginx-init-script +62 -0
- data/lib/deprec/templates/nginx/nginx.conf.erb +125 -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/passenger/apache_vhost.erb +21 -0
- data/lib/deprec/templates/passenger/passenger.conf.erb +21 -0
- data/lib/deprec/templates/passenger/passenger.load.erb +3 -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.conf → postfix/main.cf.erb} +6 -8
- data/lib/deprec/templates/postfix/master.cf.erb +77 -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/ssl/make-ssl-cert +138 -0
- data/lib/deprec/templates/ssl/ssl-cert-snakeoil.key +15 -0
- data/lib/deprec/templates/ssl/ssl-cert-snakeoil.pem +19 -0
- data/lib/deprec/templates/starling/monit.conf.erb +14 -0
- data/lib/deprec/templates/starling/starling-init-script.erb +71 -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/nginx_vhost.conf.erb +26 -0
- data/lib/deprec/templates/trac/trac.ini.erb +169 -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/trac/users.htdigest.erb +0 -0
- data/lib/deprec/templates/vnstat/config.php +57 -0
- data/lib/deprec/templates/wordpress/apache2_wordpress_vhost.conf.erb +31 -0
- data/lib/deprec/templates/wordpress/wp-config.php.erb +31 -0
- data/lib/deprec/templates/wpmu/apache_vhost.conf.erb +13 -0
- data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
- data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
- data/lib/deprec/templates/xen/xend-init.erb +57 -0
- data/lib/deprec/templates/xen/xendomains.erb +137 -0
- data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xentools/40-setup-networking +145 -0
- data/lib/deprec/templates/xentools/xen-tools.conf.erb +276 -0
- data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -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/{deprec/third_party/vmbuilder/plugins → vmbuilder_plugins}/gem.rb +10 -17
- data/lib/{deprec/third_party/vmbuilder/plugins → vmbuilder_plugins}/std.rb +69 -19
- metadata +204 -55
- data/bin/deprec +0 -35
- data/docs/README.slicehost +0 -14
- data/docs/README.svn_trac +0 -19
- data/lib/deprec/capistrano_extensions/actor_extensions.rb +0 -89
- data/lib/deprec/capistrano_extensions/cli_extensions.rb +0 -38
- data/lib/deprec/capistrano_extensions/deprec_extensions.rb +0 -137
- data/lib/deprec/generators/deprec/USAGE +0 -11
- data/lib/deprec/generators/deprec/deprec_generator.rb +0 -24
- data/lib/deprec/generators/deprec/templates/deploy.rb +0 -90
- data/lib/deprec/generators/loader.rb +0 -20
- data/lib/deprec/recipes/apache.rb +0 -91
- data/lib/deprec/recipes/cache_svn.rb +0 -74
- data/lib/deprec/recipes/vmware.rb +0 -114
- data/lib/deprec/templates/trac.ini.erb +0 -106
- data/lib/deprec/third_party/THIRD_PARTY_README +0 -12
- data/lib/deprec/third_party/mongrel_cluster/LICENSE +0 -506
- data/lib/deprec/third_party/mongrel_cluster/recipes.rb +0 -96
- data/lib/deprec/third_party/railsmachine/LICENSE +0 -506
- data/lib/deprec/third_party/railsmachine/recipes/apache.rb +0 -92
- data/lib/deprec/third_party/railsmachine/recipes/mysql.rb +0 -73
- data/lib/deprec/third_party/railsmachine/recipes/templates/httpd-ssl.conf +0 -80
- data/lib/deprec/third_party/railsmachine/recipes/templates/httpd.conf +0 -57
- data/lib/deprec/third_party/vmbuilder/plugins.rb +0 -8
- data/lib/deprec/third_party/vmbuilder/plugins/apt.rb +0 -144
- data/resources/capistrano_include_dotfiles.patch +0 -17
@@ -1,38 +0,0 @@
|
|
1
|
-
module Capistrano
|
2
|
-
# The CLI class encapsulates the behavior of capistrano when it is invoked
|
3
|
-
# as a command-line utility. This allows other programs to embed ST and
|
4
|
-
# preserve it's command-line semantics.
|
5
|
-
class CLI
|
6
|
-
|
7
|
-
# Prompt for a password using echo suppression.
|
8
|
-
def self.password_prompt(prompt="Password: ")
|
9
|
-
sync = STDOUT.sync
|
10
|
-
begin
|
11
|
-
with_echo do
|
12
|
-
STDOUT.sync = true
|
13
|
-
print(prompt)
|
14
|
-
STDIN.gets.chomp
|
15
|
-
end
|
16
|
-
ensure
|
17
|
-
STDOUT.sync = sync
|
18
|
-
puts
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.prompt(prompt="Password", default=nil)
|
23
|
-
sync = STDOUT.sync
|
24
|
-
begin
|
25
|
-
STDOUT.sync = true
|
26
|
-
print("#{prompt}")
|
27
|
-
print " [#{default}]" if default
|
28
|
-
print ': '
|
29
|
-
response = STDIN.gets.chomp
|
30
|
-
response == '' ? default : response
|
31
|
-
ensure
|
32
|
-
STDOUT.sync = sync
|
33
|
-
puts
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'capistrano'
|
3
|
-
|
4
|
-
module Deprec
|
5
|
-
DEPREC_TEMPLATES_BASE = File.join(File.dirname(__FILE__), '..', 'templates')
|
6
|
-
|
7
|
-
def render_template_to_file(template_name, destination_file_name, templates_dir = DEPREC_TEMPLATES_BASE)
|
8
|
-
template_name += '.conf' if File.extname(template_name) == '' # XXX this to be removed
|
9
|
-
|
10
|
-
file = File.join(templates_dir, template_name)
|
11
|
-
buffer = render :template => File.read(file)
|
12
|
-
|
13
|
-
temporary_location = "/tmp/#{template_name}"
|
14
|
-
put buffer, temporary_location
|
15
|
-
sudo "cp #{temporary_location} #{destination_file_name}"
|
16
|
-
delete temporary_location
|
17
|
-
end
|
18
|
-
|
19
|
-
def append_to_file_if_missing(filename, value, options={})
|
20
|
-
# XXX sort out single quotes in 'value' - they'l break command!
|
21
|
-
# XXX if options[:requires_sudo] and :use_sudo then use sudo
|
22
|
-
sudo <<-END
|
23
|
-
sh -c '
|
24
|
-
grep -F "#{value}" #{filename} > /dev/null 2>&1 ||
|
25
|
-
test ! -f #{filename} ||
|
26
|
-
echo "#{value}" >> #{filename}
|
27
|
-
'
|
28
|
-
END
|
29
|
-
end
|
30
|
-
|
31
|
-
# ##
|
32
|
-
# # Update a users crontab
|
33
|
-
# #
|
34
|
-
# # user: which users crontab should be affected
|
35
|
-
# # entry: the entry as it would appear in the crontab (e.g. '*/15 * * * * sleep 5')
|
36
|
-
# # action: :add or :remove
|
37
|
-
# #
|
38
|
-
# def update_user_crontab(user, entry, action = :add)
|
39
|
-
# # we don't want capistrano exiting if crontab doesn't yet exist
|
40
|
-
# cur_crontab = capture "crontab -u #{user} -l || exit 0"
|
41
|
-
# if cur_crontab.include?(entry)
|
42
|
-
# if action == :remove
|
43
|
-
# sudo "crontab -u #{user} -l | grep -v #{entry} | sudo crontab -u #{user} -"
|
44
|
-
# end
|
45
|
-
# else
|
46
|
-
# if action == :add
|
47
|
-
# new_crontab = cur_crontab.chomp + entry
|
48
|
-
# puts new_crontab
|
49
|
-
# sudo "echo '#{new_crontab}' | sudo crontab -u #{user} -"
|
50
|
-
# end
|
51
|
-
# end
|
52
|
-
# end
|
53
|
-
|
54
|
-
|
55
|
-
# create new user account on target system
|
56
|
-
def useradd(user, options={})
|
57
|
-
options[:shell] ||= '/bin/bash' # new accounts on ubuntu 6.06.1 have been getting /bin/sh
|
58
|
-
switches = ''
|
59
|
-
switches += " --shell=#{options[:shell]} " if options[:shell]
|
60
|
-
switches += ' --create-home ' unless options[:homedir] == false
|
61
|
-
switches += " --gid #{options[:group]} " unless options[:group].nil?
|
62
|
-
send(run_method, "grep '^#{user}:' /etc/passwd || sudo /usr/sbin/useradd #{switches} #{user}")
|
63
|
-
end
|
64
|
-
|
65
|
-
# create a new group on target system
|
66
|
-
def groupadd(group)
|
67
|
-
# XXX I don't like specifying the path to groupadd - need to sort out paths before long
|
68
|
-
send(run_method, "grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}")
|
69
|
-
end
|
70
|
-
|
71
|
-
# add group to the list of groups this user belongs to
|
72
|
-
def add_user_to_group(user, group)
|
73
|
-
send(run_method, "groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}")
|
74
|
-
end
|
75
|
-
|
76
|
-
# create directory if it doesn't already exist
|
77
|
-
# set permissions and ownership
|
78
|
-
# XXX move mode, path and
|
79
|
-
def mkdir(path, options={})
|
80
|
-
options[:mode] ||= '0755'
|
81
|
-
sudo "test -d #{path} || sudo mkdir -p -m#{options[:mode]} #{path}"
|
82
|
-
sudo "chgrp -R #{options[:group]} #{path}" if options[:group]
|
83
|
-
sudo "chown -R #{user} #{path}" if options[:user]
|
84
|
-
end
|
85
|
-
|
86
|
-
|
87
|
-
# download source package if we don't already have it
|
88
|
-
def download_src(src_package, src_dir)
|
89
|
-
deprec.groupadd(group)
|
90
|
-
sudo "test -d #{src_dir} || sudo mkdir #{src_dir}"
|
91
|
-
sudo "chgrp -R #{group} #{src_dir}"
|
92
|
-
sudo "chmod -R g+w #{src_dir}"
|
93
|
-
# XXX check if file exists and if we have and MD5 hash or bytecount to compare against
|
94
|
-
# XXX if so, compare and decide if we need to download again
|
95
|
-
if defined?(src_package[:md5sum])
|
96
|
-
md5_clause = " && echo '#{src_package[:md5sum]}' | md5sum -c - "
|
97
|
-
end
|
98
|
-
sudo <<-SUDO
|
99
|
-
sh -c "cd #{src_dir} && test -f #{src_package[:file]} #{md5_clause} || wget --timestamping #{src_package[:url]}"
|
100
|
-
SUDO
|
101
|
-
end
|
102
|
-
|
103
|
-
# unpack src and make it writable by the group
|
104
|
-
def unpack_src(src_package, src_dir)
|
105
|
-
package_dir = File.join(src_dir, src_package[:dir])
|
106
|
-
sudo <<-SUDO
|
107
|
-
sh -c '
|
108
|
-
cd #{src_dir};
|
109
|
-
test -d #{package_dir}.old && rm -fr #{package_dir}.old;
|
110
|
-
test -d #{package_dir} && mv #{package_dir} #{package_dir}.old;
|
111
|
-
#{src_package[:unpack]}
|
112
|
-
chgrp -R #{group} #{package_dir};
|
113
|
-
chmod -R g+w #{package_dir};
|
114
|
-
'
|
115
|
-
SUDO
|
116
|
-
end
|
117
|
-
|
118
|
-
# install package from source
|
119
|
-
def install_from_src(src_package, src_dir)
|
120
|
-
package_dir = File.join(src_dir, src_package[:dir])
|
121
|
-
unpack_src(src_package, src_dir)
|
122
|
-
apt.install( {:base => %w(build-essential)}, :stable )
|
123
|
-
sudo <<-SUDO
|
124
|
-
sh -c '
|
125
|
-
cd #{package_dir};
|
126
|
-
#{src_package[:configure]}
|
127
|
-
#{src_package[:make]}
|
128
|
-
#{src_package[:install]}
|
129
|
-
#{src_package[:post_install]}
|
130
|
-
'
|
131
|
-
SUDO
|
132
|
-
end
|
133
|
-
|
134
|
-
|
135
|
-
end
|
136
|
-
|
137
|
-
Capistrano.plugin :deprec, Deprec
|
@@ -1,11 +0,0 @@
|
|
1
|
-
NAME
|
2
|
-
deprec - creates configuration and Capistrano tasks for server configuration.
|
3
|
-
|
4
|
-
SYNOPSIS
|
5
|
-
deprec --apply-to /path/to/app --name application_name --domain domain_name
|
6
|
-
|
7
|
-
DESCRIPTION
|
8
|
-
This generator creates deployment recipes.
|
9
|
-
|
10
|
-
EXAMPLE
|
11
|
-
deprec --apply-to . --name bailey --domain www.bailey.net.au
|
@@ -1,24 +0,0 @@
|
|
1
|
-
class DeprecGenerator < Rails::Generator::NamedBase
|
2
|
-
attr_reader :application_name
|
3
|
-
attr_reader :domain_name
|
4
|
-
|
5
|
-
def initialize(runtime_args, runtime_options = {})
|
6
|
-
super
|
7
|
-
@application_name = self.file_name
|
8
|
-
@domain_name = @args[0]
|
9
|
-
end
|
10
|
-
|
11
|
-
def manifest
|
12
|
-
record do |m|
|
13
|
-
m.directory "config"
|
14
|
-
m.template "deploy.rb", File.join("config", "deploy.rb")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
protected
|
19
|
-
|
20
|
-
# Override with your own usage banner.
|
21
|
-
def banner
|
22
|
-
"Usage: #{$0} --apply-to /path/to/app --name ApplicationName --domain DomainName"
|
23
|
-
end
|
24
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'deprec/recipes'
|
2
|
-
|
3
|
-
# =============================================================================
|
4
|
-
# ROLES
|
5
|
-
# =============================================================================
|
6
|
-
# You can define any number of roles, each of which contains any number of
|
7
|
-
# machines. Roles might include such things as :web, or :app, or :db, defining
|
8
|
-
# what the purpose of each machine is. You can also specify options that can
|
9
|
-
# be used to single out a specific subset of boxes in a particular role, like
|
10
|
-
# :primary => true.
|
11
|
-
|
12
|
-
set :domain, "<%= domain_name %>"
|
13
|
-
role :web, domain
|
14
|
-
role :app, domain
|
15
|
-
role :db, domain, :primary => true
|
16
|
-
role :scm, domain
|
17
|
-
|
18
|
-
# =============================================================================
|
19
|
-
# REQUIRED VARIABLES
|
20
|
-
# =============================================================================
|
21
|
-
# You must always specify the application and repository for every recipe. The
|
22
|
-
# repository must be the URL of the repository you want this recipe to
|
23
|
-
# correspond to. The deploy_to path must be the path on each machine that will
|
24
|
-
# form the root of the application path.
|
25
|
-
|
26
|
-
set :application, "<%= singular_name %>"
|
27
|
-
set :deploy_to, "/var/www/apps/#{application}"
|
28
|
-
|
29
|
-
# XXX we may not need this - it doesn't work on windows
|
30
|
-
# XXX set :user, ENV['USER']
|
31
|
-
set :repository, "svn+ssh://#{user}@#{domain}#{deploy_to}/repos/trunk"
|
32
|
-
set :rails_env, "production"
|
33
|
-
|
34
|
-
# Automatically symlink these directories from current/public to shared/public.
|
35
|
-
# set :app_symlinks, %w{photo, document, asset}
|
36
|
-
|
37
|
-
# =============================================================================
|
38
|
-
# SPECIAL OPTIONS
|
39
|
-
# =============================================================================
|
40
|
-
# These options allow you to tweak deprec behaviour
|
41
|
-
|
42
|
-
# If you do not keep database.yml in source control, set this to false.
|
43
|
-
# After new code is deployed, deprec will symlink current/config/database.yml
|
44
|
-
# to shared/config/database.yml
|
45
|
-
#
|
46
|
-
# You can generate shared/config/database.yml with 'cap generate_database_yml'
|
47
|
-
#
|
48
|
-
# set :database_yml_in_scm, true
|
49
|
-
|
50
|
-
# =============================================================================
|
51
|
-
# APACHE OPTIONS
|
52
|
-
# =============================================================================
|
53
|
-
set :apache_server_name, domain
|
54
|
-
# set :apache_server_aliases, %w{alias1 alias2}
|
55
|
-
# set :apache_default_vhost, true # force use of apache_default_vhost_config
|
56
|
-
# set :apache_default_vhost_conf, "/usr/local/apache2/conf/default.conf"
|
57
|
-
# set :apache_conf, "/usr/local/apache2/conf/apps/#{application}.conf"
|
58
|
-
# set :apache_ctl, "/etc/init.d/httpd"
|
59
|
-
# set :apache_proxy_port, 8000
|
60
|
-
# set :apache_proxy_servers, 2
|
61
|
-
# set :apache_proxy_address, "127.0.0.1"
|
62
|
-
# set :apache_ssl_enabled, false
|
63
|
-
# set :apache_ssl_ip, "127.0.0.1"
|
64
|
-
# set :apache_ssl_forward_all, false
|
65
|
-
# set :apache_ssl_chainfile, false
|
66
|
-
|
67
|
-
|
68
|
-
# =============================================================================
|
69
|
-
# MONGREL OPTIONS
|
70
|
-
# =============================================================================
|
71
|
-
# set :mongrel_servers, apache_proxy_servers
|
72
|
-
# set :mongrel_port, apache_proxy_port
|
73
|
-
set :mongrel_address, apache_proxy_address
|
74
|
-
# set :mongrel_environment, "production"
|
75
|
-
# set :mongrel_config, "/etc/mongrel_cluster/#{application}.conf"
|
76
|
-
# set :mongrel_user_prefix, 'mongrel_'
|
77
|
-
# set :mongrel_user, mongrel_user_prefix + application
|
78
|
-
# set :mongrel_group_prefix, 'app_'
|
79
|
-
# set :mongrel_group, mongrel_group_prefix + application
|
80
|
-
|
81
|
-
# =============================================================================
|
82
|
-
# MYSQL OPTIONS
|
83
|
-
# =============================================================================
|
84
|
-
|
85
|
-
|
86
|
-
# =============================================================================
|
87
|
-
# SSH OPTIONS
|
88
|
-
# =============================================================================
|
89
|
-
# ssh_options[:keys] = %w(/path/to/my/key /path/to/another/key)
|
90
|
-
# ssh_options[:port] = 25
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Deprec
|
2
|
-
module Generators
|
3
|
-
class RailsLoader
|
4
|
-
def self.load!(options)
|
5
|
-
require "#{options[:apply_to]}/config/environment"
|
6
|
-
require "rails_generator"
|
7
|
-
require "rails_generator/scripts/generate"
|
8
|
-
|
9
|
-
Rails::Generator::Base.sources << Rails::Generator::PathSource.new(
|
10
|
-
:deprec, File.dirname(__FILE__))
|
11
|
-
|
12
|
-
args = ["deprec"]
|
13
|
-
args << (options[:application] || "Application")
|
14
|
-
args << (options[:domain] || "www.mynewsite.com")
|
15
|
-
|
16
|
-
Rails::Generator::Scripts::Generate.new.run(args)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
Capistrano.configuration(:must_exist).load do
|
2
|
-
|
3
|
-
task :install_apache do # deprecated
|
4
|
-
apache_install
|
5
|
-
end
|
6
|
-
|
7
|
-
task :apache_install do
|
8
|
-
version = 'httpd-2.2.6'
|
9
|
-
set :src_package, {
|
10
|
-
:file => version + '.tar.gz',
|
11
|
-
:md5sum => 'd050a49bd7532ec21c6bb593b3473a5d httpd-2.2.6.tar.gz',
|
12
|
-
:dir => version,
|
13
|
-
:url => "http://www.apache.org/dist/httpd/#{version}.tar.gz",
|
14
|
-
:unpack => "tar zxf #{version}.tar.gz;",
|
15
|
-
:configure => %w(
|
16
|
-
./configure
|
17
|
-
--enable-mods-shared=all
|
18
|
-
--enable-proxy
|
19
|
-
--enable-proxy-balancer
|
20
|
-
--enable-proxy-http
|
21
|
-
--enable-rewrite
|
22
|
-
--enable-cache
|
23
|
-
--enable-headers
|
24
|
-
--enable-ssl
|
25
|
-
--enable-deflate
|
26
|
-
--with-included-apr #_so_this_recipe_doesn't_break_when_rerun
|
27
|
-
--enable-dav #_for_subversion_
|
28
|
-
--enable-so #_for_subversion_
|
29
|
-
;
|
30
|
-
).reject{|arg| arg.match '#'}.join(' '),
|
31
|
-
:make => 'make;',
|
32
|
-
:install => 'make install;',
|
33
|
-
:post_install => 'install -b support/apachectl /etc/init.d/httpd;'
|
34
|
-
}
|
35
|
-
apt.install( {:base => %w(zlib1g-dev zlib1g openssl libssl-dev)}, :stable )
|
36
|
-
deprec.download_src(src_package, src_dir)
|
37
|
-
deprec.install_from_src(src_package, src_dir)
|
38
|
-
# ubuntu specific - should instead call generic name which can be picked up by different distros
|
39
|
-
send(run_method, "update-rc.d httpd defaults")
|
40
|
-
end
|
41
|
-
|
42
|
-
task :install_php do # deprecated
|
43
|
-
php_install
|
44
|
-
end
|
45
|
-
|
46
|
-
desc "Install PHP from source"
|
47
|
-
task :php_install do
|
48
|
-
version = 'php-5.2.2'
|
49
|
-
set :src_package, {
|
50
|
-
:file => version + '.tar.gz',
|
51
|
-
:md5sum => '7a920d0096900b2b962b21dc5c55fe3c php-5.2.2.tar.gz',
|
52
|
-
:dir => version,
|
53
|
-
:url => "http://www.php.net/distributions/#{version}.tar.gz",
|
54
|
-
:unpack => "tar zxf #{version}.tar.gz;",
|
55
|
-
:configure => %w(
|
56
|
-
./configure
|
57
|
-
--prefix=/usr/local/php
|
58
|
-
--with-apxs2=/usr/local/apache2/bin/apxs
|
59
|
-
--disable-ipv6
|
60
|
-
--enable-sockets
|
61
|
-
--enable-soap
|
62
|
-
--with-pcre-regex
|
63
|
-
--with-mysql
|
64
|
-
--with-zlib
|
65
|
-
--with-gettext
|
66
|
-
--with-sqlite
|
67
|
-
--enable-sqlite-utf8
|
68
|
-
--with-openssl
|
69
|
-
--with-mcrypt
|
70
|
-
--with-ncurses
|
71
|
-
--with-jpeg-dir=/usr
|
72
|
-
--with-gd
|
73
|
-
--with-ctype
|
74
|
-
--enable-mbstring
|
75
|
-
--with-curl==/usr/lib
|
76
|
-
;
|
77
|
-
).reject{|arg| arg.match '#'}.join(' '),
|
78
|
-
:make => 'make;',
|
79
|
-
:install => 'make install;',
|
80
|
-
:post_install => ""
|
81
|
-
}
|
82
|
-
apt.install( {:base => %w(zlib1g-dev zlib1g openssl libssl-dev
|
83
|
-
flex libcurl3 libcurl3-dev libmcrypt-dev libmysqlclient15-dev libncurses5-dev
|
84
|
-
libxml2-dev libjpeg62-dev libpng12-dev)}, :stable )
|
85
|
-
run "export CFLAGS=-O2;"
|
86
|
-
deprec.download_src(src_package, src_dir)
|
87
|
-
deprec.install_from_src(src_package, src_dir)
|
88
|
-
deprec.append_to_file_if_missing('/usr/local/apache2/conf/httpd.conf', 'AddType application/x-httpd-php .php')
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
|
2
|
-
##
|
3
|
-
# Caches an svn copy of your app locally to avoid doing a full checkout of
|
4
|
-
# your app each time. Overwrites the built-in +update_code+ task.
|
5
|
-
#
|
6
|
-
# Written/pulled together by Dreamer3 (Josh Goebel) based on work by Chris McGrath (octopod).
|
7
|
-
# Minor tweaks by Geoffrey Grosenbach (topfunky).
|
8
|
-
#
|
9
|
-
# Usage:
|
10
|
-
#
|
11
|
-
# # In deploy.rb
|
12
|
-
# require 'deprec/recipes/cache_svn'
|
13
|
-
#
|
14
|
-
# set :repository, "svn://your.repository/path/here"
|
15
|
-
# set :repository_cache, "#{shared_path}/svn_trunk/"
|
16
|
-
#
|
17
|
-
# After running the default +setup+ task, run +setup_repository_cache+ to
|
18
|
-
# do the first checkout of your app.
|
19
|
-
#
|
20
|
-
# cap setup_repository_cache
|
21
|
-
#
|
22
|
-
# After that, the normal +deploy+ will update the cached copy, rsync
|
23
|
-
# it to the releases directory, and symlink it to +current+, as usual.
|
24
|
-
|
25
|
-
##
|
26
|
-
# Expand the subversion class to support cached repositories
|
27
|
-
class Capistrano::SCM::Subversion
|
28
|
-
|
29
|
-
def setup_repository_cache(actor)
|
30
|
-
params = ""
|
31
|
-
params << "--username #{configuration[:svn_username]}" if configuration[:svn_username]
|
32
|
-
command = "#{svn} co -q #{params} #{configuration[:repository]} #{configuration[:repository_cache]} &&"
|
33
|
-
configuration.logger.debug "Caching SVN repository on remote servers..."
|
34
|
-
run_checkout(actor, command, &svn_stream_handler(actor))
|
35
|
-
end
|
36
|
-
|
37
|
-
def update_repository_cache(actor)
|
38
|
-
command = "#{svn} up -q #{configuration[:repository_cache]} &&"
|
39
|
-
run_update(actor, command, &svn_stream_handler(actor))
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
Capistrano.configuration(:must_exist).load do
|
45
|
-
|
46
|
-
desc <<-DESC
|
47
|
-
Setup the cached repository on the server for the first time and
|
48
|
-
checkout the latest version there.
|
49
|
-
DESC
|
50
|
-
task :setup_cached_repository, :roles => [:app, :db, :web] do
|
51
|
-
set :revision, "Initial setup checkout" # avoids capistrano trying to find out for us
|
52
|
-
run "mkdir -p #{repository_cache}"
|
53
|
-
source.setup_repository_cache(self)
|
54
|
-
end
|
55
|
-
|
56
|
-
desc <<-DESC
|
57
|
-
Update the cached repository and then your app (from the cache) via SVN.
|
58
|
-
DESC
|
59
|
-
task :update_code, :roles => [:app, :db, :web] do
|
60
|
-
source.update_repository_cache(self)
|
61
|
-
|
62
|
-
on_rollback { delete release_path, :recursive => true }
|
63
|
-
|
64
|
-
run %(rsync -ax --exclude=".svn" #{repository_cache} #{release_path}/)
|
65
|
-
|
66
|
-
run <<-CMD
|
67
|
-
rm -rf #{release_path}/log #{release_path}/public/system &&
|
68
|
-
ln -nfs #{shared_path}/log #{release_path}/log &&
|
69
|
-
ln -nfs #{shared_path}/system #{release_path}/public/system
|
70
|
-
CMD
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|