|
fc1830d0
»
|
gabriel |
2008-03-18 |
making standalone again |
1 |
# |
| |
2 |
# Install recipe for Centos 5.1 x86_64 (@base install) |
| |
3 |
# |
| |
4 |
# To use this script: |
| |
5 |
# |
| |
6 |
# cap HOSTS=10.0.6.118:2023 -s user=root -f install.rb install |
| |
7 |
# |
| |
8 |
# Centos 5.1 x86_64 with packages, including: |
|
d0a2e631
»
|
gabriel |
2008-03-18 |
updating install script |
9 |
# * Ruby |
| |
10 |
# * Nginx |
| |
11 |
# * Mysql |
| |
12 |
# * Sphinx |
| |
13 |
# * Monit |
| |
14 |
# * ImageMagick |
| |
15 |
# * Memcached |
| |
16 |
# * Gems: rake, mysql, raspell, rmagick, mongrel, mongrel_cluster, json, mime-types, hpricot |
|
fc1830d0
»
|
gabriel |
2008-03-18 |
making standalone again |
17 |
# |
|
d0a2e631
»
|
gabriel |
2008-03-18 |
updating install script |
18 |
|
|
fc1830d0
»
|
gabriel |
2008-03-18 |
making standalone again |
19 |
load 'deploy' if respond_to?(:namespace) # cap2 differentiator |
|
d0a2e631
»
|
gabriel |
2008-03-18 |
updating install script |
20 |
|
|
fc1830d0
»
|
gabriel |
2008-03-18 |
making standalone again |
21 |
require 'erb' |
| |
22 |
|
| |
23 |
# Load capitate |
| |
24 |
gem 'capitate', '>= 0.2.9' |
| |
25 |
require 'capitate' |
| |
26 |
require 'capitate/recipes' |
| |
27 |
|
| |
28 |
# Load more recipes |
| |
29 |
Dir[File.dirname(__FILE__) + "/recipes/*.rb"].each { |recipe| load recipe } |
| |
30 |
|
| |
31 |
namespace :install do |
| |
32 |
|
| |
33 |
task :default do |
|
118b8a63
»
|
gabriel |
2008-02-22 |
fixing |
34 |
|
|
d0a2e631
»
|
gabriel |
2008-03-18 |
updating install script |
35 |
set :user, "root" |
| |
36 |
set :run_method, :run |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
37 |
check_role |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
38 |
|
| |
39 |
# NTP Setup |
| |
40 |
yum.install([ "ntp" ]) |
| |
41 |
script.run_all <<-CMDS |
| |
42 |
chkconfig --levels 235 ntpd on |
| |
43 |
ntpdate 0.pool.ntp.org |
| |
44 |
/sbin/service ntpd start |
| |
45 |
CMDS |
|
118b8a63
»
|
gabriel |
2008-02-22 |
fixing |
46 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
47 |
# Setup for web |
| |
48 |
# * Add admin group |
| |
49 |
# * Change inittab to runlevel 3 |
| |
50 |
# * Create web apps directory |
| |
51 |
# * Add admin group to suders ALL=(ALL) ALL |
| |
52 |
script.run_all <<-CMDS |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
53 |
egrep "^admin" /etc/group || /usr/sbin/groupadd admin |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
54 |
mkdir -p /var/www/apps |
| |
55 |
egrep "^%admin" /etc/sudoers || echo "%admin ALL=(ALL) ALL" >> /etc/sudoers |
| |
56 |
CMDS |
|
f2df06ba
»
|
gabriel |
2008-02-24 |
fixes for sphinx |
57 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
58 |
# Package installs |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
59 |
yum.update |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
60 |
yum.install [ "gcc", "kernel-devel", "libevent-devel", "libxml2-devel", "openssl", "openssl-devel", |
| |
61 |
"aspell", "aspell-devel", "aspell-en", "aspell-es" ] |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
62 |
|
| |
63 |
yum.clean |
| |
64 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
65 |
# |
| |
66 |
# App installs |
| |
67 |
# |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
68 |
|
| |
69 |
ruby.centos.install |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
70 |
nginx.centos.install |
| |
71 |
mysql.centos.install |
| |
72 |
sphinx.centos.install |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
73 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
74 |
monit.centos.install |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
75 |
# Install firewall rule manually |
| |
76 |
#monit.centos.iptables |
| |
77 |
|
| |
78 |
sshd.monit.install |
| |
79 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
80 |
imagemagick.centos.install |
| |
81 |
memcached.centos.install |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
82 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
83 |
# |
| |
84 |
# Install monit hooks |
| |
85 |
# |
| |
86 |
nginx.monit.install |
| |
87 |
mysql.monit.install |
| |
88 |
memcached.monit.install |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
89 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
90 |
# Install gems |
|
d0a2e631
»
|
gabriel |
2008-03-18 |
updating install script |
91 |
gems_only |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
92 |
|
| |
93 |
# Cleanup |
| |
94 |
yum.clean |
|
d0a2e631
»
|
gabriel |
2008-03-18 |
updating install script |
95 |
|
| |
96 |
# Log rotate tasks |
| |
97 |
monit.logrotate.install |
| |
98 |
nginx.logrotate.install |
| |
99 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
100 |
end |
|
f2df06ba
»
|
gabriel |
2008-02-24 |
fixes for sphinx |
101 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
102 |
desc "Install gems only" |
| |
103 |
task :gems_only do |
| |
104 |
gems.install(fetch(:gems_to_install)) |
| |
105 |
end |
| |
106 |
end |
| |
107 |
|
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
108 |
# Prompt for server if host not given |
| |
109 |
task :check_role do |
| |
110 |
# Can use cap HOSTS=192.168.1.111 install |
| |
111 |
# Otherwise prompt for the service |
| |
112 |
role :install, prompt.ask("Server: ") if find_servers_for_task(current_task).blank? |
| |
113 |
end |
| |
114 |
|
| |
115 |
# For for ruby install |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
116 |
after "ruby:centos:install" do |
| |
117 |
# Fix ruby install openssl |
| |
118 |
script.sh("ruby/fix_openssl.sh") |
|
118b8a63
»
|
gabriel |
2008-02-22 |
fixing |
119 |
end |
| |
120 |
|
| |
121 |
|
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
122 |
# |
| |
123 |
# Install options |
| |
124 |
# |
| |
125 |
|
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
126 |
set :gems_to_install, [ "rake", "mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql --with-mysql-config", |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
127 |
"raspell", "rmagick", "mongrel", "mongrel_cluster", "json", "mime-types", "hpricot" ] |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
128 |
|
| |
129 |
|
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
130 |
# Ruby install |
| |
131 |
set :ruby_build_options, { |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
132 |
:url => "http://capitate.s3.amazonaws.com/ruby-1.8.6-p110.tar.gz", |
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
133 |
:build_dest => "/usr/src", |
| |
134 |
:configure_options => "--prefix=/usr", |
| |
135 |
:clean => false |
| |
136 |
} |
| |
137 |
|
| |
138 |
set :rubygems_build_options, { |
| |
139 |
:url => "http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz" |
| |
140 |
} |
| |
141 |
|
| |
142 |
# Memcached install |
|
118b8a63
»
|
gabriel |
2008-02-22 |
fixing |
143 |
set :memcached_pid_path, "/var/run/memcached.pid" |
| |
144 |
set :memcached_memory, 64 |
| |
145 |
set :memcached_port, 11211 |
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
146 |
set :memcached_build_options, { |
| |
147 |
:url => "http://www.danga.com/memcached/dist/memcached-1.2.4.tar.gz", |
| |
148 |
:configure_options => "--prefix=/usr/local" |
| |
149 |
} |
| |
150 |
|
| |
151 |
# Monit install |
| |
152 |
set :monit_conf_dir, "/etc/monit" |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
153 |
set :monit_pid_path, "/var/run/monit.pid" |
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
154 |
set :monit_port, 2812 |
| |
155 |
set :monit_build_options, { |
| |
156 |
:url => "http://www.tildeslash.com/monit/dist/monit-4.10.1.tar.gz" |
| |
157 |
} |
| |
158 |
|
| |
159 |
# Nginx install |
| |
160 |
set :nginx_bin_path, "/sbin/nginx" |
| |
161 |
set :nginx_conf_path, "/etc/nginx/nginx.conf" |
| |
162 |
set :nginx_pid_path, "/var/run/nginx.pid" |
| |
163 |
set :nginx_prefix_path, "/var/nginx" |
| |
164 |
set :nginx_build_options, { |
| |
165 |
:url => "http://sysoev.ru/nginx/nginx-0.5.35.tar.gz", |
| |
166 |
:configure_options => "--sbin-path=#{nginx_bin_path} --conf-path=#{nginx_conf_path} \ |
| |
167 |
--pid-path=#{nginx_pid_path} --error-log-path=/var/log/nginx_master_error.log --lock-path=/var/lock/nginx \ |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
168 |
--prefix=#{nginx_prefix_path} --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 --with-http_ssl_module \ |
| |
169 |
--with-http_flv_module" |
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
170 |
} |
|
118b8a63
»
|
gabriel |
2008-02-22 |
fixing |
171 |
|
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
172 |
# Sphinx install |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
173 |
set :sphinx_prefix, "/usr/local/sphinx-0.9.8-rc1" |
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
174 |
set :sphinx_build_options, { |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
175 |
:url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.8-rc1.tar.gz", |
| |
176 |
:configure_options => "--with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib64/mysql --prefix=#{sphinx_prefix}", |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
177 |
:symlink => { sphinx_prefix => "/usr/local/sphinx" } |
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
178 |
} |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
179 |
# Other possible sphinx_build_options |
| |
180 |
# :url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.7.tar.gz", |
| |
181 |
# :configure_options => "--with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql --prefix=#{sphinx_prefix}", |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
182 |
|
| |
183 |
|
| |
184 |
# For mysql:install |
|
9a33ce7b
»
|
gabriel |
2008-02-24 |
fixing admin >> sudoers exa... |
185 |
set :mysql_pid_path, "/var/run/mysqld/mysqld.pid" |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
186 |
set :mysql_port, 3306 |
|
9a33ce7b
»
|
gabriel |
2008-02-24 |
fixing admin >> sudoers exa... |
187 |
|
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
188 |
# Imagemagick install |
| |
189 |
set :imagemagick_build_options, { |
|
cf3ea749
»
|
Gabe |
2008-03-10 |
Recipe fixes |
190 |
:url => "http://capitate.s3.amazonaws.com/ImageMagick.tar.gz", |
|
4a5a4bf6
»
|
gabriel |
2008-02-24 |
adding build options for in... |
191 |
:unpack_dir => "ImageMagick-*" |
| |
192 |
} |
|
31bed1c4
»
|
Gabe |
2008-03-13 |
moving sample install recip... |
193 |
|
| |
194 |
# For sshd:monit:install |
|
886420dc
»
|
Gabe |
2008-03-13 |
fixing sshd pid path |
195 |
set :sshd_pid_path, "/var/run/sshd.pid" |
| |
196 |
set :sshd_port, 2023 |