elzar 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.chef/knife.rb +3 -0
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +96 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/Vagrantfile +16 -0
- data/cookbooks/.gitkeep +0 -0
- data/cookbooks/apt/README.md +122 -0
- data/cookbooks/apt/files/default/apt-cacher +9 -0
- data/cookbooks/apt/files/default/apt-cacher.conf +144 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/metadata.rb +13 -0
- data/cookbooks/apt/providers/repository.rb +73 -0
- data/cookbooks/apt/recipes/cacher-client.rb +44 -0
- data/cookbooks/apt/recipes/cacher.rb +45 -0
- data/cookbooks/apt/recipes/default.rb +50 -0
- data/cookbooks/apt/resources/repository.rb +30 -0
- data/cookbooks/build-essential/README.md +24 -0
- data/cookbooks/build-essential/metadata.rb +10 -0
- data/cookbooks/build-essential/recipes/default.rb +45 -0
- data/cookbooks/database/README.md +403 -0
- data/cookbooks/database/libraries/provider_database_mysql.rb +97 -0
- data/cookbooks/database/libraries/provider_database_mysql_user.rb +76 -0
- data/cookbooks/database/libraries/provider_database_postgresql.rb +126 -0
- data/cookbooks/database/libraries/provider_database_postgresql_user.rb +78 -0
- data/cookbooks/database/libraries/provider_database_sql_server.rb +109 -0
- data/cookbooks/database/libraries/provider_database_sql_server_user.rb +106 -0
- data/cookbooks/database/libraries/resource_database.rb +111 -0
- data/cookbooks/database/libraries/resource_database_user.rb +90 -0
- data/cookbooks/database/libraries/resource_mysql_database.rb +34 -0
- data/cookbooks/database/libraries/resource_mysql_database_user.rb +34 -0
- data/cookbooks/database/libraries/resource_postgresql_database.rb +35 -0
- data/cookbooks/database/libraries/resource_postgresql_database_user.rb +35 -0
- data/cookbooks/database/libraries/resource_sql_server_database.rb +34 -0
- data/cookbooks/database/libraries/resource_sql_server_database_user.rb +34 -0
- data/cookbooks/database/metadata.rb +21 -0
- data/cookbooks/database/recipes/default.rb +20 -0
- data/cookbooks/database/recipes/ebs_backup.rb +89 -0
- data/cookbooks/database/recipes/ebs_volume.rb +196 -0
- data/cookbooks/database/recipes/master.rb +78 -0
- data/cookbooks/database/recipes/snapshot.rb +62 -0
- data/cookbooks/database/templates/default/app_grants.sql.erb +8 -0
- data/cookbooks/database/templates/default/aws_config.erb +3 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.cron.erb +10 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.json.erb +1 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.rb.erb +6 -0
- data/cookbooks/database/templates/default/ebs-backup-cron.erb +2 -0
- data/cookbooks/database/templates/default/ebs-db-backup.sh.erb +8 -0
- data/cookbooks/database/templates/default/ebs-db-restore.sh.erb +10 -0
- data/cookbooks/database/templates/default/s3cfg.erb +27 -0
- data/cookbooks/mysql/README.md +148 -0
- data/cookbooks/mysql/attributes/server.rb +68 -0
- data/cookbooks/mysql/libraries/database.rb +19 -0
- data/cookbooks/mysql/libraries/helpers.rb +33 -0
- data/cookbooks/mysql/metadata.rb +90 -0
- data/cookbooks/mysql/recipes/client.rb +51 -0
- data/cookbooks/mysql/recipes/default.rb +20 -0
- data/cookbooks/mysql/recipes/server.rb +133 -0
- data/cookbooks/mysql/recipes/server_ec2.rb +49 -0
- data/cookbooks/mysql/templates/default/debian.cnf.erb +12 -0
- data/cookbooks/mysql/templates/default/grants.sql.erb +15 -0
- data/cookbooks/mysql/templates/default/my.cnf.erb +176 -0
- data/cookbooks/mysql/templates/default/mysql-server.seed.erb +10 -0
- data/cookbooks/mysql/templates/default/port_mysql.erb +3 -0
- data/cookbooks/openssl/README.md +37 -0
- data/cookbooks/openssl/libraries/secure_password.rb +37 -0
- data/cookbooks/openssl/metadata.rb +8 -0
- data/cookbooks/openssl/recipes/default.rb +19 -0
- data/cookbooks/passenger_enterprise/README.rdoc +8 -0
- data/cookbooks/passenger_enterprise/attributes/default.rb +28 -0
- data/cookbooks/passenger_enterprise/cc.gemspec +36 -0
- data/cookbooks/passenger_enterprise/metadata.json +44 -0
- data/cookbooks/passenger_enterprise/metadata.rb +16 -0
- data/cookbooks/passenger_enterprise/recipes/apache2.rb +54 -0
- data/cookbooks/passenger_enterprise/recipes/default.rb +30 -0
- data/cookbooks/passenger_enterprise/recipes/nginx.rb +50 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger.conf.erb +2 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger.load.erb +1 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger_nginx.conf.erb +2 -0
- data/cookbooks/ruby_enterprise/README.rdoc +55 -0
- data/cookbooks/ruby_enterprise/attributes/default.rb +33 -0
- data/cookbooks/ruby_enterprise/cc.gemspec +36 -0
- data/cookbooks/ruby_enterprise/definitions/ree_gem.rb +28 -0
- data/cookbooks/ruby_enterprise/metadata.json +45 -0
- data/cookbooks/ruby_enterprise/metadata.rb +13 -0
- data/cookbooks/ruby_enterprise/recipes/default.rb +67 -0
- data/data_bags/deploy/authorized_keys.json +9 -0
- data/dna.json +25 -0
- data/elzar.gemspec +22 -0
- data/lib/elzar.rb +21 -0
- data/lib/elzar/assistant.rb +77 -0
- data/lib/elzar/chef_dna.rb +48 -0
- data/lib/elzar/template.rb +24 -0
- data/lib/elzar/templates/Gemfile +11 -0
- data/lib/elzar/templates/Vagrantfile.erb +16 -0
- data/lib/elzar/templates/dna.json +25 -0
- data/lib/elzar/templates/solo.rb.erb +6 -0
- data/lib/elzar/version.rb +3 -0
- data/roles/enterprise_appstack.rb +4 -0
- data/roles/plumbing.rb +11 -0
- data/roles/postgres_database.rb +4 -0
- data/roles/ruby_appstack.rb +4 -0
- data/script/install_cookbook +6 -0
- data/script/new_cookbook +5 -0
- data/site-cookbooks/.gitkeep +0 -0
- data/site-cookbooks/curl/README.md +17 -0
- data/site-cookbooks/curl/metadata.rb +6 -0
- data/site-cookbooks/curl/recipes/default.rb +11 -0
- data/site-cookbooks/nginx/CHANGELOG.md +11 -0
- data/site-cookbooks/nginx/CONTRIBUTING +29 -0
- data/site-cookbooks/nginx/LICENSE +201 -0
- data/site-cookbooks/nginx/README.md +76 -0
- data/site-cookbooks/nginx/attributes/default.rb +65 -0
- data/site-cookbooks/nginx/definitions/nginx_site.rb +35 -0
- data/site-cookbooks/nginx/files/default/mime.types +73 -0
- data/site-cookbooks/nginx/metadata.rb +89 -0
- data/site-cookbooks/nginx/recipes/default.rb +57 -0
- data/site-cookbooks/nginx/recipes/source.rb +126 -0
- data/site-cookbooks/nginx/templates/default/default-site.erb +11 -0
- data/site-cookbooks/nginx/templates/default/nginx.conf.erb +42 -0
- data/site-cookbooks/nginx/templates/default/nginx.init.erb +91 -0
- data/site-cookbooks/nginx/templates/default/nxdissite.erb +29 -0
- data/site-cookbooks/nginx/templates/default/nxensite.erb +38 -0
- data/site-cookbooks/passenger/README.md +12 -0
- data/site-cookbooks/passenger/attributes/default.rb +3 -0
- data/site-cookbooks/passenger/metadata.rb +6 -0
- data/site-cookbooks/passenger/recipes/default.rb +39 -0
- data/site-cookbooks/passenger/templates/default/passenger_nginx.conf.erb +2 -0
- data/site-cookbooks/postgresql/README.md +150 -0
- data/site-cookbooks/postgresql/attributes/default.rb +72 -0
- data/site-cookbooks/postgresql/metadata.rb +21 -0
- data/site-cookbooks/postgresql/recipes/client.rb +40 -0
- data/site-cookbooks/postgresql/recipes/default.rb +20 -0
- data/site-cookbooks/postgresql/recipes/server.rb +74 -0
- data/site-cookbooks/postgresql/recipes/server_debian.rb +62 -0
- data/site-cookbooks/postgresql/recipes/server_redhat.rb +82 -0
- data/site-cookbooks/postgresql/templates/default/debian.postgresql.conf.erb +499 -0
- data/site-cookbooks/postgresql/templates/default/pg_hba.conf.erb +83 -0
- data/site-cookbooks/postgresql/templates/default/redhat.postgresql.conf.erb +501 -0
- data/site-cookbooks/rails_app/README.md +15 -0
- data/site-cookbooks/rails_app/attributes/default.rb +2 -0
- data/site-cookbooks/rails_app/files/default/sudoers +26 -0
- data/site-cookbooks/rails_app/metadata.rb +6 -0
- data/site-cookbooks/rails_app/recipes/default.rb +143 -0
- data/site-cookbooks/rails_app/recipes/system_libraries.rb +12 -0
- data/site-cookbooks/rails_app/templates/default/pg_hba.conf.erb +84 -0
- data/site-cookbooks/rails_app/templates/default/rails_app_nginx.erb +10 -0
- data/site-cookbooks/ruby/README.md +12 -0
- data/site-cookbooks/ruby/attributes/default.rb +6 -0
- data/site-cookbooks/ruby/metadata.rb +6 -0
- data/site-cookbooks/ruby/recipes/default.rb +54 -0
- data/solo.rb +7 -0
- data/upgrade-chef.sh +8 -0
- metadata +272 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
user <%= node[:nginx][:user] %>;
|
|
2
|
+
worker_processes <%= node[:nginx][:worker_processes] %>;
|
|
3
|
+
<% if node[:nginx][:daemon_disable] -%>
|
|
4
|
+
daemon off;
|
|
5
|
+
<% end -%>
|
|
6
|
+
|
|
7
|
+
error_log <%= node[:nginx][:log_dir] %>/error.log;
|
|
8
|
+
pid <%= node[:nginx][:pid] %>;
|
|
9
|
+
|
|
10
|
+
events {
|
|
11
|
+
worker_connections <%= node[:nginx][:worker_connections] %>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
http {
|
|
15
|
+
include <%= node[:nginx][:dir] %>/mime.types;
|
|
16
|
+
default_type application/octet-stream;
|
|
17
|
+
|
|
18
|
+
<% unless node[:nginx][:disable_access_log] -%>
|
|
19
|
+
access_log <%= node[:nginx][:log_dir] %>/access.log;
|
|
20
|
+
<% end %>
|
|
21
|
+
|
|
22
|
+
sendfile on;
|
|
23
|
+
tcp_nopush on;
|
|
24
|
+
tcp_nodelay on;
|
|
25
|
+
|
|
26
|
+
<% if node[:nginx][:keepalive] == "on" %>
|
|
27
|
+
keepalive_timeout <%= node[:nginx][:keepalive_timeout] %>;
|
|
28
|
+
<% end %>
|
|
29
|
+
|
|
30
|
+
gzip <%= node[:nginx][:gzip] %>;
|
|
31
|
+
<% if node[:nginx][:gzip] == "on" %>
|
|
32
|
+
gzip_http_version <%= node[:nginx][:gzip_http_version] %>;
|
|
33
|
+
gzip_comp_level <%= node[:nginx][:gzip_comp_level] %>;
|
|
34
|
+
gzip_proxied <%= node[:nginx][:gzip_proxied] %>;
|
|
35
|
+
gzip_types <%= node[:nginx][:gzip_types].join(' ') %>;
|
|
36
|
+
<% end %>
|
|
37
|
+
|
|
38
|
+
server_names_hash_bucket_size <%= node[:nginx][:server_names_hash_bucket_size] %>;
|
|
39
|
+
|
|
40
|
+
include <%= node[:nginx][:dir] %>/conf.d/*.conf;
|
|
41
|
+
include <%= node[:nginx][:dir] %>/sites-enabled/*;
|
|
42
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#! /bin/sh
|
|
2
|
+
|
|
3
|
+
### BEGIN INIT INFO
|
|
4
|
+
# Provides: nginx
|
|
5
|
+
# Required-Start: $local_fs $remote_fs $network $syslog
|
|
6
|
+
# Required-Stop: $local_fs $remote_fs $network $syslog
|
|
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
|
+
PATH=<%= node[:nginx][:install_path] %>/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
14
|
+
DAEMON=<%= node[:nginx][:src_binary] %>
|
|
15
|
+
NAME=nginx
|
|
16
|
+
DESC=nginx
|
|
17
|
+
PID=/var/run/$NAME.pid
|
|
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
|
+
. /lib/lsb/init-functions
|
|
29
|
+
|
|
30
|
+
test_nginx_config() {
|
|
31
|
+
echo -n "Testing $DESC configuration: "
|
|
32
|
+
if nginx -t $DAEMON_OPTS
|
|
33
|
+
then
|
|
34
|
+
echo "$NAME."
|
|
35
|
+
else
|
|
36
|
+
exit $?
|
|
37
|
+
fi
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
start() {
|
|
41
|
+
test_nginx_config
|
|
42
|
+
if [ ! -s $PID ]
|
|
43
|
+
then
|
|
44
|
+
echo -n "Starting $DESC: "
|
|
45
|
+
$DAEMON
|
|
46
|
+
else
|
|
47
|
+
echo -n "$DESC already started"
|
|
48
|
+
fi
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
stop() {
|
|
52
|
+
echo -n "Stopping $DESC: "
|
|
53
|
+
$DAEMON -s stop
|
|
54
|
+
echo "$NAME."
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
reload() {
|
|
58
|
+
echo -n "Reloading $DESC configuration: "
|
|
59
|
+
test_nginx_config
|
|
60
|
+
$DAEMON -s reload
|
|
61
|
+
echo "$NAME."
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
case "$1" in
|
|
65
|
+
start)
|
|
66
|
+
start
|
|
67
|
+
;;
|
|
68
|
+
stop)
|
|
69
|
+
stop
|
|
70
|
+
;;
|
|
71
|
+
restart|force-reload)
|
|
72
|
+
stop
|
|
73
|
+
sleep 1
|
|
74
|
+
start
|
|
75
|
+
;;
|
|
76
|
+
reload)
|
|
77
|
+
reload
|
|
78
|
+
;;
|
|
79
|
+
configtest)
|
|
80
|
+
test_nginx_config
|
|
81
|
+
;;
|
|
82
|
+
status)
|
|
83
|
+
status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
|
|
84
|
+
;;
|
|
85
|
+
*)
|
|
86
|
+
echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2
|
|
87
|
+
exit 1
|
|
88
|
+
;;
|
|
89
|
+
esac
|
|
90
|
+
|
|
91
|
+
exit 0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/sh -e
|
|
2
|
+
|
|
3
|
+
SYSCONFDIR='<%= node[:nginx][:dir] %>'
|
|
4
|
+
|
|
5
|
+
if [ -z $1 ]; then
|
|
6
|
+
echo "Which site would you like to disable?"
|
|
7
|
+
echo -n "Your choices are: "
|
|
8
|
+
ls $SYSCONFDIR/sites-enabled/* | \
|
|
9
|
+
sed -e "s,$SYSCONFDIR/sites-enabled/,,g" | xargs echo
|
|
10
|
+
echo -n "Site name? "
|
|
11
|
+
read SITENAME
|
|
12
|
+
else
|
|
13
|
+
SITENAME=$1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ $SITENAME = "default" ]; then
|
|
17
|
+
PRIORITY="000"
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if ! [ -e $SYSCONFDIR/sites-enabled/$SITENAME -o \
|
|
21
|
+
-e $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" ]; then
|
|
22
|
+
echo "This site is already disabled, or does not exist!"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if ! rm $SYSCONFDIR/sites-enabled/$SITENAME 2>/dev/null; then
|
|
27
|
+
rm -f $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME"
|
|
28
|
+
fi
|
|
29
|
+
echo "Site $SITENAME disabled; reload nginx to disable."
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/bin/sh -e
|
|
2
|
+
|
|
3
|
+
SYSCONFDIR='<%= node[:nginx][:dir] %>'
|
|
4
|
+
|
|
5
|
+
if [ -z $1 ]; then
|
|
6
|
+
echo "Which site would you like to enable?"
|
|
7
|
+
echo -n "Your choices are: "
|
|
8
|
+
ls $SYSCONFDIR/sites-available/* | \
|
|
9
|
+
sed -e "s,$SYSCONFDIR/sites-available/,,g" | xargs echo
|
|
10
|
+
echo -n "Site name? "
|
|
11
|
+
read SITENAME
|
|
12
|
+
else
|
|
13
|
+
SITENAME=$1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ $SITENAME = "default" ]; then
|
|
17
|
+
PRIORITY="000"
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if [ -e $SYSCONFDIR/sites-enabled/$SITENAME -o \
|
|
21
|
+
-e $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" ]; then
|
|
22
|
+
echo "This site is already enabled!"
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if ! [ -e $SYSCONFDIR/sites-available/$SITENAME ]; then
|
|
27
|
+
echo "This site does not exist!"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
if [ $SITENAME = "default" ]; then
|
|
32
|
+
ln -sf $SYSCONFDIR/sites-available/$SITENAME \
|
|
33
|
+
$SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME"
|
|
34
|
+
else
|
|
35
|
+
ln -sf $SYSCONFDIR/sites-available/$SITENAME $SYSCONFDIR/sites-enabled/$SITENAME
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
echo "Site $SITENAME installed; reload nginx to enable."
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Cookbook Name:: passenger
|
|
3
|
+
# Recipe:: default
|
|
4
|
+
#
|
|
5
|
+
# Copyright 2012, Relevance
|
|
6
|
+
#
|
|
7
|
+
# All rights reserved - Do Not Redistribute
|
|
8
|
+
#
|
|
9
|
+
include_recipe "ruby"
|
|
10
|
+
include_recipe "nginx::source"
|
|
11
|
+
|
|
12
|
+
configure_flags = node[:nginx][:configure_flags].join(" ")
|
|
13
|
+
nginx_install = node[:nginx][:install_path]
|
|
14
|
+
nginx_version = node[:nginx][:version]
|
|
15
|
+
nginx_dir = node[:nginx][:dir]
|
|
16
|
+
|
|
17
|
+
execute "install passenger" do
|
|
18
|
+
command "#{node[:ruby][:install_path]}/bin/gem install passenger --no-ri --no-rdoc -v #{node[:passenger][:version]}"
|
|
19
|
+
not_if "#{node[:ruby][:install_path]}/bin/gem list -l passenger$ | grep -q #{node[:passenger][:version]}"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
execute "passenger_nginx_module" do
|
|
23
|
+
command %Q{
|
|
24
|
+
#{node[:ruby][:install_path]}/bin/passenger-install-nginx-module \
|
|
25
|
+
--auto --prefix=#{nginx_install} \
|
|
26
|
+
--nginx-source-dir=#{Chef::Config[:file_cache_path]}/nginx-#{nginx_version} \
|
|
27
|
+
--extra-configure-flags='#{configure_flags}'
|
|
28
|
+
}
|
|
29
|
+
not_if "#{nginx_install}/sbin/nginx -V 2>&1 | grep '#{node[:ruby][:gems_dir]}/passenger-#{node[:passenger][:version]}/ext/nginx'"
|
|
30
|
+
notifies :restart, resources(:service => "nginx")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
template "#{nginx_dir}/conf.d/passenger.conf" do
|
|
34
|
+
source "passenger_nginx.conf.erb"
|
|
35
|
+
owner "root"
|
|
36
|
+
group "root"
|
|
37
|
+
mode "0644"
|
|
38
|
+
notifies :restart, resources(:service => "nginx")
|
|
39
|
+
end
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Description
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
Installs and configures PostgreSQL as a client or a server.
|
|
5
|
+
|
|
6
|
+
Requirements
|
|
7
|
+
============
|
|
8
|
+
|
|
9
|
+
## Platforms
|
|
10
|
+
|
|
11
|
+
* Debian, Ubuntu
|
|
12
|
+
* Red Hat/CentOS/Scientific (6.0+ required) - "EL6-family"
|
|
13
|
+
* Fedora
|
|
14
|
+
* SUSE
|
|
15
|
+
|
|
16
|
+
Tested on:
|
|
17
|
+
|
|
18
|
+
* Ubuntu 10.04, 11.10
|
|
19
|
+
* Red Hat 6.1, Scientific 6.1
|
|
20
|
+
|
|
21
|
+
## Cookboooks
|
|
22
|
+
|
|
23
|
+
Requires Opscode's `openssl` cookbook for secure password generation.
|
|
24
|
+
|
|
25
|
+
Requires a C compiler and development headers in order to build the
|
|
26
|
+
`pg` RubyGem to provide Ruby bindings so they're available in other
|
|
27
|
+
cookbooks.
|
|
28
|
+
|
|
29
|
+
Opscode's `build-essential` cookbook provides this functionality on
|
|
30
|
+
Debian, Ubuntu, and EL6-family.
|
|
31
|
+
|
|
32
|
+
While not required, Opscode's `database` cookbook contains resources
|
|
33
|
+
and providers that can interact with a PostgreSQL database. This
|
|
34
|
+
cookbook is a dependency of that one.
|
|
35
|
+
|
|
36
|
+
Attributes
|
|
37
|
+
==========
|
|
38
|
+
|
|
39
|
+
The following attributes are set based on the platform, see the
|
|
40
|
+
`attributes/default.rb` file for default values.
|
|
41
|
+
|
|
42
|
+
* `node['postgresql']['version']` - version of postgresql to manage
|
|
43
|
+
* `node['postgresql']['dir']` - home directory of where postgresql
|
|
44
|
+
data and configuration lives.
|
|
45
|
+
|
|
46
|
+
The following attributes are generated in
|
|
47
|
+
`recipe[postgresql::server]`.
|
|
48
|
+
|
|
49
|
+
* `node['postgresql']['password']['postgres']` - randomly generated
|
|
50
|
+
password by the `openssl` cookbook's library.
|
|
51
|
+
* `node['postgresql']['ssl']` - whether to enable SSL (off for version
|
|
52
|
+
8.3, true for 8.4).
|
|
53
|
+
|
|
54
|
+
Recipes
|
|
55
|
+
=======
|
|
56
|
+
|
|
57
|
+
default
|
|
58
|
+
-------
|
|
59
|
+
|
|
60
|
+
Includes the client recipe.
|
|
61
|
+
|
|
62
|
+
client
|
|
63
|
+
------
|
|
64
|
+
|
|
65
|
+
Installs postgresql client packages and development headers during the
|
|
66
|
+
compile phase. Also installs the `pg` Ruby gem during the compile
|
|
67
|
+
phase so it can be made available for the `database` cookbook's
|
|
68
|
+
resources, providers and libraries.
|
|
69
|
+
|
|
70
|
+
server
|
|
71
|
+
------
|
|
72
|
+
|
|
73
|
+
Includes the `server_debian` or `server_redhat` recipe to get the
|
|
74
|
+
appropriate server packages installed and service managed. Also
|
|
75
|
+
manages the configuration for the server:
|
|
76
|
+
|
|
77
|
+
* generates a strong default password (via `openssl`) for `postgres`
|
|
78
|
+
* sets the password for postgres
|
|
79
|
+
* manages the `pg_hba.conf` file.
|
|
80
|
+
|
|
81
|
+
server\_debian
|
|
82
|
+
--------------
|
|
83
|
+
|
|
84
|
+
Installs the postgresql server packages, manages the postgresql
|
|
85
|
+
service and the postgresql.conf file.
|
|
86
|
+
|
|
87
|
+
server\_redhat
|
|
88
|
+
--------------
|
|
89
|
+
|
|
90
|
+
Manages the postgres user and group (with UID/GID 26, per RHEL package
|
|
91
|
+
conventions), installs the postgresql server packages, initializes the
|
|
92
|
+
database and manages the postgresql service, and manages the
|
|
93
|
+
postgresql.conf file.
|
|
94
|
+
|
|
95
|
+
Resources/Providers
|
|
96
|
+
===================
|
|
97
|
+
|
|
98
|
+
See the [database](http://community.opscode.com/cookbooks/database)
|
|
99
|
+
for resources and providers that can be used for managing PostgreSQL
|
|
100
|
+
users and databases.
|
|
101
|
+
|
|
102
|
+
Usage
|
|
103
|
+
=====
|
|
104
|
+
|
|
105
|
+
On systems that need to connect to a PostgreSQL database, add to a run
|
|
106
|
+
list `recipe[postgresql]` or `recipe[postgresql::client]`.
|
|
107
|
+
|
|
108
|
+
This does install the `pg` RubyGem, which has native C extensions, so
|
|
109
|
+
that the resources and providers can be used in the `database`
|
|
110
|
+
cookbook, or elsewhere in the same Chef run. Use Opscode's
|
|
111
|
+
`build-essential` cookbook to make sure the proper build tools are
|
|
112
|
+
installed so the C extensions can be compiled.
|
|
113
|
+
|
|
114
|
+
On systems that should be PostgreSQL servers, use
|
|
115
|
+
`recipe[postgresql::server]` on a run list. This recipe does set a
|
|
116
|
+
password and expect to use it. It performs a node.save when Chef is
|
|
117
|
+
not running in `solo` mode. If you're using `chef-solo`, you'll need
|
|
118
|
+
to set the attribute `node['postgresql']['password']['postgres']` in
|
|
119
|
+
your node's `json_attribs` file or in a role.
|
|
120
|
+
|
|
121
|
+
Changes/Roadmap
|
|
122
|
+
==============
|
|
123
|
+
|
|
124
|
+
## v0.99.2:
|
|
125
|
+
|
|
126
|
+
* [COOK-916] - use < (with float) for version comparison.
|
|
127
|
+
|
|
128
|
+
## v0.99.0:
|
|
129
|
+
|
|
130
|
+
* Better support for Red Hat-family platforms
|
|
131
|
+
* Integration with database cookbook
|
|
132
|
+
* Make sure the postgres role is updated with a (secure) password
|
|
133
|
+
|
|
134
|
+
License and Author
|
|
135
|
+
==================
|
|
136
|
+
|
|
137
|
+
Author:: Joshua Timberman (<joshua@opscode.com>)
|
|
138
|
+
Author:: Lamont Granquist (<lamont@opscode.com>)
|
|
139
|
+
|
|
140
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
+
you may not use this file except in compliance with the License.
|
|
142
|
+
You may obtain a copy of the License at
|
|
143
|
+
|
|
144
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
+
|
|
146
|
+
Unless required by applicable law or agreed to in writing, software
|
|
147
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
+
See the License for the specific language governing permissions and
|
|
150
|
+
limitations under the License.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Cookbook Name:: postgresql
|
|
3
|
+
# Attributes:: postgresql
|
|
4
|
+
#
|
|
5
|
+
# Copyright 2008-2009, Opscode, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
case platform
|
|
21
|
+
when "debian"
|
|
22
|
+
|
|
23
|
+
if platform_version.to_f == 5.0
|
|
24
|
+
default[:postgresql][:version] = "8.3"
|
|
25
|
+
elsif platform_version =~ /squeeze/
|
|
26
|
+
default[:postgresql][:version] = "8.4"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
set[:postgresql][:dir] = "/etc/postgresql/#{node[:postgresql][:version]}/main"
|
|
30
|
+
|
|
31
|
+
when "ubuntu"
|
|
32
|
+
|
|
33
|
+
case
|
|
34
|
+
when platform_version.to_f <= 9.04
|
|
35
|
+
default[:postgresql][:version] = "8.3"
|
|
36
|
+
when platform_version.to_f <= 11.04
|
|
37
|
+
default[:postgresql][:version] = "8.4"
|
|
38
|
+
else
|
|
39
|
+
default[:postgresql][:version] = "9.1"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
set[:postgresql][:dir] = "/etc/postgresql/#{node[:postgresql][:version]}/main"
|
|
43
|
+
|
|
44
|
+
when "fedora"
|
|
45
|
+
|
|
46
|
+
if platform_version.to_f <= 12
|
|
47
|
+
default[:postgresql][:version] = "8.3"
|
|
48
|
+
else
|
|
49
|
+
default[:postgresql][:version] = "8.4"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
set[:postgresql][:dir] = "/var/lib/pgsql/data"
|
|
53
|
+
|
|
54
|
+
when "redhat","centos","scientific","amazon"
|
|
55
|
+
|
|
56
|
+
default[:postgresql][:version] = "8.4"
|
|
57
|
+
set[:postgresql][:dir] = "/var/lib/pgsql/data"
|
|
58
|
+
|
|
59
|
+
when "suse"
|
|
60
|
+
|
|
61
|
+
if platform_version.to_f <= 11.1
|
|
62
|
+
default[:postgresql][:version] = "8.3"
|
|
63
|
+
else
|
|
64
|
+
default[:postgresql][:version] = "8.4"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
set[:postgresql][:dir] = "/var/lib/pgsql/data"
|
|
68
|
+
|
|
69
|
+
else
|
|
70
|
+
default[:postgresql][:version] = "8.4"
|
|
71
|
+
set[:postgresql][:dir] = "/etc/postgresql/#{node[:postgresql][:version]}/main"
|
|
72
|
+
end
|