FiXato-ubuntu-machine 0.5.3.2.9 → 0.5.3.2.10

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -4,6 +4,10 @@ http://suitmymind.github.com/ubuntu-machine
4
4
  = Changelog here :
5
5
  http://suitmymind.github.com/ubuntu-machine/#changelog
6
6
 
7
+ (Note: the above links belong to the official ubuntu-machine; not my fork.)
8
+
7
9
  = Contributors :
8
10
  - Joseph Glenn
9
- - Ahume
11
+ - Ahume
12
+ - Tarik Alkasab
13
+ - Filip H.F. "FiXato" Slagter
@@ -115,7 +115,7 @@ namespace :apache do
115
115
  reload
116
116
  end
117
117
  end
118
-
118
+
119
119
  desc "Fix the mod_deflate configuration and activate it"
120
120
  task :mod_deflate, :roles => :web do
121
121
  put render("deflate.conf", binding), "deflate.conf"
@@ -1,10 +1,16 @@
1
1
  namespace :ffmpeg do
2
- set :x264_commit_hash, ''
3
- set :ffmpeg_commit_hash, ''
4
- set :libswscale_commit_hash, ''
2
+ # FFmpeg install has been tested in June 2009 as working with these settings:
3
+ # set :x264_commit_hash, '2c597171d5126c3ccae7546f6699d6c4d8ec5e3a'
4
+ # set :ffmpeg_commit_hash, 'cc32213534573a127e01a0e2ed4962eb4b1939fd'
5
+ # set :libswscale_commit_hash, '0fa4ae3fc08f75277e2c1f225561053243f18576'
6
+ _cset :x264_commit_hash, ''
7
+ _cset :ffmpeg_commit_hash, ''
8
+ _cset :libswscale_commit_hash, ''
5
9
 
6
10
  desc 'Install FFmpeg dependencies'
7
11
  task :install_dependencies, :roles => :app do
12
+ #TODO: Ensure that the multiverse repositories/sources are available and being used by aptitude \
13
+ # otherwise add them to /etc/apt/sources.list since they are needed for libraries such as libmp3lame-dev
8
14
  sudo "aptitude install -y ccache checkinstall fakeroot liba52-0.7.4-dev liba52-dev libfaac-dev libfaad-dev libfreetype6-dev libgpac-dev libjpeg62-dev libmp3lame-dev libogg-dev libpng12-dev libtheora-dev libtiff4-dev libvorbis-dev libxvidcore4-dev"
9
15
  run "wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.1.tar.gz -O yasm-0.7.1.tar.gz && tar -xzf yasm-0.7.1.tar.gz && cd yasm-0.7.1 && ./configure && make && sudo checkinstall -y"
10
16
  sudo "ldconfig"
@@ -37,6 +37,12 @@ namespace :gems do
37
37
  sudo "gem uninstall #{name}"
38
38
  end
39
39
 
40
+ desc "Adds the --no-rdoc and --no-ri flags to the .gemrc; you don't need docs on a production server."
41
+ task :add_nodocs_to_gemrc, :roles => :app do
42
+ run "echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc"
43
+ end
44
+
45
+ # TODO: Replace scp with Capistrano's way of uploading/deploying files.
40
46
  desc "Scp local gem to the remote server and install it"
41
47
  task :deploy_local_gem, :roles => :app do
42
48
  local_gem_path = Capistrano::CLI.ui.ask("Please supply the path to the local gem: ")
@@ -45,17 +51,15 @@ namespace :gems do
45
51
  sudo "gem install -l gems/#{File.basename(local_gem_path)}"
46
52
  end
47
53
 
54
+ # TODO: Replace scp with Capistrano's way of uploading/deploying files.
55
+ # TODO: Refactor with deploy_local_gem
48
56
  desc "Scp a set of local gems preconfigured in :local_gems_to_deploy to the remote server and install them"
49
57
  task :deploy_local_gems, :roles => :app do
58
+ _cset(:local_gems_to_deploy) { abort "Please specify the local gems you want to deploy:\n set :local_gems_to_deploy, ['/path/to/your_local-1.2.gem']" }
50
59
  run "mkdir -p gems"
51
60
  local_gems_to_deploy.each do |local_gem_path|
52
61
  `scp -P #{ssh_options[:port]} #{File.expand_path(local_gem_path)} #{user}@#{server_name}:gems/`
53
62
  sudo "gem install -l gems/#{File.basename(local_gem_path)}"
54
63
  end
55
64
  end
56
-
57
- desc "Adds the --no-rdoc and --no-ri flags to the .gemrc; you don't need docs on a production server."
58
- task :add_nodocs_to_gemrc, :roles => :app do
59
- run "echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc"
60
- end
61
65
  end
@@ -7,6 +7,7 @@ namespace :git do
7
7
  run "cd #{git_version}"
8
8
  run "cd #{git_version} && ./configure"
9
9
  run "cd #{git_version} && make"
10
+ sudo_keepalive
10
11
  run "cd #{git_version} && sudo make install"
11
12
  run "rm #{git_version}.tar.gz"
12
13
  run "rm -Rf #{git_version}"
@@ -33,12 +33,41 @@ def watch_prompt(ch, stream, data, regex_to_watch)
33
33
  end
34
34
  end
35
35
 
36
- # Adds 1 or more commands to the cron tab of root
37
- def sudo_add_to_crontab(commands,period)
38
- tmp_cron="/tmp/tmp_cron"
39
- sudo "rm -f #{tmp_cron} && crontab -l || true > #{tmp_cron}"
40
- [*commands].each do |cmd|
41
- run "echo '#{period} #{cmd}' >> #{tmp_cron}"
36
+ def add_to_file(file,lines)
37
+ [*lines].each do |line|
38
+ run 'echo "%s" >> %s' % [line.gsub('"','\"'),file]
42
39
  end
43
- sudo "crontab #{tmp_cron}"
44
40
  end
41
+
42
+ def sudo_add_to_file(file,lines)
43
+ tmpfile = "#{File.basename(file)}.tmp"
44
+ run "cp #{file} #{tmpfile}"
45
+ add_to_file(tmpfile,lines)
46
+ sudo "mv #{tmpfile} #{file}"
47
+ end
48
+
49
+ # Re-activate sudo session if it has expired.
50
+ def sudo_keepalive
51
+ sudo "ls > /dev/null"
52
+ end
53
+
54
+ # Adds 1 or more commands to the cron tab
55
+ # - commands can be a string or an array
56
+ # - period should be a valid crontab period
57
+ # - use_sudo can be set to true if you want to edit the root crontab.
58
+ def add_to_crontab(commands,period,use_sudo=false)
59
+ send_cmd = use_sudo ? :run : :sudo
60
+ tmp_cron="/tmp/cron.tmp"
61
+ cron_lines = [*commands].map{|cmd| "#{period} #{cmd}"}
62
+ self.send(send_cmd, "rm -f #{tmp_cron} && crontab -l || true > #{tmp_cron}")
63
+ add_to_file(cron_lines, tmp_cron)
64
+ self.send(send_cmd, "crontab #{tmp_cron}")
65
+ sudo "rm -f #{tmp_cron}"
66
+ end
67
+
68
+ # Adds 1 or more commands to the cron tab of root
69
+ # - commands can be a string or an array
70
+ # - period should be a valid crontab period
71
+ def sudo_add_to_crontab(commands,period)
72
+ add_to_crontab(commands, period, true)
73
+ end
@@ -13,8 +13,6 @@ namespace :iptables do
13
13
  sudo "iptables-restore < /etc/iptables.up.rules"
14
14
 
15
15
  # ensure that the iptables rules are applied when we reboot the server
16
- run "cat /etc/network/interfaces > ~/tmp_interfaces"
17
- run "echo 'pre-up iptables-restore < /etc/iptables.up.rules' >> ~/tmp_interfaces"
18
- sudo "mv ~/tmp_interfaces /etc/network/interfaces"
16
+ sudo_add_to_file('/etc/network/interfaces','pre-up iptables-restore < /etc/iptables.up.rules')
19
17
  end
20
18
  end
@@ -1,13 +1,13 @@
1
1
  require 'yaml'
2
2
  namespace :lmsensors do
3
- desc "Install lmsensors"
4
- task :install, :roles => :app do
3
+ desc "Install lmsensors. Not relevant for virtual servers as they usually do not have sensors available."
4
+ task :install do
5
5
  sudo "aptitude install -y lm-sensors"
6
6
  to_probe = []
7
7
  sudo "sensors-detect", :pty => true do |ch, stream, data|
8
8
  if [/YES\/no/,/yes\/NO/,/to continue/].find { |regex| data =~ regex}
9
9
  # prompt, and then send the response to the remote process
10
- ch.send_data(Capistrano::CLI.password_prompt(data) + "\n")
10
+ ch.send_data(Capistrano::CLI.ui.ask(data) + "\n")
11
11
  elsif offset = data =~ /#----cut here----\s+# Chip drivers/
12
12
  text = data[offset,data.size - offset]
13
13
  text.gsub!('# Chip drivers','').gsub!('#----cut here----','')
@@ -18,7 +18,7 @@ namespace :lmsensors do
18
18
  Capistrano::Configuration.default_io_proc.call(ch, stream, data)
19
19
  end
20
20
  end
21
- puts "Will prob the following modules:" % to_probe.join(',')
21
+ puts "Will modprobe the following modules: %s" % to_probe.join(',')
22
22
  to_probe.each do |mod|
23
23
  sudo "modprobe #{mod}"
24
24
  end
@@ -10,14 +10,13 @@ namespace :machine do
10
10
  run_and_watch_prompt("adduser #{user_to_create}", [/Enter new UNIX password/, /Retype new UNIX password:/, /\[\]\:/, /\[y\/N\]/i])
11
11
 
12
12
  # force the non-interactive mode
13
- run "cat /etc/environment > ~/environment.tmp"
14
- run 'echo DEBIAN_FRONTEND=noninteractive >> ~/environment.tmp'
15
- sudo 'mv ~/environment.tmp /etc/environment'
13
+ add_to_file('/etc/environment','DEBIAN_FRONTEND=noninteractive')
16
14
  # prevent this env variable to be skipped by sudo
17
- run "echo 'Defaults env_keep = \"DEBIAN_FRONTEND\"' >> /etc/sudoers"
15
+ sudoers_lines = ['Defaults env_keep = "DEBIAN_FRONTEND"']
16
+ sudoers_lines << "#{user_to_create} ALL=(ALL)ALL"
17
+ add_to_file('/etc/sudoers',sudoers_lines)
18
18
 
19
- run "echo '#{user_to_create} ALL=(ALL)ALL' >> /etc/sudoers"
20
- run "echo 'AllowUsers #{user_to_create}' >> /etc/ssh/sshd_config"
19
+ add_to_file('/etc/ssh/sshd_config',"AllowUsers #{user_to_create}")
21
20
  run "/etc/init.d/ssh reload"
22
21
  end
23
22
 
@@ -28,13 +27,16 @@ namespace :machine do
28
27
  end
29
28
 
30
29
  task :install_dev_tools do
30
+ _cset :default_to_ruby_enterprise, true
31
+
31
32
  mysql.install
32
33
  apache.install
33
34
  ruby.install
34
35
  postfix.install
35
36
  gems.install_rubygems
37
+ gems.add_nodocs_to_gemrc
36
38
  ruby.install_enterprise
37
- ruby.make_enterprise_default
39
+ ruby.make_enterprise_default if default_to_ruby_enterprise
38
40
  ruby.install_passenger
39
41
  git.install
40
42
  php.install
@@ -1,20 +1,42 @@
1
1
  namespace :network do
2
+ _cset :network_interfaces_config do
3
+ abort "Please specify the location of the /etc/network/interfaces config you want to upload.\n For example:\n set :network_interfaces_config, File.expand_path(File.join(File.dirname(__FILE__),'interfaces'))"
4
+ end
5
+ _cset :resolv_config do
6
+ abort "Please specify the location of the /etc/resolv.conf config you want to upload.\n For example:\n set :resolv_config, File.expand_path(File.join(File.dirname(__FILE__),'resolv.conf'))"
7
+ end
8
+
2
9
  desc "Configure /etc/resolv.conf and /etc/network/interfaces"
3
- task :configure, :roles => :gateway do
10
+ task :configure do
4
11
  configure_resolv_conf
5
12
  configure_network_interfaces
6
13
  end
7
14
 
8
15
  desc "Configure network interfaces"
9
- task :configure_network_interfaces, :roles => :gateway do
10
- put File.read(network_interfaces_config), "interfaces"
11
- sudo "mv interfaces /etc/network/interfaces"
12
- sudo "/etc/init.d/networking restart"
16
+ task :configure_network_interfaces do
17
+ put File.read(network_interfaces_config), "interfaces.tmp"
18
+ sudo "mv interfaces.tmp /etc/network/interfaces"
19
+ restart
13
20
  end
14
21
 
15
22
  desc "Configure /etc/resolv.conf"
16
- task :configure_resolv_conf, :roles => :gateway do
17
- put File.read(resolv_config), "resolv.conf"
18
- sudo "mv resolv.conf /etc/resolv.conf"
23
+ task :configure_resolv_conf do
24
+ put File.read(resolv_config), "resolv.conf.tmp"
25
+ sudo "mv resolv.conf.tmp /etc/resolv.conf"
26
+ end
27
+
28
+ desc "Start the network"
29
+ task :start do
30
+ sudo "/etc/init.d/networking start"
31
+ end
32
+
33
+ desc "Restart the network"
34
+ task :restart do
35
+ sudo "/etc/init.d/networking restart"
36
+ end
37
+
38
+ desc "Stop the network"
39
+ task :stop do
40
+ sudo "/etc/init.d/networking stop"
19
41
  end
20
42
  end
@@ -1,37 +1,37 @@
1
1
  require 'yaml'
2
2
  namespace :ntp do
3
3
  set :ntp_default_ntpd_opts, "NTPD_OPTS='-g'"
4
- set :ntp_server_pool, "nl.pool.ntp.org"
4
+ set :ntp_pool_servers, (0..2).map {|num| "#{num}.pool.ntp.org"}
5
5
 
6
6
  desc "Install NTP"
7
- task :install, :roles => :app do
7
+ task :install do
8
8
  sudo "aptitude install -y ntp"
9
9
  configure
10
10
  end
11
11
 
12
12
  desc "Configure NTP"
13
- task :configure, :roles => :app do
14
- put render("ntpdate", binding), "ntpdate"
15
- sudo "mv ntpdate /etc/default/ntpdate"
16
- put render("ntp.conf", binding), "ntp.conf"
17
- sudo "mv ntp.conf /etc/ntp.conf"
18
- run "echo '#{ntp_default_ntpd_opts}' > ntp"
19
- sudo "mv ntp /etc/default/ntp"
13
+ task :configure do
14
+ put render("ntpdate", binding), "ntpdate.tmp"
15
+ sudo "mv ntpdate.tmp /etc/default/ntpdate"
16
+ put render("ntp.conf", binding), "ntp.conf.tmp"
17
+ sudo "mv ntp.conf.tmp /etc/ntp.conf"
18
+ run "echo '#{ntp_default_ntpd_opts}' > ntp.tmp"
19
+ sudo "mv ntp.tmp /etc/default/ntp"
20
20
  restart
21
21
  end
22
22
 
23
23
  desc "Start the NTP server"
24
- task :start, :roles => :app do
24
+ task :start do
25
25
  sudo "/etc/init.d/ntp start"
26
26
  end
27
27
 
28
28
  desc "Restart the NTP server"
29
- task :restart, :roles => :app do
29
+ task :restart do
30
30
  sudo "/etc/init.d/ntp restart"
31
31
  end
32
32
 
33
33
  desc "Stop the NTP server"
34
- task :stop, :roles => :app do
34
+ task :stop do
35
35
  sudo "/etc/init.d/ntp stop"
36
36
  end
37
37
  end
@@ -1,35 +1,33 @@
1
1
  namespace :odbc do
2
+ _cset(:odbc_sourcename) { abort "Please specify the odbc sourcename:\n set :odbc_sourcename, 'MyFirstSQLServer'" }
3
+ _cset(:odbc_database) { abort "Please specify the odbc database:\n set :odbc_database, 'MyDB'" }
4
+ _cset(:odbc_host) { abort "Please specify the odbc host:\n set :odbc_host, '127.0.0.1'" }
5
+ _cset :odbc_port, '1433'
6
+
2
7
  desc "Install ODBC/FreeTDS"
3
8
  task :install, :roles => :app do
4
- run "cp /etc/profile ~/profile.tmp"
5
- run "echo 'export ODBCINI=/etc/odbc.ini' >> ~/profile.tmp"
6
- run "echo 'export ODBCSYSINI=/etc' >> ~/profile.tmp"
7
- run "echo 'export FREETDSCONF=/etc/freetds/freetds.conf' >> ~/profile.tmp"
8
- sudo "mv ~/profile.tmp /etc/profile"
9
+ profile_lines = ["export ODBCINI=/etc/odbc.ini",
10
+ "export ODBCSYSINI=/etc",
11
+ "export FREETDSCONF=/etc/freetds/freetds.conf"]
12
+ sudo_add_to_file('/etc/profile',profile_lines)
9
13
 
10
14
  freetds = "freetds-0.82"
11
15
  sudo "sudo apt-get install unixodbc unixodbc-dev tdsodbc -y"
12
16
  run "wget -nv ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/#{freetds}.tar.gz"
13
- run "tar xvzf #{freetds}.tar.gz"
14
- run "cd #{freetds}"
15
- run "cd #{freetds} && ./configure"
16
- run "cd #{freetds} && make"
17
+ run "tar xvzf #{freetds}.tar.gz && cd #{freetds} && ./configure && make"
18
+ sudo_keepalive
17
19
  run "cd #{freetds} && sudo make install"
18
- run "rm #{freetds}.tar.gz"
19
- run "rm -Rf #{freetds}"
20
+ run "rm #{freetds}.tar.gz && rm -Rf #{freetds}"
20
21
  end
21
-
22
+
22
23
  desc "Install the ruby ODBC library"
23
24
  task :install_rubyodbc, :roles => :app do
24
25
  rubyodbc = "ruby-odbc-0.9996"
25
26
  run "wget -nv http://www.ch-werner.de/rubyodbc/#{rubyodbc}.tar.gz"
26
- run "tar xvzf #{rubyodbc}.tar.gz"
27
- run "cd #{rubyodbc}"
28
- run "cd #{rubyodbc} && ruby extconf.rb"
29
- run "cd #{rubyodbc} && make"
27
+ run "tar xvzf #{rubyodbc}.tar.gz && cd #{rubyodbc} && ruby extconf.rb && make"
28
+ sudo_keepalive
30
29
  run "cd #{rubyodbc} && sudo make install"
31
- run "rm #{rubyodbc}.tar.gz"
32
- run "rm -Rf #{rubyodbc}"
30
+ run "rm #{rubyodbc}.tar.gz && rm -Rf #{rubyodbc}"
33
31
  end
34
32
 
35
33
  desc "Install FreeTDS/ODBC configuration files"
@@ -27,9 +27,7 @@ namespace :ruby do
27
27
  "#{ruby_enterprise_url[/(ruby-enterprise.*)(.tar.gz)/, 1]}"
28
28
  end
29
29
 
30
- set :ruby_enterprise_path_prefix do
31
- '/opt'
32
- end
30
+ _cset :ruby_enterprise_path_prefix, '/opt'
33
31
 
34
32
  set :passenger_version do
35
33
  `gem list passenger$ -r`.gsub(/[\n|\s|passenger|(|)]/,"").split(',').first
@@ -52,9 +50,7 @@ namespace :ruby do
52
50
  sudo "ln -s #{ruby_enterprise_path_prefix}/#{ruby_enterprise_version} #{ruby_enterprise_path_prefix}/ruby-enterprise"
53
51
 
54
52
  # add REE bin to the path
55
- run "cat /etc/environment > ~/environment.tmp"
56
- run 'echo PATH="%s/ruby-enterprise/bin:$PATH" >> ~/environment.tmp' % ruby_enterprise_path_prefix
57
- sudo 'mv ~/environment.tmp /etc/environment'
53
+ sudo_add_to_file('/etc/environment','echo PATH="%s/ruby-enterprise/bin:$PATH"' % ruby_enterprise_path_prefix)
58
54
  end
59
55
 
60
56
  desc "Install Phusion Passenger"
@@ -1,5 +1,5 @@
1
1
  namespace :ssh do
2
-
2
+ _cset :ssh_secundary_keys, []
3
3
  desc <<-DESC
4
4
  Setup SSH on the gateway host. Runs `upload_keys`, `install_ovh_ssh_key` AND \
5
5
  `configure_sshd` then reloads the SSH service to finalize the changes.
@@ -10,7 +10,18 @@ namespace :ssh do
10
10
  install_ovh_ssh_key if ["ovh-rps", "ovh-dedie"].include?(hosting_provider)
11
11
  reload
12
12
  end
13
-
13
+
14
+ desc "Uploads secundary ssh pubkeys defined in ssh_secundary_keys which don't necessarily belong to you."
15
+ task :add_secundary_keys do
16
+ run "mkdir -p ~/.ssh"
17
+ run "chown -R #{user}:#{user} ~/.ssh"
18
+ run "chmod 700 ~/.ssh"
19
+
20
+ [*ssh_secundary_keys].each do |key|
21
+ key = File.read("#{key}.pub")
22
+ run "echo '#{key}' >> ./.ssh/authorized_keys2"
23
+ end
24
+ end
14
25
 
15
26
  desc <<-DESC
16
27
  Uploads your local public SSH keys to the server. A .ssh folder is created if \
@@ -29,7 +40,7 @@ namespace :ssh do
29
40
  authorized_keys = ssh_options[:keys].collect { |key| File.read("#{key}.pub") }.join("\n")
30
41
  put authorized_keys, "./.ssh/authorized_keys2", :mode => 0600
31
42
  end
32
-
43
+
33
44
  desc <<-DESC
34
45
  Configure SSH daemon with more secure settings recommended by Slicehost. The \
35
46
  will be configured to run on the port configured in Capistrano's "ssh_options". \
@@ -64,10 +75,11 @@ namespace :ssh do
64
75
  Upload a default SSH config.
65
76
  DESC
66
77
  task :upload_ssh_config, :roles => :gateway do
78
+ _cset(:ssh_config) { abort "Please specify the location of the ssh config file you want to upload:\n set :ssh_config, '~/.ssh/config'" }
67
79
  run "mkdir -p ~/.ssh"
68
80
  run "chown -R #{user}:#{user} ~/.ssh"
69
81
  run "chmod 700 ~/.ssh"
70
- put File.read(ssh_config), "./.ssh/config", :mode => 0600
82
+ put File.read(File.expand_path(ssh_config)), "./.ssh/config", :mode => 0600
71
83
  end
72
84
 
73
85
  end
@@ -40,7 +40,7 @@
40
40
 
41
41
 
42
42
  # Reject all other inbound - default deny unless explicitly allowed policy
43
- #-A INPUT -j REJECT
44
- #-A FORWARD -j REJECT
43
+ -A INPUT -j REJECT
44
+ -A FORWARD -j REJECT
45
45
 
46
46
  COMMIT
@@ -10,8 +10,7 @@ restrict 10.13.0.0 mask 255.255.255.0 nomodify notrap
10
10
  restrict 10.14.0.0 mask 255.255.255.0 nomodify notrap
11
11
  restrict 127.0.0.1
12
12
  restrict ::1
13
- server 0.<%=ntp_server_pool%>
14
- server 1.<%=ntp_server_pool%>
15
- server 2.<%=ntp_server_pool%> iburst
16
- server 3.<%=ntp_server_pool%>
13
+ <% ntp_pool_servers.each_with_index do |ntp_server,index|%>
14
+ <%= "server #{ntp_server} #{index == 0 ? 'iburst' : ''}" %>
15
+ <% end %>
17
16
  statistics loopstats peerstats clockstats
@@ -1,8 +1,8 @@
1
1
  [<%= odbc_sourcename %>]
2
- Driver = FreeTDS
3
- Description = ODBC Connection via FreeTDS
4
- Trace = No
5
- Server = <%= odbc_host %>
2
+ Driver = FreeTDS
3
+ Description = ODBC Connection via FreeTDS
4
+ Trace = No
5
+ Server = <%= odbc_host %>
6
6
  Port = <%= odbc_port %>
7
7
  TDS Version = <%= odbc_tds_version rescue '8.0' %>
8
- Database = <%= odbc_database %>
8
+ Database = <%= odbc_database %>
@@ -1,7 +1,7 @@
1
1
  [FreeTDS]
2
- Description = TDS driver (Sybase/MS SQL)
3
- Driver = /usr/lib/odbc/libtdsodbc.so
4
- Setup = /usr/lib/odbc/libtdsS.so
5
- CPTimeout =
6
- CPReuse =
7
- FileUsage = 1
2
+ Description = TDS driver (Sybase/MS SQL)
3
+ Driver = /usr/lib/odbc/libtdsodbc.so
4
+ Setup = /usr/lib/odbc/libtdsS.so
5
+ CPTimeout =
6
+ CPReuse =
7
+ FileUsage = 1
@@ -1,36 +1,17 @@
1
1
  namespace :tmpfs do
2
- set :tmpfs_directories do
3
- {
4
- '/tmpfs' => {:size => '2G', :mode => '0744'},
5
- }
2
+ _cset(:tmpfs_directories) do
3
+ abort "Please specify the tmpfs directories:\n set :tmpfs_directories do\n{\n'/tmpfs' => {:size => '2G', :mode => '0744'},\n}\nend"
6
4
  end
7
5
 
8
6
  desc "Create tmpfs directories"
9
7
  task :create_directories, :roles => :app do
10
8
  tmpfs_directories.each do |dir,options|
11
- options[:size] = '2G' if options[:size].nil?
12
- options[:mode] = '0744' if options[:mode].nil?
9
+ options[:size] ||= '2G'
10
+ options[:mode] ||= '0744'
13
11
  sudo "mkdir -p #{dir}"
14
- sudo "mount -t tmpfs -o size=#{options[:size]},mode=#{options[:mode]} tmpfs #{dir}"
15
- run "cp /etc/fstab fstab.tmp"
16
- run "echo 'tmpfs #{dir} tmpfs size=#{options[:size]},mode=#{options[:mode]} 0 0' >> fstab.tmp"
17
- sudo "mv fstab.tmp /etc/fstab"
12
+ fstab_line = "tmpfs #{dir} tmpfs size=#{options[:size]},mode=#{options[:mode]} 0 0"
13
+ sudo_add_to_file('/etc/fstab',fstab_line)
14
+ sudo "mount #{dir}"
18
15
  end
19
16
  end
20
-
21
- desc "Create ftp directories within :vsftpd_tmpfs_directory for each user defined in :vsftpd_users and symlink in their homedirs"
22
- task :create_vsftpd_tmpfs_dirs, :roles => :app do
23
- cron_commands = []
24
- vsftpd_users.each do |target_user|
25
- target_tmpfs_dir = File.join(vsftpd_tmpfs_directory,target_user)
26
- cmds = []
27
- cmds << "mkdir -p #{target_tmpfs_dir}"
28
- cmds << "chown #{target_user}:#{vsftpd_group} #{target_tmpfs_dir}"
29
- cmds << "chmod 0777 #{target_tmpfs_dir}"
30
- cmds.each{|cmd| sudo cmd}
31
- cron_commands << cmds.join(' && ')
32
- sudo "ln -s #{File.join(vsftpd_tmpfs_directory,target_user)} ~#{target_user}/ftp"
33
- end
34
- sudo_add_to_crontab(cron_commands.compact,'@reboot')
35
- end
36
17
  end
@@ -38,7 +38,7 @@ namespace :utils do
38
38
  end
39
39
 
40
40
  desc "Force fsck to check the disk at every boot."
41
- task :force_fsck_at_every_boot, :roles => :gateway do
41
+ task :force_fsck_at_every_boot do
42
42
  run "df"
43
43
  partition = Capistrano::CLI.ui.ask("Which partition do you want to run a filesystem check on, on every boot? ")
44
44
  sudo "tune2fs -c 1 #{partition}"
@@ -1,54 +1,65 @@
1
1
  namespace :vsftpd do
2
2
  set :vsftpd_user_shell, '/usr/sbin/nologin'
3
3
  set :vsftpd_group, 'ftpusers'
4
+ _cset(:vsftpd_users) { abort "Please specify the VSFTPd users:\n set :vsftpd_users, ['user1', 'user2']" }
4
5
 
5
6
  desc "Install VSFTPd"
6
- task :install, :roles => :app do
7
+ task :install do
7
8
  sudo "aptitude install -y vsftpd"
8
9
  configure
9
10
  add_nologin_shell
11
+ create_group
12
+ add_user_to_group
10
13
  create_users
11
14
  end
12
15
 
13
16
  desc "Install VSFTPd configuration file"
14
- task :configure, :roles => :app do
17
+ task :configure do
18
+ # TODO: Don't use a template for the config, or append it to the existing config.
19
+ # TODO: Other solution could be to allow setting a local config file which will be uploaded.
15
20
  put render("vsftpd.conf", binding), "vsftpd.conf"
16
21
  sudo "mv vsftpd.conf /etc/vsftpd.conf"
17
22
  restart
18
23
  end
19
24
 
20
25
  desc "Add the :vsftpd_user_shell to /etc/shells"
21
- task :add_nologin_shell, :roles => :app do
26
+ task :add_nologin_shell do
22
27
  puts "If this fails, then the '#{vsftpd_user_shell}'-shell is already in /etc/shells"
23
28
  run "test -z `grep #{vsftpd_user_shell} /etc/shells`"
24
- run "cp /etc/shells ~/shells.tmp"
25
- run "echo '#{vsftpd_user_shell}' >> ~/shells.tmp"
26
- sudo "mv ~/shells.tmp /etc/shells"
29
+ sudo_add_to_file('/etc/shells',vsftpd_user_shell)
27
30
  end
28
31
 
29
32
  desc "Create VSFTPd-only users"
30
- task :create_users, :roles => :app do
33
+ task :create_users do
31
34
  vsftpd_users.each do |user_to_create|
32
- sudo "groupadd -f #{vsftpd_group}"
33
- sudo "usermod -a -G #{vsftpd_group} #{user}"
34
35
  sudo "useradd --shell #{vsftpd_user_shell} --groups #{vsftpd_group} -m #{user_to_create}"
35
36
  puts "Changing password for #{user_to_create}:"
36
37
  sudo_and_watch_prompt("passwd #{user_to_create}", [/Enter new UNIX password/, /Retype new UNIX password:/, /\[\]\:/, /\[y\/N\]/i])
37
38
  end
38
39
  end
39
40
 
41
+ desc "Create VSFTPd group"
42
+ task :create_group do
43
+ sudo "groupadd -f #{vsftpd_group}"
44
+ end
45
+
46
+ desc "Adds current user to VSFTPd group"
47
+ task :add_user_to_group do
48
+ sudo "usermod -a -G #{vsftpd_group} #{user}"
49
+ end
50
+
40
51
  desc "Start the vsftpd server"
41
- task :start, :roles => :app do
52
+ task :start do
42
53
  sudo "/etc/init.d/vsftpd start"
43
54
  end
44
55
 
45
56
  desc "Restart the vsftpd server"
46
- task :restart, :roles => :app do
57
+ task :restart do
47
58
  sudo "/etc/init.d/vsftpd restart"
48
59
  end
49
60
 
50
61
  desc "Stop the vsftpd server"
51
- task :stop, :roles => :app do
62
+ task :stop do
52
63
  sudo "/etc/init.d/vsftpd stop"
53
64
  end
54
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: FiXato-ubuntu-machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3.2.9
4
+ version: 0.5.3.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Balthazar
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-06-22 00:00:00 -07:00
14
+ date: 2009-06-26 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -25,7 +25,7 @@ dependencies:
25
25
  version: 2.5.2
26
26
  version:
27
27
  description: Capistrano recipes for setting up and deploying to a Ubuntu Machine
28
- email: thomas@suitmymind.com
28
+ email: fixato@gmail.com
29
29
  executables: []
30
30
 
31
31
  extensions: []
@@ -41,7 +41,6 @@ files:
41
41
  - lib/capistrano/ext/ubuntu-machine/ffmpeg.rb
42
42
  - lib/capistrano/ext/ubuntu-machine/gems.rb
43
43
  - lib/capistrano/ext/ubuntu-machine/git.rb
44
- - lib/capistrano/ext/ubuntu-machine/odbc.rb
45
44
  - lib/capistrano/ext/ubuntu-machine/helpers.rb
46
45
  - lib/capistrano/ext/ubuntu-machine/iptables.rb
47
46
  - lib/capistrano/ext/ubuntu-machine/lmsensors.rb
@@ -49,6 +48,7 @@ files:
49
48
  - lib/capistrano/ext/ubuntu-machine/mysql.rb
50
49
  - lib/capistrano/ext/ubuntu-machine/network.rb
51
50
  - lib/capistrano/ext/ubuntu-machine/ntp.rb
51
+ - lib/capistrano/ext/ubuntu-machine/odbc.rb
52
52
  - lib/capistrano/ext/ubuntu-machine/php.rb
53
53
  - lib/capistrano/ext/ubuntu-machine/postfix.rb
54
54
  - lib/capistrano/ext/ubuntu-machine/ruby.rb
@@ -57,22 +57,22 @@ files:
57
57
  - lib/capistrano/ext/ubuntu-machine/utils.rb
58
58
  - lib/capistrano/ext/ubuntu-machine/vsftpd.rb
59
59
  - lib/capistrano/ext/ubuntu-machine/templates/apache2.erb
60
+ - lib/capistrano/ext/ubuntu-machine/templates/deflate.conf.erb
61
+ - lib/capistrano/ext/ubuntu-machine/templates/freetds.conf.erb
60
62
  - lib/capistrano/ext/ubuntu-machine/templates/iptables.erb
61
63
  - lib/capistrano/ext/ubuntu-machine/templates/my.cnf.erb
62
64
  - lib/capistrano/ext/ubuntu-machine/templates/new_db.erb
63
65
  - lib/capistrano/ext/ubuntu-machine/templates/ntpdate.erb
64
66
  - lib/capistrano/ext/ubuntu-machine/templates/ntp.conf.erb
67
+ - lib/capistrano/ext/ubuntu-machine/templates/odbc.ini.erb
68
+ - lib/capistrano/ext/ubuntu-machine/templates/odbcinst.ini.erb
65
69
  - lib/capistrano/ext/ubuntu-machine/templates/passenger.conf.erb
66
70
  - lib/capistrano/ext/ubuntu-machine/templates/passenger.load.erb
67
71
  - lib/capistrano/ext/ubuntu-machine/templates/sshd_config.erb
68
72
  - lib/capistrano/ext/ubuntu-machine/templates/vhost.erb
69
73
  - lib/capistrano/ext/ubuntu-machine/templates/vsftpd.conf.erb
70
- - lib/capistrano/ext/ubuntu-machine/templates/deflate.conf.erb
71
- - lib/capistrano/ext/ubuntu-machine/templates/freetds.conf.erb
72
- - lib/capistrano/ext/ubuntu-machine/templates/odbc.ini.erb
73
- - lib/capistrano/ext/ubuntu-machine/templates/odbcinst.ini.erb
74
74
  has_rdoc: false
75
- homepage: http://suitmymind.github.com/ubuntu-machine
75
+ homepage: http://github.com/FiXato/ubuntu-machine
76
76
  post_install_message:
77
77
  rdoc_options: []
78
78
 
@@ -96,6 +96,6 @@ rubyforge_project:
96
96
  rubygems_version: 1.2.0
97
97
  signing_key:
98
98
  specification_version: 2
99
- summary: Capistrano recipes for setting up and deploying to a Ubuntu Machine
99
+ summary: Capistrano recipes for setting up and deploying to a Ubuntu Machine. Fork of SuitMyMind's ubuntu-machine
100
100
  test_files: []
101
101