provizioning 0.0.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -0
- data/bin/provizion +43 -8
- data/lib/policies/chef-client.rb +37 -0
- data/lib/policies/lamp.rb +42 -0
- data/lib/policies/passenger.rb +44 -0
- data/lib/provizioning.rb +3 -0
- data/lib/recipes/apache.rb +70 -0
- data/lib/recipes/apache_conf.rb +3 -0
- data/lib/recipes/bundler.rb +4 -0
- data/lib/recipes/chef_client.rb +11 -0
- data/lib/recipes/curl.rb +8 -0
- data/lib/recipes/essential.rb +4 -0
- data/lib/recipes/git.rb +15 -0
- data/lib/recipes/imagemagick.rb +8 -0
- data/lib/recipes/mailserver.rb +9 -0
- data/lib/recipes/memcached.rb +16 -0
- data/lib/recipes/mysql.rb +21 -0
- data/lib/recipes/nginx/init.d +63 -0
- data/lib/recipes/nginx.rb +25 -0
- data/lib/recipes/passenger.rb +67 -0
- data/lib/recipes/php.rb +8 -0
- data/lib/recipes/postgresql.rb +21 -0
- data/lib/recipes/ruby_enterprise.rb +24 -0
- data/lib/recipes/rvm.rb +25 -0
- data/lib/recipes/sources.rb +5 -0
- data/lib/recipes/subversion.rb +8 -0
- data/lib/recipes/syslog.rb +7 -0
- data/lib/recipes/ufw.rb +12 -0
- data/lib/recipes/vim.rb +8 -0
- data/lib/recipes/webmin.rb +17 -0
- data/lib/templates/apache.conf.erb +12 -0
- data/lib/templates/my.cnf +132 -0
- data/lib/templates/passenger.conf +11 -0
- data/lib/templates/passenger.load +1 -0
- data/lib/templates/sources.list +13 -0
- metadata +51 -20
data/README
ADDED
data/bin/provizion
CHANGED
@@ -1,17 +1,52 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'fileutils'
|
4
|
+
require 'optparse'
|
4
5
|
|
5
|
-
|
6
|
+
path = "."
|
7
|
+
path = ARGV.first if !ARGV.first.nil?
|
6
8
|
|
7
|
-
|
9
|
+
options = {}
|
10
|
+
MANDATORY_OPTIONS = [:template]
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
ARGV.each do |arg|
|
13
|
+
ENV[$1] = $2 if arg =~ /^(\w+)=(.*)$/
|
14
|
+
end
|
12
15
|
|
13
|
-
|
14
|
-
|
16
|
+
parser = OptionParser.new do |opts|
|
17
|
+
opts.banner = <<BANNER
|
18
|
+
Provizion
|
19
|
+
=========
|
20
|
+
|
21
|
+
http://github.com/seasonlabs/provizion
|
22
|
+
|
23
|
+
Provizioning is a server automation tool that lets you setup a server in an automated fashion without installing
|
24
|
+
anything in the remote server before loading configuration.
|
25
|
+
|
26
|
+
Usage
|
27
|
+
=====
|
28
|
+
|
29
|
+
$> #{File.basename($0)} PATH [options]
|
30
|
+
|
31
|
+
Templates are:
|
32
|
+
BANNER
|
33
|
+
opts.separator ""
|
34
|
+
opts.on("-t", "--template TEMPLATE", String,
|
35
|
+
"Server template: lamp, rails") { |options[:template]| }
|
36
|
+
opts.on("-h", "--help",
|
37
|
+
"Show this help message.") { puts opts; exit }
|
38
|
+
opts.parse!(ARGV)
|
39
|
+
|
40
|
+
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| options[option.to_sym].nil? }
|
41
|
+
puts opts; exit
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
FileUtils.mkdir_p("#{path}")
|
46
|
+
|
47
|
+
`capify #{path}`
|
48
|
+
|
49
|
+
FileUtils.cp("#{File.dirname(__FILE__)}/../lib/policies/#{options[:template]}.rb", "#{path}/policy.rb")
|
15
50
|
|
16
51
|
puts "[Server configuration created]"
|
17
52
|
puts "[Modify it to configure you server connection details]"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Require our stack
|
2
|
+
require "provizioning"
|
3
|
+
|
4
|
+
policy :passenger_stack, :roles => :app do
|
5
|
+
requires :ubuntu_sources
|
6
|
+
requires :build_essential
|
7
|
+
requires :vim
|
8
|
+
requires :git
|
9
|
+
requires :curl
|
10
|
+
requires :chef_client
|
11
|
+
end
|
12
|
+
|
13
|
+
deployment do
|
14
|
+
# mechanism for deployment
|
15
|
+
delivery :capistrano do
|
16
|
+
begin
|
17
|
+
recipes 'Capfile'
|
18
|
+
rescue LoadError
|
19
|
+
recipes 'deploy'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# source based package installer defaults
|
24
|
+
source do
|
25
|
+
prefix '/usr/local'
|
26
|
+
archives '/usr/local/sources'
|
27
|
+
builds '/usr/local/build'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Depend on a specific version of sprinkle
|
32
|
+
begin
|
33
|
+
gem 'sprinkle', ">= 0.3.1"
|
34
|
+
rescue Gem::LoadError
|
35
|
+
puts "sprinkle 0.3.1 required.\n Run: `sudo gem install sprinkle`"
|
36
|
+
exit
|
37
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Require our stack
|
2
|
+
require "provizioning"
|
3
|
+
|
4
|
+
policy :passenger_stack, :roles => :app do
|
5
|
+
requires :ubuntu_sources
|
6
|
+
requires :build_essential
|
7
|
+
requires :vim
|
8
|
+
requires :git
|
9
|
+
requires :curl
|
10
|
+
|
11
|
+
requires :webserver # Apache
|
12
|
+
requires :database # MySQL, SQLite
|
13
|
+
|
14
|
+
requires :scm # Git, SVN
|
15
|
+
requires :php # PHP
|
16
|
+
end
|
17
|
+
|
18
|
+
deployment do
|
19
|
+
# mechanism for deployment
|
20
|
+
delivery :capistrano do
|
21
|
+
begin
|
22
|
+
recipes 'Capfile'
|
23
|
+
rescue LoadError
|
24
|
+
recipes 'deploy'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# source based package installer defaults
|
29
|
+
source do
|
30
|
+
prefix '/usr/local'
|
31
|
+
archives '/usr/local/sources'
|
32
|
+
builds '/usr/local/build'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Depend on a specific version of sprinkle
|
37
|
+
begin
|
38
|
+
gem 'sprinkle', ">= 0.3.1"
|
39
|
+
rescue Gem::LoadError
|
40
|
+
puts "sprinkle 0.3.1 required.\n Run: `sudo gem install sprinkle`"
|
41
|
+
exit
|
42
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Require our stack
|
2
|
+
require "provizioning"
|
3
|
+
|
4
|
+
policy :passenger_stack, :roles => :app do
|
5
|
+
requires :ubuntu_sources
|
6
|
+
requires :build_essential
|
7
|
+
requires :vim
|
8
|
+
requires :git
|
9
|
+
requires :curl
|
10
|
+
|
11
|
+
requires :webserver # Apache
|
12
|
+
requires :database # MySQL, SQLite
|
13
|
+
|
14
|
+
requires :scm # Git, SVN
|
15
|
+
requires :ruby # Ruby Enterprise
|
16
|
+
requires :appserver # passenger
|
17
|
+
requires :imagemagick # image magick
|
18
|
+
end
|
19
|
+
|
20
|
+
deployment do
|
21
|
+
# mechanism for deployment
|
22
|
+
delivery :capistrano do
|
23
|
+
begin
|
24
|
+
recipes 'Capfile'
|
25
|
+
rescue LoadError
|
26
|
+
recipes 'deploy'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# source based package installer defaults
|
31
|
+
source do
|
32
|
+
prefix '/usr/local'
|
33
|
+
archives '/usr/local/sources'
|
34
|
+
builds '/usr/local/build'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Depend on a specific version of sprinkle
|
39
|
+
begin
|
40
|
+
gem 'sprinkle', ">= 0.3.1"
|
41
|
+
rescue Gem::LoadError
|
42
|
+
puts "sprinkle 0.3.1 required.\n Run: `sudo gem install sprinkle`"
|
43
|
+
exit
|
44
|
+
end
|
data/lib/provizioning.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
package :apache, :provides => :webserver do
|
2
|
+
description 'Apache2 web server.'
|
3
|
+
apt 'apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert' do
|
4
|
+
post :install, 'a2enmod rewrite'
|
5
|
+
end
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_executable '/usr/sbin/apache2'
|
9
|
+
end
|
10
|
+
|
11
|
+
requires :build_essential
|
12
|
+
optional :apache_etag_support, :apache_deflate_support, :apache_expires_support
|
13
|
+
end
|
14
|
+
|
15
|
+
package :apache2_prefork_dev do
|
16
|
+
description 'A dependency required by some packages.'
|
17
|
+
apt 'apache2-prefork-dev'
|
18
|
+
end
|
19
|
+
|
20
|
+
# These "installers" are strictly optional, I believe
|
21
|
+
# that everyone should be doing this to serve sites more quickly.
|
22
|
+
|
23
|
+
# Enable ETags
|
24
|
+
package :apache_etag_support do
|
25
|
+
apache_conf = "/etc/apache2/apache2.conf"
|
26
|
+
config = <<eol
|
27
|
+
# Passenger-stack-etags
|
28
|
+
FileETag MTime Size
|
29
|
+
eol
|
30
|
+
|
31
|
+
push_text config, apache_conf, :sudo => true
|
32
|
+
verify { file_contains apache_conf, "Passenger-stack-etags"}
|
33
|
+
end
|
34
|
+
|
35
|
+
# mod_deflate, compress scripts before serving.
|
36
|
+
package :apache_deflate_support do
|
37
|
+
apache_conf = "/etc/apache2/apache2.conf"
|
38
|
+
config = <<eol
|
39
|
+
# Passenger-stack-deflate
|
40
|
+
<IfModule mod_deflate.c>
|
41
|
+
# compress content with type html, text, and css
|
42
|
+
AddOutputFilterByType DEFLATE text/css text/html text/javascript application/javascript application/x-javascript text/js text/plain text/xml
|
43
|
+
<IfModule mod_headers.c>
|
44
|
+
# properly handle requests coming from behind proxies
|
45
|
+
Header append Vary User-Agent
|
46
|
+
</IfModule>
|
47
|
+
</IfModule>
|
48
|
+
eol
|
49
|
+
|
50
|
+
push_text config, apache_conf, :sudo => true
|
51
|
+
verify { file_contains apache_conf, "Passenger-stack-deflate"}
|
52
|
+
end
|
53
|
+
|
54
|
+
# mod_expires, add long expiry headers to css, js and image files
|
55
|
+
package :apache_expires_support do
|
56
|
+
apache_conf = "/etc/apache2/apache2.conf"
|
57
|
+
|
58
|
+
config = <<eol
|
59
|
+
# Passenger-stack-expires
|
60
|
+
<IfModule mod_expires.c>
|
61
|
+
<FilesMatch "\.(jpg|gif|png|css|js)$">
|
62
|
+
ExpiresActive on
|
63
|
+
ExpiresDefault "access plus 1 year"
|
64
|
+
</FilesMatch>
|
65
|
+
</IfModule>
|
66
|
+
eol
|
67
|
+
|
68
|
+
push_text config, apache_conf, :sudo => true
|
69
|
+
verify { file_contains apache_conf, "Passenger-stack-expires"}
|
70
|
+
end
|
data/lib/recipes/curl.rb
ADDED
data/lib/recipes/git.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
package :git, :provides => :scm do
|
2
|
+
description 'Git Distributed Version Control'
|
3
|
+
version '1.7.2.3'
|
4
|
+
source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
|
5
|
+
requires :git_dependencies
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_executable 'git'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
package :git_dependencies do
|
13
|
+
description 'Git Build Dependencies'
|
14
|
+
apt 'git-core', :dependencies_only => true
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
package :memcached_daemon, :provides => :memcached do
|
2
|
+
description 'Memcached, a distributed memory object store'
|
3
|
+
apt %w( memcached )
|
4
|
+
|
5
|
+
post :install, "/etc/init.d/memcached start"
|
6
|
+
post :install, "sudo ldconfig"
|
7
|
+
|
8
|
+
verify do
|
9
|
+
has_executable 'memcached'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
package :libmemcached do
|
14
|
+
source 'http://download.tangent.org/libmemcached-0.25.tar.gz'
|
15
|
+
requires :memcached_daemon
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
package :mysql, :provides => :database do
|
2
|
+
description 'MySQL Database'
|
3
|
+
apt %w( mysql-server mysql-client libmysqlclient-dev ) do
|
4
|
+
transfer "#{File.dirname(__FILE__)}/../templates/my.cnf", '/etc/mysql/'
|
5
|
+
end
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_executable 'mysql'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
package :mysql_driver, :provides => :ruby_database_driver do
|
13
|
+
description 'Ruby MySQL database driver'
|
14
|
+
gem 'mysql'
|
15
|
+
|
16
|
+
verify do
|
17
|
+
has_gem 'mysql'
|
18
|
+
end
|
19
|
+
|
20
|
+
requires :ruby_enterprise
|
21
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#! /bin/sh
|
2
|
+
|
3
|
+
### BEGIN INIT INFO
|
4
|
+
# Provides: nginx
|
5
|
+
# Required-Start: $all
|
6
|
+
# Required-Stop: $all
|
7
|
+
# Default-Start: 2 3 4 5
|
8
|
+
# Default-Stop: 0 1 6
|
9
|
+
# Short-Description: starts the nginx web server
|
10
|
+
# Description: starts nginx using start-stop-daemon
|
11
|
+
### END INIT INFO
|
12
|
+
|
13
|
+
|
14
|
+
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
15
|
+
DAEMON=/usr/local/nginx/sbin/nginx
|
16
|
+
NAME=nginx
|
17
|
+
DESC=nginx
|
18
|
+
|
19
|
+
test -x $DAEMON || exit 0
|
20
|
+
|
21
|
+
# Include nginx defaults if available
|
22
|
+
if [ -f /etc/default/nginx ] ; then
|
23
|
+
. /etc/default/nginx
|
24
|
+
fi
|
25
|
+
|
26
|
+
set -e
|
27
|
+
|
28
|
+
case "$1" in
|
29
|
+
start)
|
30
|
+
echo -n "Starting $DESC: "
|
31
|
+
start-stop-daemon --start --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \
|
32
|
+
--exec $DAEMON -- $DAEMON_OPTS
|
33
|
+
echo "$NAME."
|
34
|
+
;;
|
35
|
+
stop)
|
36
|
+
echo -n "Stopping $DESC: "
|
37
|
+
start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \
|
38
|
+
--exec $DAEMON
|
39
|
+
echo "$NAME."
|
40
|
+
;;
|
41
|
+
restart|force-reload)
|
42
|
+
echo -n "Restarting $DESC: "
|
43
|
+
start-stop-daemon --stop --quiet --pidfile \
|
44
|
+
/usr/local/nginx/logs/$NAME.pid --exec $DAEMON
|
45
|
+
sleep 1
|
46
|
+
start-stop-daemon --start --quiet --pidfile \
|
47
|
+
/usr/local/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
|
48
|
+
echo "$NAME."
|
49
|
+
;;
|
50
|
+
reload)
|
51
|
+
echo -n "Reloading $DESC configuration: "
|
52
|
+
start-stop-daemon --stop --signal HUP --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \
|
53
|
+
--exec $DAEMON
|
54
|
+
echo "$NAME."
|
55
|
+
;;
|
56
|
+
*)
|
57
|
+
N=/etc/init.d/$NAME
|
58
|
+
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
|
59
|
+
exit 1
|
60
|
+
;;
|
61
|
+
esac
|
62
|
+
|
63
|
+
exit 0
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# =========
|
2
|
+
# = Notes =
|
3
|
+
# =========
|
4
|
+
|
5
|
+
# The phusion guys have made it so that you can install nginx and passenger in one
|
6
|
+
# fell swoop, it is for this reason and cleanliness that I haven't decided to install
|
7
|
+
# nginx and passenger separately, otherwise nginx ends up being dependent on passenger
|
8
|
+
# so that it can call --add-module within its configure statement - That in itself would
|
9
|
+
# be strange.
|
10
|
+
|
11
|
+
package :nginx, :provides => :webserver do
|
12
|
+
puts "** Nginx installed by passenger gem **"
|
13
|
+
requires :passenger
|
14
|
+
|
15
|
+
push_text File.read(File.join(File.dirname(__FILE__), 'nginx', 'init.d')), "/etc/init.d/nginx", :sudo => true do
|
16
|
+
post :install, "sudo chmod +x /etc/init.d/nginx"
|
17
|
+
post :install, "sudo /usr/sbin/update-rc.d -f nginx defaults"
|
18
|
+
post :install, "sudo /etc/init.d/nginx start"
|
19
|
+
end
|
20
|
+
|
21
|
+
verify do
|
22
|
+
has_executable "/usr/local/nginx/sbin/nginx"
|
23
|
+
has_file "/etc/init.d/nginx"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
package :passenger_gem do
|
2
|
+
description 'Phusion Passenger (aka mod_rails)'
|
3
|
+
version '3.0'
|
4
|
+
gem 'passenger'
|
5
|
+
|
6
|
+
verify do
|
7
|
+
has_gem 'passenger'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
package :passenger_apache, :provides => :appserver do
|
12
|
+
description "Installs and configures Passenger for use with apache webserver"
|
13
|
+
# require the apache passenger module load/conf files before installation because of a sprinkle limitation.
|
14
|
+
requires :apache, :passenger_gem, :passenger_module_load, :passenger_module_conf
|
15
|
+
|
16
|
+
passenger_version = '2.2.15'
|
17
|
+
|
18
|
+
noop do
|
19
|
+
pre :install, 'passenger-install-apache2-module --auto'
|
20
|
+
post :install, "sudo a2enmod passenger"
|
21
|
+
post :install, 'echo "NameVirtualHost *:80" | sudo tee -a /etc/apache2/httpd.conf'
|
22
|
+
# Restart apache to enable changes
|
23
|
+
post :install, '/etc/init.d/apache2 restart'
|
24
|
+
end
|
25
|
+
|
26
|
+
verify do
|
27
|
+
has_file "/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}/ext/apache2/mod_passenger.so"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
package :passenger_module_load do
|
32
|
+
|
33
|
+
description "Uploads the passenger module load configuration. -sprinkle currently does not allow multiple installers per package, that's why the configuration files have it's own packages"
|
34
|
+
requires :apache, :passenger_gem
|
35
|
+
|
36
|
+
#TODO: :render => true seems not to work? hello sprinkle?!
|
37
|
+
passenger_version = '2.2.15'
|
38
|
+
transfer "#{File.dirname(__FILE__)}/../templates/passenger.load", "/etc/apache2/mods-available/passenger.load", :render => true
|
39
|
+
|
40
|
+
verify do
|
41
|
+
has_file '/etc/apache2/mods-available/passenger.load'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
package :passenger_module_conf do
|
46
|
+
|
47
|
+
description "Uploads the passenger module conf configuration. -sprinkle currently does not allow multiple installers per package, that's why the configuration files have it's own packages"
|
48
|
+
requires :apache, :passenger_gem
|
49
|
+
|
50
|
+
#TODO: :render => true seems not to work? hello sprinkle?!
|
51
|
+
passenger_version = '2.2.15'
|
52
|
+
transfer "#{File.dirname(__FILE__)}/../templates/passenger.conf", "/etc/apache2/mods-available/passenger.conf", :render => true
|
53
|
+
|
54
|
+
verify do
|
55
|
+
has_file '/etc/apache2/mods-available/passenger.conf'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
package :passenger_nginx, :provides => :appserver do
|
60
|
+
description "Installs and configures Passenger for use with the awesome nginx webserver"
|
61
|
+
|
62
|
+
requires :passenger_gem
|
63
|
+
|
64
|
+
noop do
|
65
|
+
pre :install, "passenger-install-nginx-module --auto --auto-download"
|
66
|
+
end
|
67
|
+
end
|
data/lib/recipes/php.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
package :postgres, :provides => :database do
|
2
|
+
description 'PostgreSQL database'
|
3
|
+
apt %w( postgresql postgresql-client libpq-dev )
|
4
|
+
|
5
|
+
verify do
|
6
|
+
has_executable 'psql'
|
7
|
+
end
|
8
|
+
|
9
|
+
optional :postgresql_driver
|
10
|
+
end
|
11
|
+
|
12
|
+
package :postgresql_driver, :provides => :ruby_database_driver do
|
13
|
+
description 'Ruby PostgreSQL database driver'
|
14
|
+
gem 'postgres'
|
15
|
+
|
16
|
+
verify do
|
17
|
+
has_gem 'postgres'
|
18
|
+
end
|
19
|
+
|
20
|
+
requires :ruby_enterprise
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
package :ruby_enterprise do
|
2
|
+
description 'Ruby Enterprise Edition'
|
3
|
+
version '1.8.7-2010.02'
|
4
|
+
REE_PATH = "/usr/local/ruby-enterprise"
|
5
|
+
|
6
|
+
binaries = %w(erb gem irb rackup rails rake rdoc ree-version ri ruby testrb)
|
7
|
+
source "http://rubyforge.org/frs/download.php/71096/ruby-enterprise-#{version}.tar.gz" do
|
8
|
+
custom_install 'sudo ./installer --auto=/usr/local/ruby-enterprise'
|
9
|
+
binaries.each {|bin| post :install, "ln -s #{REE_PATH}/bin/#{bin} /usr/local/bin/#{bin}" }
|
10
|
+
end
|
11
|
+
|
12
|
+
verify do
|
13
|
+
has_directory install_path
|
14
|
+
has_executable "#{REE_PATH}/bin/ruby"
|
15
|
+
binaries.each {|bin| has_symlink "/usr/local/bin/#{bin}", "#{REE_PATH}/bin/#{bin}" }
|
16
|
+
end
|
17
|
+
|
18
|
+
requires :ree_dependencies
|
19
|
+
end
|
20
|
+
|
21
|
+
package :ree_dependencies do
|
22
|
+
apt %w(zlib1g-dev libreadline5-dev libssl-dev)
|
23
|
+
requires :build_essential
|
24
|
+
end
|
data/lib/recipes/rvm.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
package :rvm do
|
2
|
+
description "Ruby Version Manager"
|
3
|
+
|
4
|
+
runner "bash < <( curl -L http://bit.ly/rvm-install-system-wide )" do
|
5
|
+
push_text '[[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm" # This loads RVM into a shell session.', '/root/.bashrc'
|
6
|
+
end
|
7
|
+
|
8
|
+
verify do
|
9
|
+
has_executable "rvm"
|
10
|
+
end
|
11
|
+
|
12
|
+
#requires :rvm_ree
|
13
|
+
end
|
14
|
+
|
15
|
+
package :rvm_ree do
|
16
|
+
description "REE in RVM"
|
17
|
+
|
18
|
+
apt "vim" do
|
19
|
+
pre :install, "rvm install ree"
|
20
|
+
post :install, "rvm --default ree"
|
21
|
+
end
|
22
|
+
|
23
|
+
#verify do
|
24
|
+
#end
|
25
|
+
end
|
data/lib/recipes/ufw.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
package :ufw, :provides => :firewall do
|
2
|
+
description "UFW Firewall"
|
3
|
+
|
4
|
+
apt "ufw" do
|
5
|
+
post :install, "sudo ufw allow to 0.0.0.0/0 port 80"
|
6
|
+
post :install, "sudo ufw allow to 0.0.0.0/0 port 443"
|
7
|
+
post :install, "sudo ufw allow to 0.0.0.0/0 port 3000"
|
8
|
+
post :install, "sudo ufw allow to 0.0.0.0/0 port 22"
|
9
|
+
post :install, "sudo ufw allow to 0.0.0.0/0 port 25"
|
10
|
+
post :install, "sudo ufw enable"
|
11
|
+
end
|
12
|
+
end
|
data/lib/recipes/vim.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
package :webmin, :provides => :panel do
|
2
|
+
description 'Webmin'
|
3
|
+
version '1.510'
|
4
|
+
requires :webmin_dependencies
|
5
|
+
|
6
|
+
deb "http://prdownloads.sourceforge.net/webadmin/webmin_#{version}-2_all.deb"
|
7
|
+
|
8
|
+
verify do
|
9
|
+
has_file "/etc/webmin/start"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
package :webmin_dependencies do
|
14
|
+
description 'Webmin dependencies'
|
15
|
+
apt 'apt-show-versions perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl'
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<VirtualHost *:80>
|
2
|
+
ServerName <%= domain %>
|
3
|
+
DocumentRoot <%= deploy_to %>/current/public
|
4
|
+
RailsEnv <%= stage %>
|
5
|
+
AllowEncodedSlashes on
|
6
|
+
RewriteEngine On
|
7
|
+
RewriteRule ^/$ /system/cache/index.html [QSA]
|
8
|
+
RewriteRule ^([^.]+)$ /system/cache/$1.html [QSA]
|
9
|
+
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
|
10
|
+
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
|
11
|
+
RewriteRule ^.*$ /system/maintenance.html [L]
|
12
|
+
</VirtualHost>
|
@@ -0,0 +1,132 @@
|
|
1
|
+
#
|
2
|
+
# The MySQL database server configuration file.
|
3
|
+
#
|
4
|
+
# You can copy this to one of:
|
5
|
+
# - "/etc/mysql/my.cnf" to set global options,
|
6
|
+
# - "~/.my.cnf" to set user-specific options.
|
7
|
+
#
|
8
|
+
# One can use all long options that the program supports.
|
9
|
+
# Run program with --help to get a list of available options and with
|
10
|
+
# --print-defaults to see which it would actually understand and use.
|
11
|
+
#
|
12
|
+
# For explanations see
|
13
|
+
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
|
14
|
+
|
15
|
+
# This will be passed to all mysql clients
|
16
|
+
# It has been reported that passwords should be enclosed with ticks/quotes
|
17
|
+
# escpecially if they contain "#" chars...
|
18
|
+
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
|
19
|
+
[client]
|
20
|
+
port = 3306
|
21
|
+
socket = /var/run/mysqld/mysqld.sock
|
22
|
+
default-character-set = utf8
|
23
|
+
|
24
|
+
# Here is entries for some specific programs
|
25
|
+
# The following values assume you have at least 32M ram
|
26
|
+
|
27
|
+
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
|
28
|
+
[mysqld_safe]
|
29
|
+
socket = /var/run/mysqld/mysqld.sock
|
30
|
+
nice = 0
|
31
|
+
|
32
|
+
[mysqld]
|
33
|
+
#
|
34
|
+
# * Basic Settings
|
35
|
+
#
|
36
|
+
|
37
|
+
#
|
38
|
+
# * IMPORTANT
|
39
|
+
# If you make changes to these settings and your system uses apparmor, you may
|
40
|
+
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
|
41
|
+
#
|
42
|
+
|
43
|
+
character-set-server = utf8
|
44
|
+
user = mysql
|
45
|
+
socket = /var/run/mysqld/mysqld.sock
|
46
|
+
port = 3306
|
47
|
+
basedir = /usr
|
48
|
+
datadir = /var/lib/mysql
|
49
|
+
tmpdir = /tmp
|
50
|
+
skip-external-locking
|
51
|
+
#
|
52
|
+
# Instead of skip-networking the default is now to listen only on
|
53
|
+
# localhost which is more compatible and is not less secure.
|
54
|
+
bind-address = 127.0.0.1
|
55
|
+
#
|
56
|
+
# * Fine Tuning
|
57
|
+
#
|
58
|
+
key_buffer = 16M
|
59
|
+
max_allowed_packet = 16M
|
60
|
+
thread_stack = 192K
|
61
|
+
thread_cache_size = 8
|
62
|
+
# This replaces the startup script and checks MyISAM tables if needed
|
63
|
+
# the first time they are touched
|
64
|
+
myisam-recover = BACKUP
|
65
|
+
#max_connections = 100
|
66
|
+
#table_cache = 64
|
67
|
+
#thread_concurrency = 10
|
68
|
+
#
|
69
|
+
# * Query Cache Configuration
|
70
|
+
#
|
71
|
+
query_cache_limit = 1M
|
72
|
+
query_cache_size = 16M
|
73
|
+
#
|
74
|
+
# * Logging and Replication
|
75
|
+
#
|
76
|
+
# Both location gets rotated by the cronjob.
|
77
|
+
# Be aware that this log type is a performance killer.
|
78
|
+
# As of 5.1 you can enable the log at runtime!
|
79
|
+
#general_log_file = /var/log/mysql/mysql.log
|
80
|
+
#general_log = 1
|
81
|
+
|
82
|
+
log_error = /var/log/mysql/error.log
|
83
|
+
|
84
|
+
# Here you can see queries with especially long duration
|
85
|
+
#log_slow_queries = /var/log/mysql/mysql-slow.log
|
86
|
+
#long_query_time = 2
|
87
|
+
#log-queries-not-using-indexes
|
88
|
+
#
|
89
|
+
# The following can be used as easy to replay backup logs or for replication.
|
90
|
+
# note: if you are setting up a replication slave, see README.Debian about
|
91
|
+
# other settings you may need to change.
|
92
|
+
#server-id = 1
|
93
|
+
#log_bin = /var/log/mysql/mysql-bin.log
|
94
|
+
expire_logs_days = 10
|
95
|
+
max_binlog_size = 100M
|
96
|
+
#binlog_do_db = include_database_name
|
97
|
+
#binlog_ignore_db = include_database_name
|
98
|
+
#
|
99
|
+
# * InnoDB
|
100
|
+
#
|
101
|
+
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
|
102
|
+
# Read the manual for more InnoDB related options. There are many!
|
103
|
+
#
|
104
|
+
# * Security Features
|
105
|
+
#
|
106
|
+
# Read the manual, too, if you want chroot!
|
107
|
+
# chroot = /var/lib/mysql/
|
108
|
+
#
|
109
|
+
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
|
110
|
+
#
|
111
|
+
# ssl-ca=/etc/mysql/cacert.pem
|
112
|
+
# ssl-cert=/etc/mysql/server-cert.pem
|
113
|
+
# ssl-key=/etc/mysql/server-key.pem
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
[mysqldump]
|
118
|
+
quick
|
119
|
+
quote-names
|
120
|
+
max_allowed_packet = 16M
|
121
|
+
|
122
|
+
[mysql]
|
123
|
+
#no-auto-rehash # faster start of mysql but no tab completition
|
124
|
+
|
125
|
+
[isamchk]
|
126
|
+
key_buffer = 16M
|
127
|
+
|
128
|
+
#
|
129
|
+
# * IMPORTANT: Additional settings that can override those from this file!
|
130
|
+
# The files must end with '.cnf', otherwise they'll be ignored.
|
131
|
+
#
|
132
|
+
!includedir /etc/mysql/conf.d/
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<IfModule passenger_module>
|
2
|
+
PassengerRoot /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.12
|
3
|
+
PassengerRuby /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
|
4
|
+
|
5
|
+
# Default value is 6 (2 is recommended for a 256 Mb of RAM VPS)
|
6
|
+
PassengerMaxPoolSize 4
|
7
|
+
|
8
|
+
# Default value is 300
|
9
|
+
PassengerPoolIdleTime 6000
|
10
|
+
|
11
|
+
</IfModule>
|
@@ -0,0 +1 @@
|
|
1
|
+
LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.12/ext/apache2/mod_passenger.so
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#############################################################
|
2
|
+
################### OFFICIAL UBUNTU REPOS ###################
|
3
|
+
#############################################################
|
4
|
+
|
5
|
+
###### Ubuntu Main Repos
|
6
|
+
deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
|
7
|
+
deb-src http://archive.ubuntu.com/ubuntu/ lucid main
|
8
|
+
|
9
|
+
###### Ubuntu Update Repos
|
10
|
+
deb http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
|
11
|
+
deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
|
12
|
+
deb http://archive.ubuntu.com/ubuntu/ lucid-proposed main restricted universe multiverse
|
13
|
+
deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
|
metadata
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: provizioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
+
- season
|
13
14
|
- Victor Castell
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-09
|
19
|
+
date: 2010-12-09 00:00:00 +01:00
|
19
20
|
default_executable: provizion
|
20
21
|
dependencies: []
|
21
22
|
|
@@ -25,17 +26,51 @@ executables:
|
|
25
26
|
- provizion
|
26
27
|
extensions: []
|
27
28
|
|
28
|
-
extra_rdoc_files:
|
29
|
-
|
29
|
+
extra_rdoc_files:
|
30
|
+
- README
|
30
31
|
files:
|
32
|
+
- lib/policies/chef-client.rb
|
33
|
+
- lib/policies/lamp.rb
|
34
|
+
- lib/policies/passenger.rb
|
35
|
+
- lib/provizioning.rb
|
36
|
+
- lib/recipes/apache.rb
|
37
|
+
- lib/recipes/apache_conf.rb
|
38
|
+
- lib/recipes/bundler.rb
|
39
|
+
- lib/recipes/chef_client.rb
|
40
|
+
- lib/recipes/curl.rb
|
41
|
+
- lib/recipes/essential.rb
|
42
|
+
- lib/recipes/git.rb
|
43
|
+
- lib/recipes/imagemagick.rb
|
44
|
+
- lib/recipes/mailserver.rb
|
45
|
+
- lib/recipes/memcached.rb
|
46
|
+
- lib/recipes/mysql.rb
|
47
|
+
- lib/recipes/nginx.rb
|
48
|
+
- lib/recipes/nginx/init.d
|
49
|
+
- lib/recipes/passenger.rb
|
50
|
+
- lib/recipes/php.rb
|
51
|
+
- lib/recipes/postgresql.rb
|
52
|
+
- lib/recipes/ruby_enterprise.rb
|
53
|
+
- lib/recipes/rvm.rb
|
54
|
+
- lib/recipes/sources.rb
|
55
|
+
- lib/recipes/subversion.rb
|
56
|
+
- lib/recipes/syslog.rb
|
57
|
+
- lib/recipes/ufw.rb
|
58
|
+
- lib/recipes/vim.rb
|
59
|
+
- lib/recipes/webmin.rb
|
60
|
+
- lib/templates/apache.conf.erb
|
61
|
+
- lib/templates/my.cnf
|
62
|
+
- lib/templates/passenger.conf
|
63
|
+
- lib/templates/passenger.load
|
64
|
+
- lib/templates/sources.list
|
65
|
+
- README
|
31
66
|
- bin/provizion
|
32
67
|
has_rdoc: true
|
33
68
|
homepage: http://github.com/seasonlabs/provizioning
|
34
|
-
licenses:
|
35
|
-
- MIT
|
36
|
-
post_install_message:
|
37
|
-
rdoc_options: []
|
69
|
+
licenses: []
|
38
70
|
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options:
|
73
|
+
- --charset=UTF-8
|
39
74
|
require_paths:
|
40
75
|
- lib
|
41
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -43,23 +78,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
78
|
requirements:
|
44
79
|
- - ">="
|
45
80
|
- !ruby/object:Gem::Version
|
46
|
-
hash:
|
81
|
+
hash: 3
|
47
82
|
segments:
|
48
|
-
-
|
49
|
-
|
50
|
-
- 7
|
51
|
-
version: 1.8.7
|
83
|
+
- 0
|
84
|
+
version: "0"
|
52
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
86
|
none: false
|
54
87
|
requirements:
|
55
88
|
- - ">="
|
56
89
|
- !ruby/object:Gem::Version
|
57
|
-
hash:
|
90
|
+
hash: 3
|
58
91
|
segments:
|
59
|
-
-
|
60
|
-
|
61
|
-
- 6
|
62
|
-
version: 1.3.6
|
92
|
+
- 0
|
93
|
+
version: "0"
|
63
94
|
requirements: []
|
64
95
|
|
65
96
|
rubyforge_project:
|