centostrano 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,71 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
|
|
4
|
+
# deprecated tasks from deprec1
|
|
5
|
+
# we're now using namespaces and some different naming conventions
|
|
6
|
+
|
|
7
|
+
# XXX use deprecated function to generate these dynamically
|
|
8
|
+
|
|
9
|
+
deprec2_isnt_backwards_compatible = <<-EOF
|
|
10
|
+
|
|
11
|
+
You've installed deprec2 but seem to be using a deprec1 command.
|
|
12
|
+
|
|
13
|
+
You have two options:
|
|
14
|
+
|
|
15
|
+
- install deprec-1.9.x and continue using deprec1
|
|
16
|
+
|
|
17
|
+
Instructions are available at http://www.deprec.org/
|
|
18
|
+
|
|
19
|
+
- use deprec2
|
|
20
|
+
|
|
21
|
+
EOF
|
|
22
|
+
|
|
23
|
+
cap2_warning = <<-EOF
|
|
24
|
+
|
|
25
|
+
You're using Capistrano 2 but using a deprecated cap1 command.
|
|
26
|
+
|
|
27
|
+
EOF
|
|
28
|
+
|
|
29
|
+
task :setup_admin_account do
|
|
30
|
+
puts deprec2_isnt_backwards_compatible
|
|
31
|
+
puts " Replace 'cap setup_admin_account' with 'cap deprec:users:add'"
|
|
32
|
+
puts
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
task :change_root_password do
|
|
36
|
+
puts deprec2_isnt_backwards_compatible
|
|
37
|
+
puts " Replace 'cap change_root_password' with 'cap deprec:users:passwd'"
|
|
38
|
+
puts
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
task :setup_ssh_keys do
|
|
42
|
+
puts deprec2_isnt_backwards_compatible
|
|
43
|
+
puts " Replace 'cap setup_ssh_keys' with 'cap deprec:ssh:setup_keys'"
|
|
44
|
+
puts
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
task :install_rails_stack do
|
|
48
|
+
puts deprec2_isnt_backwards_compatible
|
|
49
|
+
puts " Replace 'cap install_rails_stack' with 'cap deprec:rails:install_rails_stack'"
|
|
50
|
+
puts
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
task :setup do
|
|
54
|
+
puts deprec2_isnt_backwards_compatible
|
|
55
|
+
puts " Replace 'cap setup' with 'cap deploy:setup'"
|
|
56
|
+
puts
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
task :restart_apache do
|
|
60
|
+
puts deprec2_isnt_backwards_compatible
|
|
61
|
+
puts " Replace 'cap restart_apache' with 'cap deprec:apache:restart'"
|
|
62
|
+
puts
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
task :show_tasks do
|
|
66
|
+
puts deprec2_isnt_backwards_compatible
|
|
67
|
+
puts " Replace 'cap show-tasks' with 'cap -T'"
|
|
68
|
+
puts
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :deprec do
|
|
4
|
+
namespace :example do
|
|
5
|
+
|
|
6
|
+
SRC_PACKAGES[:example] = {
|
|
7
|
+
:filename => 'example-1.2.3.tar.gz',
|
|
8
|
+
:md5sum => "d050a49bd72222ec21c6bb593b3473a5d example-1.2.3.tar.gz",
|
|
9
|
+
:dir => 'example-1.2.3',
|
|
10
|
+
:url => "http://www.example.org/dist/example/example-1.2.3.tar.gz",
|
|
11
|
+
:unpack => "tar zxf example-1.2.3.tar.gz;",
|
|
12
|
+
:configure => %w(
|
|
13
|
+
./configure
|
|
14
|
+
--enable-mods-shared=all
|
|
15
|
+
--enable-proxy
|
|
16
|
+
;
|
|
17
|
+
).reject{|arg| arg.match '#'}.join(' '),
|
|
18
|
+
:make => 'make;',
|
|
19
|
+
:install => 'make install;',
|
|
20
|
+
:post_install => 'install -b support/apachectl /etc/init.d/httpd;'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
desc "Install example"
|
|
24
|
+
task :install, :roles => :web do
|
|
25
|
+
install_deps
|
|
26
|
+
deprec2.download_src(SRC_PACKAGES[:example], src_dir)
|
|
27
|
+
deprec2.install_from_src(SRC_PACKAGES[:example], src_dir)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
task :install_deps do
|
|
31
|
+
apt.install( {:base => %w(build-essential zlib1g-dev)}, :stable )
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
SYSTEM_CONFIG_FILES[:example] = [
|
|
35
|
+
|
|
36
|
+
{:template => "example.conf.erb",
|
|
37
|
+
:path => '/etc/example/example.conf',
|
|
38
|
+
:mode => 0755,
|
|
39
|
+
:owner => 'root:root'}
|
|
40
|
+
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
PROJECT_CONFIG_FILES[:example] = [
|
|
44
|
+
|
|
45
|
+
{:template => "example.conf.erb",
|
|
46
|
+
:path => 'conf/example.conf',
|
|
47
|
+
:mode => 0755,
|
|
48
|
+
:owner => 'root:root'}
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
desc "Generate configuration file(s) for XXX from template(s)"
|
|
53
|
+
task :config_gen do
|
|
54
|
+
config_gen_system
|
|
55
|
+
config_gen_project
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
task :config_gen_system do
|
|
59
|
+
SYSTEM_CONFIG_FILES[:example].each do |file|
|
|
60
|
+
deprec2.render_template(:example, file)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
task :config_gen_project do
|
|
65
|
+
PROJECT_CONFIG_FILES[:example].each do |file|
|
|
66
|
+
deprec2.render_template(:example, file)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
desc 'Deploy configuration files(s) for XXX'
|
|
71
|
+
task :config, :roles => :web do
|
|
72
|
+
config_system
|
|
73
|
+
config_project
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
task :config_system, :roles => :web do
|
|
77
|
+
deprec2.push_configs(:example, SYSTEM_CONFIG_FILES[:example])
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
task :config_project, :roles => :web do
|
|
81
|
+
deprec2.push_configs(:example, PROJECT_CONFIG_FILES[:example])
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
task :start, :roles => :web do
|
|
86
|
+
send(run_method, "/etc/init.d/example reload")
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
task :stop, :roles => :web do
|
|
90
|
+
send(run_method, "/etc/init.d/example reload")
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
task :restart, :roles => :web do
|
|
94
|
+
send(run_method, "/etc/init.d/example restart")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
task :reload, :roles => :web do
|
|
98
|
+
send(run_method, "/etc/init.d/example reload")
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
task :activate, :roles => :web do
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
task :deactivate, :roles => :web do
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
task :backup, :roles => :web do
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
task :restore, :roles => :web do
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :centos do
|
|
4
|
+
namespace :git do
|
|
5
|
+
|
|
6
|
+
set :git_user, 'git'
|
|
7
|
+
set :git_group, 'git'
|
|
8
|
+
set :git_port, '9418'
|
|
9
|
+
set :git_keys_file, '/home/git/.ssh/authorized_keys'
|
|
10
|
+
set :git_root, '/var/git'
|
|
11
|
+
|
|
12
|
+
=begin
|
|
13
|
+
SRC_PACKAGES[:git] = {
|
|
14
|
+
:filename => 'git-1.5.5.4.tar.gz',
|
|
15
|
+
:md5sum => "8255894042c8a6db07227475b8b4622f git-1.5.5.4.tar.gz",
|
|
16
|
+
:dir => 'git-1.5.5.4',
|
|
17
|
+
:url => "http://kernel.org/pub/software/scm/git/git-1.5.5.4.tar.gz",
|
|
18
|
+
:unpack => "tar zxf git-1.5.5.4.tar.gz;",
|
|
19
|
+
:configure => %w(
|
|
20
|
+
./configure
|
|
21
|
+
;
|
|
22
|
+
).reject{|arg| arg.match '#'}.join(' '),
|
|
23
|
+
:make => 'make;',
|
|
24
|
+
:install => 'make install;'
|
|
25
|
+
}
|
|
26
|
+
=end
|
|
27
|
+
|
|
28
|
+
desc "Install git"
|
|
29
|
+
task :install do
|
|
30
|
+
install_deps
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# install dependencies for git
|
|
34
|
+
task :install_deps do
|
|
35
|
+
yum.enable_repository :epel
|
|
36
|
+
apt.install( {:base => %w(git)}, :stable)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# "Start git server in local directory"
|
|
41
|
+
task :serve do
|
|
42
|
+
cmd = "git-daemon --verbose --port=#{git_port} --base-path=#{Dir.pwd} --base-path-relaxed"
|
|
43
|
+
puts cmd
|
|
44
|
+
`#{cmd}`
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
desc "Create git repos for current dir"
|
|
48
|
+
task :init do
|
|
49
|
+
`git init`
|
|
50
|
+
create_gitignore
|
|
51
|
+
create_files_in_empty_dirs
|
|
52
|
+
`git add . && git commit -m 'initial import'`
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
task :create_gitignore do
|
|
56
|
+
system("echo '.DS_Store' >> .gitignore") # files sometimes created by OSX
|
|
57
|
+
system("echo 'log/*' >> .gitignore") if File.directory?('log')
|
|
58
|
+
system("echo 'tmp/**/*' >> .gitignore") if File.directory?('tmp')
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
task :create_files_in_empty_dirs do
|
|
62
|
+
%w(log tmp).each { |dir|
|
|
63
|
+
system("touch #{dir}/.gitignore") if File.directory?(dir)
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
desc "Create remote origin for current dir"
|
|
68
|
+
task :create_remote_origin do
|
|
69
|
+
File.directory?('.git') || init
|
|
70
|
+
|
|
71
|
+
# Push to remote git repo
|
|
72
|
+
hostname = capture "echo $CAPISTRANO:HOST$"
|
|
73
|
+
system "git remote add origin git@#{hostname.chomp}:#{application}"
|
|
74
|
+
system "git push origin master:refs/heads/master"
|
|
75
|
+
|
|
76
|
+
puts
|
|
77
|
+
puts "New remote Git repo: #{git_user}@#{hostname.chomp}:#{application}"
|
|
78
|
+
puts
|
|
79
|
+
|
|
80
|
+
# File.open('.git/config', 'w') do |c|
|
|
81
|
+
# c.write 'Add the following to .git/config'
|
|
82
|
+
# c.write '[branch "master"]'
|
|
83
|
+
# c.write ' remote = origin'
|
|
84
|
+
# c.write ' merge = refs/heads/master'
|
|
85
|
+
# end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Create root dir for git repositories
|
|
90
|
+
task :create_git_root do
|
|
91
|
+
deprec2.mkdir(git_root, :mode => 02775, :owner => git_user, :group => git_group, :via => :sudo)
|
|
92
|
+
sudo "chmod -R g+w #{git_root}"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# regenerate git authorized keys file from users file in same dir
|
|
96
|
+
task :regenerate_authorized_keys do
|
|
97
|
+
sudo "echo '' > #{git_keys_file}"
|
|
98
|
+
sudo "for file in `ls #{git_keys_file}-*`; do cat $file >> #{git_keys_file}; echo \"\n\" >> #{git_keys_file} ; done"
|
|
99
|
+
sudo "chown #{git_user}.#{git_group} #{git_keys_file}"
|
|
100
|
+
sudo "chmod 0600 #{git_keys_file}"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Copyright 2008 by Saulius Grigaitis. All rights reserved.
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
require 'uri'
|
|
4
|
+
require 'optparse'
|
|
5
|
+
|
|
6
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
7
|
+
namespace :centos do namespace :gitosis do
|
|
8
|
+
|
|
9
|
+
set :scm_group, 'scm'
|
|
10
|
+
|
|
11
|
+
set(:git_backup_dir) { File.join(backup_dir, 'git') }
|
|
12
|
+
|
|
13
|
+
desc "Install Gitosis"
|
|
14
|
+
task :install, :roles => :scm do
|
|
15
|
+
install_deps
|
|
16
|
+
|
|
17
|
+
deprec2.groupadd(scm_group)
|
|
18
|
+
deprec2.useradd("git", { :gecos => 'git version control', :shell => '/bin/sh', :group => scm_group, :homedir => "/home/git"})
|
|
19
|
+
sudo "/usr/bin/passwd -u -f git"
|
|
20
|
+
deprec2.add_user_to_group("git", scm_group)
|
|
21
|
+
|
|
22
|
+
package_dir = File.join(src_dir, 'gitosis')
|
|
23
|
+
sudo <<-SUDO
|
|
24
|
+
sh -c 'cd #{src_dir};
|
|
25
|
+
test -d #{package_dir}.old && rm -fr #{package_dir}.old;
|
|
26
|
+
test -d #{package_dir} && mv #{package_dir} #{package_dir}.old;
|
|
27
|
+
git clone git://eagain.net/gitosis.git #{package_dir};
|
|
28
|
+
chown -R #{user} #{package_dir};
|
|
29
|
+
chmod -R g+w #{package_dir};
|
|
30
|
+
cd #{package_dir};
|
|
31
|
+
python setup.py install'
|
|
32
|
+
SUDO
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
unless ssh_options[:keys]
|
|
36
|
+
puts <<-ERROR
|
|
37
|
+
|
|
38
|
+
You need to define the name of your SSH key(s)
|
|
39
|
+
e.g. ssh_options[:keys] = %w(/Users/your_username/.ssh/id_rsa)
|
|
40
|
+
|
|
41
|
+
You can put this in your .caprc file in your home directory.
|
|
42
|
+
|
|
43
|
+
ERROR
|
|
44
|
+
exit
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
put File.read(ssh_options[:keys].first + ".pub"), "/tmp/id_rsa.pub", :mode => 0600
|
|
48
|
+
sudo "sudo -H -u git gitosis-init < /tmp/id_rsa.pub"
|
|
49
|
+
sudo "sudo rm /tmp/id_rsa.pub"
|
|
50
|
+
sudo "sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
desc "install dependencies for git"
|
|
54
|
+
task :install_deps do
|
|
55
|
+
yum.enable_repository :epel
|
|
56
|
+
apt.install( {:base => %w(git python-devel python-setuptools)}, :stable)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
desc "Create remote git repository and import project into it"
|
|
60
|
+
task :setup_repo, :roles => :scm do
|
|
61
|
+
path_dir = "config/gitosis"
|
|
62
|
+
FileUtils.mkdir_p(path_dir) if !File.directory?(path_dir)
|
|
63
|
+
system("git clone git@#{domain}:gitosis-admin.git config/gitosis/gitosis-admin.git") if !File.exists?("#{path_dir}/gitosis-admin.git")
|
|
64
|
+
|
|
65
|
+
create_repos
|
|
66
|
+
create_local_repos
|
|
67
|
+
push
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
desc "Create a git repository"
|
|
71
|
+
task :create_repos, :roles => :scm do
|
|
72
|
+
gitosis_admin = File.open(ssh_options[:keys].first + ".pub", "r") do |line|
|
|
73
|
+
line.gets.split(" ").last
|
|
74
|
+
end
|
|
75
|
+
# create key pair if it doesn't exist, and fetch public key
|
|
76
|
+
run "sh -c 'test -f /home/#{user}/.ssh/id_rsa.pub || /usr/bin/ssh-keygen -q -t rsa -N \"\" -f /home/#{user}/.ssh/id_rsa >&/dev/null'"
|
|
77
|
+
#run "chmod 600 /home/#{user}/.ssh/id_rsa && chmod 644 /home/#{user}/.ssh/id_rsa.pub"
|
|
78
|
+
get("/home/#{user}/.ssh/id_rsa.pub", "config/gitosis/gitosis_server.pub")
|
|
79
|
+
gitosis_server = File.open("config/gitosis/gitosis_server.pub", "r") do |line|
|
|
80
|
+
line.gets.split(" ").last
|
|
81
|
+
end
|
|
82
|
+
system("mv config/gitosis/gitosis_server.pub config/gitosis/gitosis-admin.git/keydir/#{gitosis_server}.pub")
|
|
83
|
+
gitosis_conf = <<-GITOSIS
|
|
84
|
+
|
|
85
|
+
[group #{application}]
|
|
86
|
+
writable = #{application}
|
|
87
|
+
members = #{gitosis_admin} #{gitosis_server}
|
|
88
|
+
|
|
89
|
+
GITOSIS
|
|
90
|
+
|
|
91
|
+
File.open("config/gitosis/gitosis-admin.git/gitosis.conf", "a") { |f| f.write(gitosis_conf) }
|
|
92
|
+
system "cd config/gitosis/gitosis-admin.git && git add . && git commit -m \"Added repository #{application} and write permission to user #{gitosis_admin}\" && git push"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
desc "Create git repository in local project"
|
|
96
|
+
task :create_local_repos do
|
|
97
|
+
unless File.exists?(".git")
|
|
98
|
+
system("git init")
|
|
99
|
+
system("git remote add origin git@#{domain}:#{application}.git")
|
|
100
|
+
system("git add .")
|
|
101
|
+
system("git commit -a -m 'Initial import'")
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
desc "Import project into git repository."
|
|
106
|
+
task :push, :roles => :scm do
|
|
107
|
+
add_ignores
|
|
108
|
+
puts "Importing application."
|
|
109
|
+
system "git push git@#{domain}:#{application}.git master:refs/heads/master"
|
|
110
|
+
system "git-config --add branch.master.remote origin"
|
|
111
|
+
system "git-config --add branch.master.merge refs/heads/master"
|
|
112
|
+
puts "Your repository is: git@#{domain}:#{application}.git"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
desc "ignore log files, tmp"
|
|
116
|
+
task :add_ignores, :roles => :scm do
|
|
117
|
+
ignore = <<-FILE
|
|
118
|
+
.DS_Store
|
|
119
|
+
log/*.log
|
|
120
|
+
tmp/**/*
|
|
121
|
+
db/*.sqlite3
|
|
122
|
+
config/gitosis
|
|
123
|
+
FILE
|
|
124
|
+
["log", "tmp/cache", "tmp/pids", "tmp/sessions", "tmp/sockets"].each do |dir|
|
|
125
|
+
system("touch #{dir}/.gitignore")
|
|
126
|
+
end
|
|
127
|
+
File.open(".gitignore", "w") { |f| f.write(ignore.strip.gsub(/^#{ignore[/\A\s*/]}/, "")) }
|
|
128
|
+
system "find . -type d -empty | xargs -I {} touch {}/.gitignore"
|
|
129
|
+
system "git add ."
|
|
130
|
+
system "git commit -a -m 'Touched .gitignore to emtpy folders, ignored log files, tmp, sqlite3 db'"
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
end end
|
|
134
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :centos do
|
|
4
|
+
namespace :logrotate do
|
|
5
|
+
|
|
6
|
+
# Install
|
|
7
|
+
|
|
8
|
+
desc "Install logrotate"
|
|
9
|
+
task :install do
|
|
10
|
+
install_deps
|
|
11
|
+
SYSTEM_CONFIG_FILES[:logrotate].each do |file|
|
|
12
|
+
deprec2.render_template(:logrotate, file.merge(:remote => true))
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# install dependencies for nginx
|
|
17
|
+
task :install_deps do
|
|
18
|
+
apt.install( {:base => %w(logrotate)}, :stable )
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Configure
|
|
22
|
+
|
|
23
|
+
SYSTEM_CONFIG_FILES[:logrotate] = [
|
|
24
|
+
|
|
25
|
+
{:template => 'logrotate.conf.erb',
|
|
26
|
+
:path => '/etc/logrotate.conf',
|
|
27
|
+
:mode => 0755,
|
|
28
|
+
:owner => 'root:root'}
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
desc "Generate logrotate config from template."
|
|
32
|
+
task :config_gen do
|
|
33
|
+
SYSTEM_CONFIG_FILES[:logrotate].each do |file|
|
|
34
|
+
deprec2.render_template(:logrotate, file)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
desc "Push logrotate config files to server"
|
|
39
|
+
task :config do
|
|
40
|
+
deprec2.push_configs(:logrotate, SYSTEM_CONFIG_FILES[:logrotate])
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Control
|
|
44
|
+
#
|
|
45
|
+
# logrotate is run via cron with a script in /etc/cron.daily/logrotate
|
|
46
|
+
|
|
47
|
+
desc "Force logrotate to run"
|
|
48
|
+
task :force do
|
|
49
|
+
sudo "logrotate -f /etc/logrotate.conf"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|