lib/deployment/install-centos-rubyweb.rb in capitate-0.2.6 vs lib/deployment/install-centos-rubyweb.rb in capitate-0.2.7
- old
+ new
@@ -1,80 +1,106 @@
#
-# This is an EXAMPLE deployment script based on some recipes in Capitate.
-#
-
-#
# For installing apps on the thoughpolice centos 5.1 image
#
-task :install do
+
+task :check_role do
+ # Can use cap HOSTS=192.168.1.111 install
+ # Otherwise prompt for the service
+ role :install, prompt.ask("Server: ") if find_servers_for_task(current_task).blank?
+end
+
+namespace :install do
+
+ task :default do
- # Set templates dir to this here gem
- set :templates_dirs, [ File.dirname(__FILE__) + "/../templates" ]
+ # Add a templates dir
+ # set :templates_dirs, [ File.dirname(__FILE__) + "/../templates" ]
- set :user, "root"
- set :run_method, :run
+ set :user, "root"
+ set :run_method, :run
- # Can use cap HOSTS=192.168.1.111 install
- # Otherwise prompt for the service
- role :install, prompt.ask("Server: ") if find_servers_for_task(current_task).blank?
+ check_role
- # Setup for web
- # * Add admin group
- # * Change inittab to runlevel 3
- # * Create web apps directory
- # * Add admin group to suders ALL=(ALL) ALL
- script.run_all <<-CMDS
- egrep "^admin" /etc/group || /usr/sbin/groupadd admin
- sed -i -e 's/^id:5:initdefault:/id:3:initdefault:/g' /etc/inittab
- mkdir -p /var/www/apps
- egrep "^%admin" /etc/sudoers || echo "%admin ALL=(ALL) ALL" >> /etc/sudoers
- CMDS
+ # Setup for web
+ # * Add admin group
+ # * Change inittab to runlevel 3
+ # * Create web apps directory
+ # * Add admin group to suders ALL=(ALL) ALL
+ script.run_all <<-CMDS
+ egrep "^admin" /etc/group || /usr/sbin/groupadd admin
+ sed -i -e 's/^id:5:initdefault:/id:3:initdefault:/g' /etc/inittab
+ mkdir -p /var/www/apps
+ egrep "^%admin" /etc/sudoers || echo "%admin ALL=(ALL) ALL" >> /etc/sudoers
+ CMDS
- # Package installs
- yum.remove [ "openoffice.org-*", "ImageMagick" ]
- yum.update
- yum.install [ "gcc", "kernel-devel", "libevent-devel", "libxml2-devel", "openssl", "openssl-devel",
- "aspell", "aspell-devel", "aspell-en", "aspell-es" ]
+ # Package installs
+ yum.remove [ "openoffice.org-*", "ImageMagick" ]
+ #yum.update
+ yum.install [ "gcc", "kernel-devel", "libevent-devel", "libxml2-devel", "openssl", "openssl-devel",
+ "aspell", "aspell-devel", "aspell-en", "aspell-es" ]
- #
- # App installs
- #
+ #
+ # App installs
+ #
- ruby.centos.install
- # Fix ruby install openssl
- script.sh("ruby/fix_openssl.sh")
+ ruby.centos.install
- nginx.centos.install
- mysql.centos.install
- sphinx.centos.install
- monit.centos.install
- imagemagick.centos.install
- memcached.centos.install
+ nginx.centos.install
+ mysql.centos.install
+ sphinx.centos.install
+ monit.centos.install
+ imagemagick.centos.install
+ memcached.centos.install
- #
- # Install monit hooks
- #
- nginx.monit.install
- mysql.monit.install
- memcached.monit.install
+ #
+ # Install monit hooks
+ #
+ nginx.monit.install
+ mysql.monit.install
+ memcached.monit.install
- # Gem installs
- gems.install([ "rake", "mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql --with-mysql-config",
- "raspell", "rmagick", "mongrel", "mongrel_cluster","json", "mime-types" ])
+ # Install gems
+ gems.install(fetch(:gems_to_install))
+
+ # Cleanup
+ yum.clean
+ end
- # Cleanup
- yum.clean
+ desc "Install gems only"
+ task :gems_only do
+ gems.install(fetch(:gems_to_install))
+ end
end
+#
+# To be root, cap as_root nginx:centos:install
+#
+desc "Be root"
+task :as_root do
+ set :user, "root"
+end
#
+# Fixes
+#
+after "ruby:centos:install" do
+ # Fix ruby install openssl
+ script.sh("ruby/fix_openssl.sh")
+end
+
+
+#
# Install options
#
+set :gems_to_install, [ "rake", "mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql --with-mysql-config",
+ "raspell", "rmagick", "mongrel", "mongrel_cluster", "json", "mime-types" ]
+
+
# Ruby install
set :ruby_build_options, {
- :url => "http://capigen.s3.amazonaws.com/ruby-1.8.6-p110.tar.gz",
+ :url => "http://capitate.s3.amazonaws.com/ruby-1.8.6-p110.tar.gz",
:build_dest => "/usr/src",
:configure_options => "--prefix=/usr",
:clean => false
}
@@ -91,10 +117,11 @@
:configure_options => "--prefix=/usr/local"
}
# Monit install
set :monit_conf_dir, "/etc/monit"
+set :monit_pid_path, "/var/run/monit.pid"
set :monit_port, 2812
set :monit_build_options, {
:url => "http://www.tildeslash.com/monit/dist/monit-4.10.1.tar.gz"
}
@@ -105,25 +132,30 @@
set :nginx_prefix_path, "/var/nginx"
set :nginx_build_options, {
:url => "http://sysoev.ru/nginx/nginx-0.5.35.tar.gz",
:configure_options => "--sbin-path=#{nginx_bin_path} --conf-path=#{nginx_conf_path} \
--pid-path=#{nginx_pid_path} --error-log-path=/var/log/nginx_master_error.log --lock-path=/var/lock/nginx \
---prefix=#{nginx_prefix_path} --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 --with-http_ssl_module"
+--prefix=#{nginx_prefix_path} --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 --with-http_ssl_module \
+--with-http_flv_module"
}
# Sphinx install
-set :sphinx_prefix, "/usr/local/sphinx"
+set :sphinx_prefix, "/usr/local/sphinx-0.9.8-rc1"
set :sphinx_build_options, {
- :url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.7.tar.gz",
+ :url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.8-rc1.tar.gz",
+ #:url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.7.tar.gz",
:configure_options => "--with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql \
---prefix=#{sphinx_prefix}"
+--prefix=#{sphinx_prefix}",
+ :symlink => { sphinx_prefix => "/usr/local/sphinx" }
}
-# Mysql install
+
+
+# For mysql:install
set :mysql_pid_path, "/var/run/mysqld/mysqld.pid"
set :db_port, 3306
# Imagemagick install
set :imagemagick_build_options, {
- :url => "ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz",
+ :url => "http://capitate.s3.amazonaws.com/ImageMagick.tar.gz",
:unpack_dir => "ImageMagick-*"
}