a ton of updates on things

This commit is contained in:
John Bintz 2012-04-25 18:14:41 -04:00
parent 2853d23d3a
commit cdccad6183
16 changed files with 86 additions and 38 deletions

View File

@ -61,7 +61,7 @@ Capistrano::Configuration.instance.load do
desc "Rename the server"
task :rename do
hostname = fetch(:hostname, nil) || Capistrano::CLI.ui.ask("Hostname: ")
hostname = ENV['HOSTNAME'] || fetch(:hostname, nil) || Capistrano::CLI.ui.ask("Hostname: ")
top.copy_skel
run "cd #{puppet_dir} && #{sudo} ./rename #{hostname}"

View File

@ -0,0 +1,12 @@
Before do
# thanks dave. thave.
@sugarpuck = {
:username => 'vagrant',
:password => 'vagrant',
:port => 2222
}
end
require 'puppet-standalone-mashup/cucumber/via_ssh'
require 'puppet-standalone-mashup/cucumber/vagrant'

View File

@ -0,0 +1,12 @@
def vagrant(*args)
system %{vagrant #{args.collect(&:to_s).join(' ')}}
end
def cap(*args)
system %{cap vagrant #{args.collect(&:to_s).join(' ')}}
end
def bootstrap(hostname = ENV['HOSTNAME'])
ENV['HOSTNAME'] = hostname
system %{cap vagrant bootstrap}
end

View File

@ -0,0 +1,13 @@
require 'net/ssh'
def via_ssh(&block)
result = nil
Net::SSH.start('localhost', @sugarpuck[:username], :password => @sugarpuck[:password], :port => @sugarpuck[:port]) do |ssh|
result = block.call(ssh)
result = result.strip if result.respond_to?(:strip)
end
result
end

View File

@ -18,12 +18,13 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
# specify any dependencies here; for example:
# s.add_development_dependency "rspec"
# s.add_runtime_dependency "rest-client"
s.add_runtime_dependency 'guard'
s.add_runtime_dependency 'guard-shell'
s.add_runtime_dependency 'vagrant'
s.add_runtime_dependency 'capistrano'
s.add_runtime_dependency 'capistrano-ext'
s.add_runtime_dependency 'net-ssh'
s.add_runtime_dependency 'rspec'
s.add_runtime_dependency 'cucumber'
s.add_runtime_dependency 'guard'
s.add_runtime_dependency 'guard-cucumber'
end

View File

@ -0,0 +1,6 @@
class debian {
group { web:
gid => 30010
}
}

View File

@ -47,6 +47,8 @@ start() {
stop() {
echo -n "Stopping $DESC: "
kill `cat $PID_PATH`
rm $PID_PATH
killall -9 god
RETVAL=$?
echo "$NAME."
}

View File

@ -5,14 +5,15 @@ class nginx-debian {
owner => root,
group => web,
mode => 2775,
ensure => directory
ensure => directory,
require => Group['web']
}
file { "$log_root/sites":
owner => root,
group => web,
mode => 2775,
require => File[$log_root],
require => [ File[$log_root], Group['web'] ],
ensure => directory
}
@ -23,4 +24,9 @@ class nginx-debian {
pattern => "/var/log/nginx/*/access.log /var/log/nginx/*/error.log",
require => Class['nginx']
}
bash_rc_d { 'nginx':
ensure => present,
path => $base::local_path
}
}

View File

@ -24,10 +24,12 @@ class nginx($version, $max_pool_size = 20) {
$config_file = "${base::config_path}/nginx.conf"
$config_path = "${base::config_path}/nginx"
$nginx_start = "${sbin_path}/nginx -c ${config_file}"
$nginx_stop = "${sbin_path}/nginx -s stop -c ${config_file}"
god_init { $name:
start => "${sbin_path}/nginx -c ${config_file}",
stop => "${sbin_path}/nginx -s stop -c ${config_file}",
restart => "${sbin_path}/nginx -s reload -c ${config_file}",
start => $nginx_start,
stop => $nginx_stop,
restart => "${nginx_stop} ; ${nginx_start}",
pid_file => $pid_file,
ensure => present,
notify => Service['god'],
@ -61,16 +63,16 @@ class nginx($version, $max_pool_size = 20) {
require => File[$config_file]
}
file { '/var/www': ensure => directory }
file { '/var/www':
ensure => directory,
group => web,
mode => 2775,
require => Group['web']
}
file { $symlink_path:
ensure => $install_path,
require => Exec['install-passenger']
}
file { "${base::install_path}/bin/new-site":
content => template('nginx/new-site'),
mode => 755
}
}

View File

@ -1,12 +0,0 @@
#!/bin/bash
if [ $UID -ne 0 ]; then
sudo $0 $@
exit
fi
cd /var/www
mkdir $1
chown :www-data $1
chmod 2775 $1

View File

@ -9,8 +9,7 @@ class ruby-debian {
bash_rc_d { 'ruby':
ensure => present,
path => $base::local_path,
require => Build_and_install['ruby']
path => $base::local_path
}
}

View File

@ -5,12 +5,12 @@ class ruby($version) {
build_and_install { $name:
version => $version,
source => "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-<%= version %>.tar.gz",
configure => "--disable-install-doc"
}
gem { 'bundler':
require => Build_and_install[$name],
path => $with_ruby_path,
options => '--pre',
ensure => present
}
}

View File

@ -2,7 +2,7 @@ Puppet::Type.type(:bash_rc_d).provide(:install) do
desc "Configure a new directory to be added to every user's PATH"
def create
file.open('wb') { |fh| fh.puts "export PATH=#{@resource[:path]}/#{@resource[:name]}/bin:$PATH" }
file.open('wb') { |fh| fh.puts content }
end
def destroy
@ -10,10 +10,14 @@ Puppet::Type.type(:bash_rc_d).provide(:install) do
end
def exists?
file.file?
file.file? && file.read == content
end
private
def content
"export PATH=#{@resource[:path]}/#{@resource[:name]}/sbin:#{@resource[:path]}/#{@resource[:name]}/bin:$PATH"
end
def file
Pathname("/etc/bash.bashrc.d/#{@resource[:name]}.sh")
end

View File

@ -35,7 +35,7 @@ Puppet::Type.type(:gem).provide(:install) do
end
def gem_command(what)
command = %{bash -c 'PATH=#{@resource[:path]} gem #{what} #{@resource[:name]} #{options} #{version}'}.tap { |o| p o }
command = %{bash -c 'PATH=#{@resource[:path]} gem #{what} #{@resource[:name]} #{options} #{version}'}
command
end
end

View File

@ -53,7 +53,7 @@ God.watch do |w|
w.start = lambda { system("<%= start %>") }
<% if !stop.empty? %>
w.stop = lambda { system("<%= stop %>") }
w.stop = lambda { system("<%= stop %>") ; system("killall -9 <%= name %>") }
<% end %>
<% if !restart.empty? %>

View File

@ -9,8 +9,11 @@ export DEBIAN_FRONTEND=noninteractive
export PAGER=cat
apt-get --force-yes update
apt-get --force-yes -y upgrade
apt-get --force-yes -y remove x11-common xserver-xorg-video-all xserver-xorg-core xserver-xorg-video-radeon libgl1-mesa-dri mutt libdrm-intel1 libdrm-radeon1
apt-get --force-yes -y install deborphan
apt-get --force-yes -y remove `deborphan`
apt-get --force-yes -y dist-upgrade
apt-get --force-yes -y upgrade
apt-get install --force-yes -y rubygems1.8 puppet
apt-get remove --force-yes -y puppet facter