tons of updates
This commit is contained in:
parent
4c14b0865b
commit
2853d23d3a
@ -61,7 +61,7 @@ Capistrano::Configuration.instance.load do
|
||||
|
||||
desc "Rename the server"
|
||||
task :rename do
|
||||
hostname = fetch(:hostname) || Capistrano::CLI.ui.ask("Hostname: ")
|
||||
hostname = fetch(:hostname, nil) || Capistrano::CLI.ui.ask("Hostname: ")
|
||||
|
||||
top.copy_skel
|
||||
run "cd #{puppet_dir} && #{sudo} ./rename #{hostname}"
|
||||
|
@ -4,14 +4,16 @@ class nginx-debian {
|
||||
file { $log_root:
|
||||
owner => root,
|
||||
group => web,
|
||||
mode => 2775
|
||||
mode => 2775,
|
||||
ensure => directory
|
||||
}
|
||||
|
||||
file { "$log_root/sites":
|
||||
owner => root,
|
||||
group => web,
|
||||
mode => 2775,
|
||||
require => File[$log_root]
|
||||
require => File[$log_root],
|
||||
ensure => directory
|
||||
}
|
||||
|
||||
$pid_file = pid_path('nginx')
|
||||
|
@ -1,4 +1,4 @@
|
||||
class nginx($version) {
|
||||
class nginx($version, $max_pool_size = 20) {
|
||||
gem { 'passenger':
|
||||
version => $version,
|
||||
path => "${ruby::with_ruby_path}",
|
||||
@ -27,6 +27,7 @@ class nginx($version) {
|
||||
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}",
|
||||
pid_file => $pid_file,
|
||||
ensure => present,
|
||||
notify => Service['god'],
|
||||
@ -50,17 +51,22 @@ class nginx($version) {
|
||||
|
||||
file { "${config_path}/fastcgi.conf":
|
||||
content => template('nginx/fastcgi.conf'),
|
||||
mode => 644,
|
||||
require => File[$config_file]
|
||||
}
|
||||
|
||||
file { "${config_path}/fastcgi_params":
|
||||
content => template('nginx/fastcgi_params'),
|
||||
mode => 644,
|
||||
require => File[$config_file]
|
||||
}
|
||||
|
||||
file { '/var/www': ensure => directory }
|
||||
|
||||
file { $symlink_path: ensure => $install_path }
|
||||
file { $symlink_path:
|
||||
ensure => $install_path,
|
||||
require => Exec['install-passenger']
|
||||
}
|
||||
|
||||
file { "${base::install_path}/bin/new-site":
|
||||
content => template('nginx/new-site'),
|
||||
|
@ -20,9 +20,7 @@ http {
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
tcp_nodelay on;
|
||||
|
||||
@ -34,7 +32,8 @@ http {
|
||||
|
||||
passenger_root /usr/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-<%= version %>;
|
||||
passenger_ruby /usr/local/ruby/bin/ruby;
|
||||
passenger_max_pool_size 10;
|
||||
passenger_max_pool_size <%= max_pool_size %>;
|
||||
passenger_max_instances_per_app 2;
|
||||
|
||||
include /etc/nginx/fastcgi.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
|
@ -1,10 +1,16 @@
|
||||
class ruby-debian {
|
||||
$packages = [
|
||||
'libyaml-dev', 'libreadline-dev', 'libssl-dev', 'libffi-dev',
|
||||
'libncurses5-dev', 'libcurl4-openssl-dev',
|
||||
'libncurses5-dev', 'libcurl4-openssl-dev', 'zlib1g-dev',
|
||||
'libxml2', 'libxml2-dev', 'libxslt1.1', 'libxslt1-dev'
|
||||
]
|
||||
|
||||
package { $packages: ensure => installed }
|
||||
|
||||
bash_rc_d { 'ruby':
|
||||
ensure => present,
|
||||
path => $base::local_path,
|
||||
require => Build_and_install['ruby']
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ class ruby($version) {
|
||||
build_and_install { $name:
|
||||
version => $version,
|
||||
source => "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-<%= version %>.tar.gz",
|
||||
require => Class['base']
|
||||
}
|
||||
|
||||
gem { 'bundler':
|
||||
@ -14,11 +13,5 @@ class ruby($version) {
|
||||
options => '--pre',
|
||||
ensure => present
|
||||
}
|
||||
|
||||
bash_rc_d { $name:
|
||||
ensure => present,
|
||||
path => $base::local_path,
|
||||
require => Build_and_install[$name]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ Puppet::Type.type(:god_init).provide(:install) do
|
||||
desc "Install a God script"
|
||||
|
||||
def create
|
||||
File.open(file, 'wb') { |fh| fh.print(ERB.new(config).result(binding)) }
|
||||
File.open(file, 'wb') { |fh| fh.print processed_config }
|
||||
end
|
||||
|
||||
def destroy
|
||||
@ -12,7 +12,11 @@ Puppet::Type.type(:god_init).provide(:install) do
|
||||
end
|
||||
|
||||
def exists?
|
||||
File.file? file
|
||||
File.file?(file) && File.read(file) == processed_config
|
||||
end
|
||||
|
||||
def processed_config
|
||||
ERB.new(config).result(binding)
|
||||
end
|
||||
|
||||
private
|
||||
@ -28,6 +32,10 @@ Puppet::Type.type(:god_init).provide(:install) do
|
||||
@resource[:stop] || ''
|
||||
end
|
||||
|
||||
def restart
|
||||
@resource[:restart] || ''
|
||||
end
|
||||
|
||||
def name
|
||||
@resource[:name] || ''
|
||||
end
|
||||
@ -40,14 +48,16 @@ Puppet::Type.type(:god_init).provide(:install) do
|
||||
<<-GOD
|
||||
God.watch do |w|
|
||||
w.name = "<%= name %>"
|
||||
w.interval = 15.seconds
|
||||
w.interval = 5.seconds
|
||||
|
||||
w.start = lambda { system("<%= start %>") }
|
||||
w.start_grace = 10.seconds
|
||||
|
||||
<% if !stop.empty? %>
|
||||
w.stop = lambda { system("<%= stop %>") }
|
||||
w.stop_grace = 10.seconds
|
||||
<% end %>
|
||||
|
||||
<% if !restart.empty? %>
|
||||
w.restart = lambda { system("<%= restart %>") }
|
||||
<% end %>
|
||||
|
||||
<% if pid_file %>
|
||||
|
@ -15,6 +15,10 @@ Puppet::Type.newtype(:god_init) do
|
||||
desc "The command to stop the process"
|
||||
end
|
||||
|
||||
newparam(:restart) do
|
||||
desc "The command to restart/reload the process"
|
||||
end
|
||||
|
||||
newparam(:pid_file) do
|
||||
desc "A pid file"
|
||||
end
|
||||
|
6
shared/modules/flush_software/manifests/init.pp
Normal file
6
shared/modules/flush_software/manifests/init.pp
Normal file
@ -0,0 +1,6 @@
|
||||
class flush_software {
|
||||
file { "${base::install_path}/flush-software":
|
||||
content => template('flush_software/flush-software'),
|
||||
mode => 0775
|
||||
}
|
||||
}
|
17
shared/modules/flush_software/templates/flush-software
Normal file
17
shared/modules/flush_software/templates/flush-software
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "$0 <name of software>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Are you sure you want to remove '$1'? [yes/no]"
|
||||
read answer
|
||||
|
||||
if [ $answer == 'yes' ]; then
|
||||
rm -Rf <%= scope.lookupvar('base::install_path') %>/$1*
|
||||
rm -Rf <%= scope.lookupvar('base::src_path') %>/$1*
|
||||
|
||||
echo "$1 purged"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user