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
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
|
4
|
+
namespace :deprec do
|
5
|
+
namespace :mri do
|
6
|
+
|
7
|
+
SRC_PACKAGES[:mri] = {
|
8
|
+
:md5sum => "5e5b7189674b3a7f69401284f6a7a36d ruby-1.8.7-p72.tar.gz",
|
9
|
+
:url => "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz",
|
10
|
+
:configure => "./configure --with-readline-dir=/usr/local;"
|
11
|
+
}
|
12
|
+
|
13
|
+
desc "Install Ruby"
|
14
|
+
task :install do
|
15
|
+
install_deps
|
16
|
+
deprec2.download_src(SRC_PACKAGES[:mri], src_dir)
|
17
|
+
deprec2.install_from_src(SRC_PACKAGES[:mri], src_dir)
|
18
|
+
top.deprec.rubygems.install
|
19
|
+
end
|
20
|
+
|
21
|
+
task :install_deps do
|
22
|
+
apt.install( {:base => %w(zlib1g-dev libssl-dev libncurses5-dev libreadline5-dev)}, :stable )
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
namespace :deprec do
|
30
|
+
namespace :rubygems do
|
31
|
+
|
32
|
+
SRC_PACKAGES[:rubygems] = {
|
33
|
+
:md5sum => "a04ee6f6897077c5b75f5fd1e134c5a9 rubygems-1.3.1.tgz",
|
34
|
+
:url => "http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz",
|
35
|
+
:configure => "",
|
36
|
+
:make => "",
|
37
|
+
:install => 'ruby setup.rb;'
|
38
|
+
}
|
39
|
+
|
40
|
+
desc "Install Rubygems"
|
41
|
+
task :install do
|
42
|
+
install_deps
|
43
|
+
deprec2.download_src(SRC_PACKAGES[:rubygems], src_dir)
|
44
|
+
deprec2.install_from_src(SRC_PACKAGES[:rubygems], src_dir)
|
45
|
+
# gem2.upgrade # you may not want to upgrade your gems right now
|
46
|
+
end
|
47
|
+
|
48
|
+
# install dependencies for rubygems
|
49
|
+
task :install_deps do
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :ree do
|
5
|
+
|
6
|
+
set :ree_version, 'ruby-enterprise-1.8.6-20090113'
|
7
|
+
set :ree_install_dir, "/opt/#{ree_version}"
|
8
|
+
set :ree_short_path, '/opt/ruby-enterprise'
|
9
|
+
|
10
|
+
SRC_PACKAGES[:ree] = {
|
11
|
+
:md5sum => "e8d796a5bae0ec1029a88ba95c5d901d #{ree_version}.tar.gz",
|
12
|
+
:url => "http://rubyforge.org/frs/download.php/50087/#{ree_version}.tar.gz",
|
13
|
+
:configure => '',
|
14
|
+
:make => '',
|
15
|
+
:install => "./installer --auto /opt/#{ree_version}"
|
16
|
+
}
|
17
|
+
|
18
|
+
task :install do
|
19
|
+
install_deps
|
20
|
+
deprec2.download_src(SRC_PACKAGES[:ree], src_dir)
|
21
|
+
deprec2.install_from_src(SRC_PACKAGES[:ree], src_dir)
|
22
|
+
symlink_ree
|
23
|
+
end
|
24
|
+
|
25
|
+
task :install_deps do
|
26
|
+
apt.install({:base => %w(libssl-dev libmysqlclient15-dev libreadline5-dev)}, :stable)
|
27
|
+
end
|
28
|
+
|
29
|
+
task :symlink_ree do
|
30
|
+
sudo "ln -sf /opt/#{ree_version} #{ree_short_path}"
|
31
|
+
sudo "ln -fs #{ree_short_path}/bin/gem /usr/local/bin/gem"
|
32
|
+
sudo "ln -fs #{ree_short_path}/bin/irb /usr/local/bin/irb"
|
33
|
+
sudo "ln -fs #{ree_short_path}/bin/rake /usr/local/bin/rake"
|
34
|
+
sudo "ln -fs #{ree_short_path}/bin/rails /usr/local/bin/rails"
|
35
|
+
sudo "ln -fs #{ree_short_path}/bin/ruby /usr/local/bin/ruby"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec 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
|
+
;
|
14
|
+
).reject{|arg| arg.match '#'}.join(' '),
|
15
|
+
:make => 'make;',
|
16
|
+
:install => 'make install;'
|
17
|
+
}
|
18
|
+
|
19
|
+
desc "install Sphinx Search Engine"
|
20
|
+
task :install do
|
21
|
+
deprec2.download_src(SRC_PACKAGES[:sphinx], src_dir)
|
22
|
+
deprec2.install_from_src(SRC_PACKAGES[:sphinx], src_dir)
|
23
|
+
end
|
24
|
+
|
25
|
+
# install dependencies for sphinx
|
26
|
+
task :install_deps do
|
27
|
+
# apt.install( {:base => %w(blah)}, :stable )
|
28
|
+
end
|
29
|
+
|
30
|
+
SYSTEM_CONFIG_FILES[:sphinx] = []
|
31
|
+
|
32
|
+
PROJECT_CONFIG_FILES[:sphinx] = [
|
33
|
+
|
34
|
+
{:template => 'monit.conf.erb',
|
35
|
+
:path => 'monit.conf',
|
36
|
+
:mode => 0644,
|
37
|
+
:owner => 'root:root'}
|
38
|
+
|
39
|
+
]
|
40
|
+
|
41
|
+
desc <<-DESC
|
42
|
+
Generate sphinx config from template. Note that this does not
|
43
|
+
push the config to the server, it merely generates required
|
44
|
+
configuration files. These should be kept under source control.
|
45
|
+
The can be pushed to the server with the :config task.
|
46
|
+
DESC
|
47
|
+
task :config_gen do
|
48
|
+
PROJECT_CONFIG_FILES[:sphinx].each do |file|
|
49
|
+
deprec2.render_template(:sphinx, file)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Push sphinx config files to server"
|
54
|
+
task :config, :roles => :sphinx do
|
55
|
+
config_project
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Push sphinx config files to server"
|
59
|
+
task :config_project, :roles => :sphinx do
|
60
|
+
deprec2.push_configs(:sphinx, PROJECT_CONFIG_FILES[:sphinx])
|
61
|
+
symlink_monit_config
|
62
|
+
end
|
63
|
+
|
64
|
+
task :symlink_monit_config, :roles => :sphinx do
|
65
|
+
sudo "ln -sf #{deploy_to}/sphinx/monit.conf #{monit_confd_dir}/sphinx_#{application}.conf"
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# Control
|
70
|
+
|
71
|
+
desc "Restart the sphinx searchd daemon"
|
72
|
+
task :restart, :roles => :app do
|
73
|
+
run("cd #{deploy_to}/current; /usr/bin/rake us:start") ### start or restart? SUDO ? ###
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "Regenerate / Rotate the search index."
|
77
|
+
task :reindex, :roles => :app do
|
78
|
+
run("cd #{deploy_to}/current; /usr/bin/rake us:in") ### SUDO ? ###
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# ultrasphinx deployment notes
|
86
|
+
# http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/DEPLOYMENT_NOTES.html
|
data/lib/deprec/recipes/ssh.rb
CHANGED
@@ -1,26 +1,93 @@
|
|
1
|
-
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :ssh do
|
5
|
+
|
6
|
+
SYSTEM_CONFIG_FILES[:ssh] = [
|
7
|
+
|
8
|
+
{:template => "sshd_config.erb",
|
9
|
+
:path => '/etc/ssh/sshd_config',
|
10
|
+
:mode => 0644,
|
11
|
+
:owner => 'root:root'},
|
12
|
+
|
13
|
+
{:template => "ssh_config.erb",
|
14
|
+
:path => '/etc/ssh/ssh_config',
|
15
|
+
:mode => 0644,
|
16
|
+
:owner => 'root:root'}
|
17
|
+
]
|
18
|
+
|
19
|
+
task :config_gen do
|
20
|
+
SYSTEM_CONFIG_FILES[:ssh].each do |file|
|
21
|
+
deprec2.render_template(:ssh, file)
|
22
|
+
end
|
23
|
+
auth_keys_dir = 'config/ssh/authorized_keys'
|
24
|
+
if ! File.directory?(auth_keys_dir)
|
25
|
+
puts "Creating #{auth_keys_dir}"
|
26
|
+
Dir.mkdir(auth_keys_dir)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Push ssh config files to server"
|
31
|
+
task :config do
|
32
|
+
deprec2.push_configs(:ssh, SYSTEM_CONFIG_FILES[:ssh])
|
33
|
+
restart
|
34
|
+
end
|
2
35
|
|
3
|
-
|
4
|
-
|
5
|
-
|
36
|
+
desc "Start ssh"
|
37
|
+
task :start do
|
38
|
+
send(run_method, "/etc/init.d/ssh reload")
|
39
|
+
end
|
6
40
|
|
7
|
-
|
8
|
-
|
41
|
+
desc "Stop ssh"
|
42
|
+
task :stop do
|
43
|
+
send(run_method, "/etc/init.d/ssh reload")
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Restart ssh"
|
47
|
+
task :restart do
|
48
|
+
send(run_method, "/etc/init.d/ssh restart")
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Reload ssh"
|
52
|
+
task :reload do
|
53
|
+
send(run_method, "/etc/init.d/ssh reload")
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "Sets up authorized_keys file on remote server"
|
57
|
+
task :setup_keys do
|
58
|
+
|
59
|
+
default(:target_user) {
|
60
|
+
Capistrano::CLI.ui.ask "Setup keys for which user?" do |q|
|
61
|
+
q.default = user
|
62
|
+
end
|
63
|
+
}
|
64
|
+
|
65
|
+
if target_user == user
|
66
|
+
|
67
|
+
unless ssh_options[:keys]
|
68
|
+
puts <<-ERROR
|
9
69
|
|
10
|
-
|
11
|
-
|
70
|
+
You need to define the name of your SSH key(s)
|
71
|
+
e.g. ssh_options[:keys] = %w(/Users/your_username/.ssh/id_rsa)
|
12
72
|
|
13
|
-
|
73
|
+
You can put this in your .caprc file in your home directory.
|
14
74
|
|
15
|
-
|
16
|
-
|
75
|
+
ERROR
|
76
|
+
exit
|
77
|
+
end
|
78
|
+
|
79
|
+
deprec2.mkdir '.ssh', :mode => 0700
|
80
|
+
put(ssh_options[:keys].collect{|key| File.read(key+'.pub')}.join("\n"), '.ssh/authorized_keys', :mode => 0600 )
|
81
|
+
|
82
|
+
else
|
83
|
+
|
84
|
+
deprec2.mkdir "/home/#{target_user}/.ssh", :mode => 0700, :owner => "#{target_user}.users", :via => :sudo
|
85
|
+
std.su_put File.read("config/ssh/authorized_keys/#{target_user}"), "/home/#{target_user}/.ssh/authorized_keys", '/tmp/', :mode => 0600
|
86
|
+
sudo "chown #{target_user}.users /home/#{target_user}/.ssh/authorized_keys"
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
17
91
|
end
|
18
|
-
|
19
|
-
sudo "test -d ~/.ssh || mkdir ~/.ssh"
|
20
|
-
sudo "chmod 0700 ~/.ssh"
|
21
|
-
put(ssh_options[:keys].collect{|key| File.read(key+'.pub')}.join("\n"),
|
22
|
-
File.join('/home', user, '.ssh/authorized_keys'),
|
23
|
-
:mode => 0600 )
|
24
92
|
end
|
25
|
-
|
26
93
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :ssl do
|
5
|
+
|
6
|
+
# Install Openssl
|
7
|
+
task :install, :roles => :web do
|
8
|
+
install_deps
|
9
|
+
end
|
10
|
+
|
11
|
+
# Install dependencies for ssl
|
12
|
+
task :install_deps, :roles => :web do
|
13
|
+
apt.install( {:base => %w(openssl)}, :stable )
|
14
|
+
end
|
15
|
+
|
16
|
+
PROJECT_CONFIG_FILES[:ssl] = [
|
17
|
+
|
18
|
+
{:template => 'ssl-cert-snakeoil.pem',
|
19
|
+
:path => '/etc/ssl/certs/ssl-cert-snakeoil.pem',
|
20
|
+
:mode => 0644,
|
21
|
+
:owner => 'root:root'},
|
22
|
+
|
23
|
+
{:template => 'ssl-cert-snakeoil.key',
|
24
|
+
:path => "/etc/ssl/private/ssl-cert-snakeoil.key",
|
25
|
+
:mode => 0640,
|
26
|
+
:owner => 'root:ssl-cert'},
|
27
|
+
|
28
|
+
{ :template => 'make-ssl-cert',
|
29
|
+
:path => "/usr/sbin/make-ssl-cert",
|
30
|
+
:mode => 0755,
|
31
|
+
:owner => 'root:root'}
|
32
|
+
|
33
|
+
]
|
34
|
+
|
35
|
+
# Generate ssl certs
|
36
|
+
task :config_gen do
|
37
|
+
PROJECT_CONFIG_FILES[:ssl].each do |file|
|
38
|
+
deprec2.render_template(:ssl, file)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Copy out ssl certs
|
43
|
+
task :config, :roles => :web do
|
44
|
+
deprec2.push_configs(:ssl, PROJECT_CONFIG_FILES[:ssl])
|
45
|
+
end
|
46
|
+
|
47
|
+
task :generate_snakeoil_cert, :roles => :web do
|
48
|
+
sudo "/usr/sbin/make-ssl-cert generate-default-snakeoil"
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# Deprec script to install the Starling Messaging Server
|
2
|
+
# This uses the forked copy located at http://github.com/starling/starling instead of the original gem
|
3
|
+
# The start/stop/restart tasks are based on code used in the 'starling.ubuntu' script which is contained in the Starling repository.
|
4
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
namespace :deprec do
|
6
|
+
namespace :starling do
|
7
|
+
set :starling_port, 15151
|
8
|
+
set :starling_address, "127.0.0.1"
|
9
|
+
set :starling_user, "starling"
|
10
|
+
set :starling_group, "starling"
|
11
|
+
set :starling_spool_dir, "/var/spool/starling"
|
12
|
+
set :starling_run_dir, "/var/run/starling"
|
13
|
+
set :starling_log_dir, "/var/log/starling"
|
14
|
+
set :starling_runtime_options, "-h #{starling_address} -p #{starling_port} -d -q #{starling_spool_dir} -P #{starling_spool_dir}/starling.pid -L #{starling_log_dir}/starling.log"
|
15
|
+
|
16
|
+
# Installation
|
17
|
+
desc "Installs the Starling gem"
|
18
|
+
task :install, :roles => :app do
|
19
|
+
sudo("gem install eventmachine --no-rdoc --no-ri")
|
20
|
+
sudo("gem install starling-starling --source http://gems.github.com -v 0.9.9 --no-rdoc --no-ri")
|
21
|
+
|
22
|
+
deprec2.mkdir(starling_spool_dir, :via => :sudo)
|
23
|
+
deprec2.mkdir(starling_run_dir, :via => :sudo)
|
24
|
+
deprec2.mkdir(starling_log_dir, :via => :sudo)
|
25
|
+
|
26
|
+
create_starling_user_and_group
|
27
|
+
set_perms_for_starling_dirs
|
28
|
+
symlink_starling_for_rubyee if ruby_vm_type == :ree
|
29
|
+
|
30
|
+
SYSTEM_CONFIG_FILES[:starling].each do |file|
|
31
|
+
deprec2.render_template(:starling, file.merge(:remote=>true))
|
32
|
+
end
|
33
|
+
|
34
|
+
activate
|
35
|
+
end
|
36
|
+
|
37
|
+
# Configure
|
38
|
+
|
39
|
+
SYSTEM_CONFIG_FILES[:starling] = [
|
40
|
+
{:template => 'starling-init-script.erb',
|
41
|
+
:path => '/etc/init.d/starling',
|
42
|
+
:mode => 0755,
|
43
|
+
:owner => 'root:root'},
|
44
|
+
|
45
|
+
{:template => 'monit.conf.erb',
|
46
|
+
:path => "/etc/monit.d/monit_starling.conf",
|
47
|
+
:mode => 0600,
|
48
|
+
:owner => 'root:root'}
|
49
|
+
]
|
50
|
+
|
51
|
+
# Generating Configuration Files
|
52
|
+
desc "Generate configuration file(s) for Starling from template(s)"
|
53
|
+
task :config_gen do
|
54
|
+
SYSTEM_CONFIG_FILES[:starling].each do |file|
|
55
|
+
deprec2.render_template(:starling, file)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
desc 'Deploy configuration files(s) for Starling'
|
60
|
+
task :config, :roles => :app do
|
61
|
+
deprec2.push_configs(:starling, SYSTEM_CONFIG_FILES[:starling])
|
62
|
+
end
|
63
|
+
|
64
|
+
# Control
|
65
|
+
|
66
|
+
desc "Starts the Starling server"
|
67
|
+
task :start, :roles => :app do
|
68
|
+
send(run_method, "start-stop-daemon -c #{starling_user}:#{starling_group} --start --quiet --pidfile #{starling_run_dir}/starling.pid --exec /usr/local/bin/starling -- #{starling_runtime_options}")
|
69
|
+
end
|
70
|
+
|
71
|
+
desc "Stops the Starling server"
|
72
|
+
task :stop, :roles => :app do
|
73
|
+
send(run_method, "start-stop-daemon -c #{starling_user}:#{starling_group} --stop --quiet --pidfile #{starling_run_dir}/starling.pid --exec /usr/local/bin/starling -- #{starling_runtime_options}")
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "Restarts the Starling server"
|
77
|
+
task :restart, :roles => :app do
|
78
|
+
send(run_method, "start-stop-daemon -c #{starling_user}:#{starling_group} --stop --quiet --pidfile #{starling_run_dir}/starling.pid --exec /usr/local/bin/starling -- #{starling_runtime_options}")
|
79
|
+
sleep(2)
|
80
|
+
send(run_method, "start-stop-daemon -c #{starling_user}:#{starling_group} --start --quiet --pidfile #{starling_run_dir}/starling.pid --exec /usr/local/bin/starling -- #{starling_runtime_options}")
|
81
|
+
end
|
82
|
+
|
83
|
+
task :activate, :roles => :app do
|
84
|
+
send(run_method, "update-rc.d starling defaults")
|
85
|
+
end
|
86
|
+
|
87
|
+
task :deactivate, :roles => :app do
|
88
|
+
send(run_method, "update-rc.d -f starling remove")
|
89
|
+
end
|
90
|
+
|
91
|
+
# User/Group creation & permission assignment
|
92
|
+
# These were based off the tasks used in the mongrel recipe -
|
93
|
+
# as this was probably the nicest way to ensure these tasks
|
94
|
+
# were doing the right thing.
|
95
|
+
desc "create user and group for starling to run as"
|
96
|
+
task :create_starling_user_and_group, :roles => :app do
|
97
|
+
deprec2.groupadd(starling_group)
|
98
|
+
deprec2.useradd(starling_user, :group => starling_group, :homedir => false)
|
99
|
+
# Set the primary group for the starling user (in case user already existed
|
100
|
+
# when previous command was run)
|
101
|
+
sudo "usermod --gid #{starling_group} #{starling_user}"
|
102
|
+
end
|
103
|
+
|
104
|
+
desc "set group ownership and permissions on dirs starling needs to write to"
|
105
|
+
task :set_perms_for_starling_dirs, :roles => :app do
|
106
|
+
sudo "chgrp -R #{starling_group} #{starling_spool_dir} #{starling_run_dir} #{starling_log_dir}"
|
107
|
+
sudo "chmod -R g+w #{starling_spool_dir} #{starling_run_dir} #{starling_log_dir}"
|
108
|
+
end
|
109
|
+
|
110
|
+
task :symlink_starling_for_rubyee, :roles => :app do
|
111
|
+
# This ensures we symlink from the REE common directory, NOT the
|
112
|
+
# actual REE install directory (so when we change the REE version,
|
113
|
+
# we don't have to fuddle around again).
|
114
|
+
sudo "ln -s #{ree_short_path}/bin/starling /usr/local/bin/starling"
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|