deprec 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,8 +28,7 @@ module Deprec
28
28
 
29
29
  # create new user account on target system
30
30
  def useradd(user)
31
- puts run_method
32
- send(run_method, "grep '^#{user}:' /etc/passwd || /usr/sbin/useradd -m #{user}")
31
+ send(run_method, "grep '^#{user}:' /etc/passwd || sudo /usr/sbin/useradd -m #{user}")
33
32
  end
34
33
 
35
34
  # create a new group on target system
@@ -25,7 +25,8 @@ role :db, domain, :primary => true
25
25
  set :application, "<%= singular_name %>"
26
26
  set :deploy_to, "/var/www/apps/#{application}"
27
27
 
28
- set :user, ENV['USER']
28
+ # XXX we may not need this - it doesn't work on windows
29
+ # XXX set :user, ENV['USER']
29
30
  set :repository, "svn+ssh://#{user}@#{domain}#{deploy_to}/repos/trunk"
30
31
  set :rails_env, "production"
31
32
 
@@ -47,6 +48,8 @@ set :apache_server_name, domain
47
48
  # set :apache_ssl_enabled, false
48
49
  # set :apache_ssl_ip, "127.0.0.1"
49
50
  # set :apache_ssl_forward_all, false
51
+ # set :apache_ssl_chainfile, false
52
+
50
53
 
51
54
  # =============================================================================
52
55
  # MONGREL OPTIONS
@@ -103,18 +103,11 @@ Capistrano.configuration(:must_exist).load do
103
103
  sudo "chmod -R g+w #{deploy_to}"
104
104
  end
105
105
 
106
- task :create_user do
107
- newuser=user
108
- user='root'
109
- # run "useradd -m #{newuser}"
110
- run "ls"
111
- user=newuser
112
- end
113
-
114
106
  task :install_gems do
115
107
  gem.install 'rails' # gem lib makes installing gems fun
116
108
  gem.select 'mongrel' # mongrel requires we select a version
117
109
  gem.install 'mongrel_cluster'
110
+ gem.install 'builder'
118
111
  end
119
112
 
120
113
  desc "create deployment group and add current user to it"
@@ -150,7 +143,6 @@ Capistrano.configuration(:must_exist).load do
150
143
  :make => 'make;',
151
144
  :install => 'make install;',
152
145
  :post_install => 'install -b support/apachectl /etc/init.d/httpd;'
153
- # XXX use 'install' command instead
154
146
  }
155
147
  deprec.download_src(src_package, src_dir)
156
148
  deprec.install_from_src(src_package, src_dir)
@@ -187,7 +179,8 @@ Capistrano.configuration(:must_exist).load do
187
179
  task :setup_admin_account do
188
180
  user = Capistrano::CLI.password_prompt "Enter userid for new user:"
189
181
  deprec.useradd(user)
190
- run_with_input("passwd #{user}", /UNIX password/) # ??? how many versions of the prompt are there?
182
+ puts "Setting pasword for new account"
183
+ sudo_with_input("passwd #{user}", /UNIX password/) # ??? how many versions of the prompt are there?
191
184
  deprec.groupadd('admin')
192
185
  deprec.add_user_to_group(user, 'admin')
193
186
  deprec.append_to_file_if_missing('/etc/sudoers', '%admin ALL=(ALL) ALL')
@@ -28,14 +28,14 @@ class Capistrano::SCM::Subversion
28
28
 
29
29
  def setup_repository_cache(actor)
30
30
  params = ""
31
- params << "--username #{configuration.svn_username}" if configuration.svn_username
32
- command = "#{svn} co -q -v #{params} #{configuration.repository} #{configuration.repository_cache} &&"
31
+ params << "--username #{configuration[:svn_username]}" if configuration[:svn_username]
32
+ command = "#{svn} co -q #{params} #{configuration[:repository]} #{configuration[:repository_cache]} &&"
33
33
  configuration.logger.debug "Caching SVN repository on remote servers..."
34
34
  run_checkout(actor, command, &svn_stream_handler(actor))
35
35
  end
36
36
 
37
37
  def update_repository_cache(actor)
38
- command = "#{svn} up -q #{configuration.repository_cache} &&"
38
+ command = "#{svn} up -q #{configuration[:repository_cache]} &&"
39
39
  run_update(actor, command, &svn_stream_handler(actor))
40
40
  end
41
41
 
@@ -25,6 +25,22 @@ Capistrano.configuration(:must_exist).load do
25
25
  apt.update
26
26
  end
27
27
 
28
+ desc "enable multiverse repositories"
29
+ task :enable_multiverse do
30
+ # ruby is not installed by default or else we'd use
31
+ # sudo "ruby -pi.bak -e \"gsub(/#\s?(.*universe$)/, '\1')\" sources.list"
32
+ sudo 'perl -pi -e \'s/#\s?(deb.* multiverse$)/\1/g\' /etc/apt/sources.list'
33
+ apt.update
34
+ end
35
+
36
+ desc "disable universe repositories"
37
+ task :disable_multiverse do
38
+ # ruby is not installed by default or else we'd use
39
+ # sudo "ruby -pi.bak -e \"gsub(/#\s?(.*universe$)/, '\1')\" sources.list"
40
+ sudo 'perl -pi -e \'s/^([^#]*multiverse)/#\1/g\' /etc/apt/sources.list'
41
+ apt.update
42
+ end
43
+
28
44
  desc "disable cdrom as a source of packages"
29
45
  task :disable_cdrom_install do
30
46
  # ruby is not installed by default so we use perl
@@ -32,12 +48,13 @@ Capistrano.configuration(:must_exist).load do
32
48
  apt.update
33
49
  end
34
50
 
35
- desc "enable cdrom as a source of packages"
36
- task :enable_cdrom_install do
37
- # ruby is not installed by default so we use perl
38
- sudo 'perl -pi -e \'s/^[# ]*(deb cdrom)/\1/g\' /etc/apt/sources.list'
39
- apt.update
40
- end
51
+ # XXX we need to run 'sudo apt-cdrom' to add a cdrom
52
+ # desc "enable cdrom as a source of packages"
53
+ # task :enable_cdrom_install do
54
+ # # ruby is not installed by default so we use perl
55
+ # sudo 'perl -pi -e \'s/^[# ]*(deb cdrom)/\1/g\' /etc/apt/sources.list'
56
+ # apt.update
57
+ # end
41
58
 
42
59
  desc "installs packages required for a rails box"
43
60
  task :install_packages_for_rails do
@@ -54,8 +71,8 @@ Capistrano.configuration(:must_exist).load do
54
71
  apt.install({:base => ['postfix']}, :stable)
55
72
  end
56
73
 
57
- desc "write network config to server"
58
- task :network_configure do
74
+ # desc "write network config to server"
75
+ # task :network_configure do
59
76
  # set :ethernet_interfaces, [{
60
77
  # :num => 0,
61
78
  # :type => 'static',
@@ -66,8 +83,8 @@ Capistrano.configuration(:must_exist).load do
66
83
  # :dns2 => '4.2.2.1'
67
84
  # }]
68
85
 
69
- deprec.render_template_to_file('interfaces.rhtml', '/etc/network/interfaces')
70
- end
86
+ # deprec.render_template_to_file('interfaces.rhtml', '/etc/network/interfaces')
87
+ # end
71
88
 
72
89
  # desc "configure hostname on server"
73
90
  # task :hostname_configure do
@@ -2,20 +2,35 @@ Capistrano.configuration(:must_exist).load do
2
2
  set :vm_dir, '/var/vm'
3
3
  set :stemserver, 'stemserver_ubuntu_6.06.1'
4
4
 
5
- # currently only for CentOS
5
+ task :install_my_package do
6
+ packages = {:base => %w{build-essential libdb2 xinetd}}
7
+ packages[:base] << 'linux-headers-$(uname -r)'
8
+ apt.install(packages, :stable)
9
+ end
10
+
6
11
  task :install_vmware_server do
7
- version = 'VMware-server-1.0.1-29996.i386'
12
+ version = 'VMware-server-1.0.1-29996'
8
13
  set :src_package, {
9
- :file => version + '.rpm',
10
- :url => "http://10.0.100.45/download/vmware/#{version}.rpm",
11
- :install => "rpm -i #{File.join(src_dir, version + '.rpm')};"
14
+ :file => version + '.tar.gz',
15
+ :dir => 'vmware-server-distrib',
16
+ :url => "http://10.0.100.45/download/vmware/#{version}.tar.gz",
17
+ :unpack => "tar zxf #{version}.tar.gz;",
12
18
  }
19
+ # pre-requisites on Ubuntu
20
+ disable_cdrom_install
21
+ enable_universe
22
+ packages = {:base => %w{build-essential libdb2 xinetd}}
23
+ packages[:base] << 'linux-headers-$(uname -r)'
24
+ apt.install(packages, :stable)
25
+
26
+
27
+ # sudo apt-get install build-essential x-window-system-core
28
+
13
29
  deprec.download_src(src_package, src_dir)
14
- sudo src_package[:install]
15
- sudo "yum install gcc" # when you select the develpment packages on CentOS it doesn't give you gcc!
16
- # XXX work out how to do this interactive through capistrano
17
- puts
30
+ deprec.install_from_src(src_package, src_dir)
31
+ puts
18
32
  puts "IMPORTANT"
33
+ puts "manually run the following command:"
19
34
  puts "sudo /usr/bin/vmware-config.pl"
20
35
  puts
21
36
  end
@@ -33,11 +48,49 @@ Capistrano.configuration(:must_exist).load do
33
48
  deprec.unpack_src(src_package, src_dir)
34
49
  # XXX work out how to do this interactive through capistrano
35
50
  puts
36
- puts "IMPORTANT - you need to log in and run"
37
- puts "cd /usr/local/src/vmware-mui-distrib && sudo ./vmware-install.pl"
51
+ puts "IMPORTANT - you need to log in and run the following commands"
52
+ puts "cd /usr/local/src/vmware-server-distrib && sudo ./vmware-install.pl"
53
+ puts "cd /etc/vmware/ssl/ && sudo touch rui.key rui.crt"
54
+ puts "sudo /usr/bin/vmware-config.pl"
38
55
  puts
39
56
  end
40
57
 
58
+ # # currently only for CentOS
59
+ # task :install_vmware_server do
60
+ # version = 'VMware-server-1.0.1-29996.i386'
61
+ # set :src_package, {
62
+ # :file => version + '.rpm',
63
+ # :url => "http://10.0.100.45/download/vmware/#{version}.rpm",
64
+ # :install => "rpm -i #{File.join(src_dir, version + '.rpm')};"
65
+ # }
66
+ # deprec.download_src(src_package, src_dir)
67
+ # sudo src_package[:install]
68
+ # sudo "yum install gcc" # when you select the develpment packages on CentOS it doesn't give you gcc!
69
+ # # XXX work out how to do this interactive through capistrano
70
+ # puts
71
+ # puts "IMPORTANT"
72
+ # puts "sudo /usr/bin/vmware-config.pl"
73
+ # puts
74
+ # end
75
+ #
76
+ # task :install_vmware_mui do
77
+ # version = 'VMware-mui-1.0.1-29996'
78
+ # src_package = {
79
+ # :file => version + '.tar.gz',
80
+ # :dir => 'vmware-mui-distrib',
81
+ # :url => "http://10.0.100.45/download/vmware/#{version}.tar.gz",
82
+ # :unpack => "tar zxf #{version}.tar.gz;",
83
+ # :install => './vmware-install.pl;'
84
+ # }
85
+ # deprec.download_src(src_package, src_dir)
86
+ # deprec.unpack_src(src_package, src_dir)
87
+ # # XXX work out how to do this interactive through capistrano
88
+ # puts
89
+ # puts "IMPORTANT - you need to log in and run"
90
+ # puts "cd /usr/local/src/vmware-mui-distrib && sudo ./vmware-install.pl"
91
+ # puts
92
+ # end
93
+
41
94
  task :replicate_stemserver do
42
95
  sudo <<-SUDO
43
96
  sh -c '
@@ -12,6 +12,7 @@ Capistrano.configuration(:must_exist).load do
12
12
  set :apache_ssl_enabled, false
13
13
  set :apache_ssl_ip, nil
14
14
  set :apache_ssl_forward_all, false
15
+ set :apache_ssl_chainfile, false
15
16
 
16
17
  task :setup_apache, :roles => :web do
17
18
  set :apache_path, '/usr/local/apache2'
@@ -63,9 +63,11 @@ SSLCertificateFile /usr/local/apache2/conf/ssl.crt/<%= domain %>.crt
63
63
  # Server Private Key
64
64
  SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/<%= domain %>.key
65
65
 
66
- # XXX put this into deploy.rb
67
- ## Intermediate keys
68
- # SSLCertificateChainFile /usr/local/apache2/conf/ssl.crt/<%= domain %>-chainfile.crt
66
+ <% if apache_ssl_chainfile %>
67
+ # Intermediate keys
68
+ SSLCertificateChainFile /usr/local/apache2/conf/ssl.crt/<%= domain %>-chainfile.crt
69
+ <% end %>
70
+
69
71
 
70
72
  BrowserMatch ".*MSIE.*" \
71
73
  nokeepalive ssl-unclean-shutdown \
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: deprec
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.2.1
7
- date: 2006-12-27 00:00:00 +11:00
6
+ version: 1.2.2
7
+ date: 2007-01-27 00:00:00 +11:00
8
8
  summary: deployment recipes for capistrano
9
9
  require_paths:
10
10
  - lib
@@ -100,12 +100,3 @@ dependencies:
100
100
  - !ruby/object:Gem::Version
101
101
  version: 1.2.0
102
102
  version:
103
- - !ruby/object:Gem::Dependency
104
- name: termios
105
- version_requirement:
106
- version_requirements: !ruby/object:Gem::Version::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: 0.9.4
111
- version: