diff --git a/CHANGELOG b/CHANGELOG index 3f572a46..2922ba91 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,21 +1,21 @@ == git - + * Restricted tasks to roles. [mbailey] http://github.com/mbailey/deprec/commit/d103dda7ee3f7696007d230c76c7739dd57115ec == 1.99.27 (August 27, 2008) -* Bugfix: Add configure and make options to src_package for rubygems to +* Bugfix: Add configure and make options to src_package for rubygems to override defaults. [jasherai] -* Change: We now setup postfix as a satellite mail server. This is designed +* Change: We now setup postfix as a satellite mail server. This is designed to listen only on the local network interface and non-local mail to a relay host. [mbailey] == 1.99.26 (August 22, 2008) * added vnstat recipes - measure and report traffic on interface counters [mbailey] -* upgrade ruby to 1.8.6-p287 [Isaac Kearse] +* upgrade ruby to 1.8.6-p287 [Isaac Kearse] * upgrade to rubygems 1.2.0 - addresses memory utilization issues on low-memory boxes (half-gig or less) [thewoolleyman] * deprec:rails:install_stack now installs mysql [mbailey] @@ -28,17 +28,17 @@ * I've rejigged things to make it easier to install a service without having a local config directory. For example: - cap deprec:nginx:install HOSTS=192.168.0.10 + cap deprec:nginx:install HOSTS=192.168.0.10 - This will download and compile nginx, and push out a config file without - generating a local copy. You don't need a config/ dir and you don't need + This will download and compile nginx, and push out a config file without + generating a local copy. You don't need a config/ dir and you don't need to have defined a :web role. - Meta-tasks (like deprec:rails:install_stack) can now pass a block of commands + Meta-tasks (like deprec:rails:install_stack) can now pass a block of commands to with_roles(roles). - config_gen and config are still available but it's now possible to install - a rails stack without generating any local files. + config_gen and config are still available but it's now possible to install + a rails stack without generating any local files. == 1.99.21 (June 17, 2008) @@ -53,7 +53,7 @@ == 1.99.19 (June 3, 2008) * feature: added logrotate. configs generated for nginx and mongrel -* bugfix: monit:install was calling monit:activate but this won't work will monit:config is called. +* bugfix: monit:install was calling monit:activate but this won't work will monit:config is called. == 1.99.18 (May 28, 2008) @@ -66,7 +66,7 @@ == 1.99.16 (May 5, 2008) -* change: start mongrel using mongrel_cluster with --clean option so mongrel +* change: start mongrel using mongrel_cluster with --clean option so mongrel will start even when there are stale pids around. * bugfix: nginx vhost template now uses :mongrel_port instead of 8000 @@ -74,7 +74,7 @@ == 1.99.15 (Mar 27, 2008) -* moved vmbuilder_plugins out of deprec dir +* moved vmbuilder_plugins out of deprec dir == 1.99.14 (Feb 21, 2008) @@ -108,16 +108,16 @@ * feature: installs and configures monit to manage your mongrel processes [Mike Bailey] -* feature: When running config_gen, if deprec discovers a file exists, checks - whether the new file differs from the existing one. If they're +* feature: When running config_gen, if deprec discovers a file exists, checks + whether the new file differs from the existing one. If they're identical, it skips it. - If they differ, the user is presented with the options to overwrite - or not but now there's an extra option to view a diff of the changes + If they differ, the user is presented with the options to overwrite + or not but now there's an extra option to view a diff of the changes that would occur. [Mike Bailey] * change: handle_command_with_input now accepts an optional response parameter. - This is useful if you need to change a password on many servers and + This is useful if you need to change a password on many servers and don't want to have to keep entering the password at the prompt for each box. [Mike Bailey] @@ -161,9 +161,9 @@ Massive changes in preparation for 2.0 * bugfix: :set_perms_for_mongrel_dirs [Mike Bailey] - now don't fail if log files do not exist (e.g initial deployment) - - is called by :after_symlink task instead of :after_update - this is because some tasks call :update_code without calling the - :update task but in all of these cases :symlink is called + - is called by :after_symlink task instead of :after_update + this is because some tasks call :update_code without calling the + :update task but in all of these cases :symlink is called * updated version from 1.4.x to 1.5.x due to pretty big change made in previous version (mongrel no longer running as root) [Mike Bailey] diff --git a/COPYING b/COPYING index e7f0d484..3e593dd1 100644 --- a/COPYING +++ b/COPYING @@ -13,7 +13,7 @@ all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README b/README index e76e405d..f12ba925 100644 --- a/README +++ b/README @@ -5,31 +5,31 @@ deprec - Deployment Recipes for Capistrano == Introduction The deprec [1] gem is a set of tasks for Capistrano [2]. These tasks provide -for the installation, configuration and control of system services. Deprec -was created in 2006 by Mike Bailey to setup an environment for running Ruby +for the installation, configuration and control of system services. Deprec +was created in 2006 by Mike Bailey to setup an environment for running Ruby on Rails web applications on Ubuntu dapper servers. Since then its uses have -grown to installing mail, monitoring, high availability IP failover and other +grown to installing mail, monitoring, high availability IP failover and other services. -The tasks are run at the command line on your workstation and connect to +The tasks are run at the command line on your workstation and connect to remote servers via ssh to run commands and copy out files. Deprec-2.x is a complete rewrite of the project that achieves the following: - support for Capistrano 2 -- support for more services (heartbeat, nagios, nginx, ntp, postfix, etc) +- support for more services (heartbeat, nagios, nginx, ntp, postfix, etc) - creation of a standard base set of task names - tasks are cleanly separated into namespaced units (one file per service) - service config files are stored locally to enable edits and version control - interactive prompting for missing config values One idea that is in the trash can is supporting other distros/OS's. While I got -caught up in the excitement of The Big Rewrite I've decided I don't need it. If -you want to deploy to something other than Ubuntu I suggest you look for other +caught up in the excitement of The Big Rewrite I've decided I don't need it. If +you want to deploy to something other than Ubuntu I suggest you look for other alternatives. -Deprec and Capistrano are written in the Ruby programming language [3] however -no knowledge of Ruby is required to use it. Users should be able to write +Deprec and Capistrano are written in the Ruby programming language [3] however +no knowledge of Ruby is required to use it. Users should be able to write new tasks and modify existing options without prior knowledge of Ruby. @@ -37,12 +37,12 @@ new tasks and modify existing options without prior knowledge of Ruby. Deprec can be obtained from rubyforge[4] and installed using rubygems[5]. - sudo gem install deprec # installs deprec and dependancies + sudo gem install deprec # installs deprec and dependancies cap depify . # creates ~/.caprc which you may edit cap -T # should list lots of deprec tasks -The .caprc file is loaded every time you use Capistrano. It in turn loads -the deprec tasks so you always have them available. Editing the .caprc file +The .caprc file is loaded every time you use Capistrano. It in turn loads +the deprec tasks so you always have them available. Editing the .caprc file in your home directory allows you to specify the location of your ssh key and enable some other useful options (documented in the comments). You can also put tasks here that you want to always have access to. @@ -51,7 +51,7 @@ also put tasks here that you want to always have access to. == Getting a Ruby on Rails app running on a fresh Ubuntu server This is still what brings people to deprec. You can install a full Rails stack -and get multiple apps running on it in much less time than it would take to +and get multiple apps running on it in much less time than it would take to do it manually. Think an hour vs. a weekend. (The irony is I'm up writing this on a Saturday night.) @@ -78,20 +78,20 @@ You can find documentation on the deprec site. http://www.deprec.org/ == Installing other things -I plan to document other things I use deprec for on http://www.deprec.org/. -Feel free to poke around and see what's there. I use deprec to provision and +I plan to document other things I use deprec for on http://www.deprec.org/. +Feel free to poke around and see what's there. I use deprec to provision and manage servers so you might find some things in there I haven't documented. Lucky you. == Disclaimer -The tasks run commands that may make changes to your workstation and remote server. +The tasks run commands that may make changes to your workstation and remote server. You are advised to read the source and use at your own risk. == Credits -Deprec is written and maintained by Mike Bailey . +Deprec is written and maintained by Mike Bailey . More about me here: [http://mike.bailey.net.au/] Deprec was inspired and uses the brilliantly executed Capistrano. Thanks Jamis! @@ -107,7 +107,7 @@ Craig Ambrose: testing, documentation and beer == License -Deprec is licenced under the GPL. This means that you can use it in commercial +Deprec is licenced under the GPL. This means that you can use it in commercial or open source applications. More details found here: http://www.gnu.org/licenses/gpl.html diff --git a/deprec.gemspec b/deprec.gemspec index 932a6965..9438912f 100644 --- a/deprec.gemspec +++ b/deprec.gemspec @@ -1,13 +1,13 @@ -require 'rubygems' +require 'rubygems' SPEC = Gem::Specification.new do |s| s.name = 'deprec' s.version = '1.99.27' - + s.authors = ['Mike Bailey'] s.description = <<-EOF - This project provides libraries of Capistrano tasks and extensions to - remove the repetative manual work associated with installing services + This project provides libraries of Capistrano tasks and extensions to + remove the repetative manual work associated with installing services on linux servers. EOF s.email = 'mike@bailey.net.au' @@ -17,10 +17,10 @@ SPEC = Gem::Specification.new do |s| s.require_paths = ['lib'] s.add_dependency('capistrano', '> 2.0.0') - candidates = Dir.glob("{bin,docs,lib}/**/*") + candidates = Dir.glob("{bin,docs,lib}/**/*") candidates.concat(%w(CHANGELOG COPYING LICENSE README THANKS)) - s.files = candidates.delete_if do |item| - item.include?("CVS") || item.include?("rdoc") + s.files = candidates.delete_if do |item| + item.include?("CVS") || item.include?("rdoc") end s.default_executable = "depify" s.executables = ["depify"] diff --git a/docs/ANNOUNCE.deprec2 b/docs/ANNOUNCE.deprec2 index 859b85d3..0b29526c 100644 --- a/docs/ANNOUNCE.deprec2 +++ b/docs/ANNOUNCE.deprec2 @@ -1,43 +1,43 @@ == Configuration deprec2 has a two stage process for generating/deploying configuration files. -Configuration files for web, app, db servers (and more) are generated from -templates and put under the config/ tree in your Rails apps source tree. -Alternatively you could create a non-rails-app tree to hold them. The second -stage is pushing the files out to the destination servers. This used to be a +Configuration files for web, app, db servers (and more) are generated from +templates and put under the config/ tree in your Rails apps source tree. +Alternatively you could create a non-rails-app tree to hold them. The second +stage is pushing the files out to the destination servers. This used to be a one stage process in deprec1 however the change has been made so that: - all config files for a project can be kept under source control - you can make changes to config files that are not available through deprec -Many of the settings in these config files are based on values in the projects -deploy.rb file. Others reflect defaults in deprec that you can override by adding -fields to deploy.rb. This means you may never need to edit the generated config +Many of the settings in these config files are based on values in the projects +deploy.rb file. Others reflect defaults in deprec that you can override by adding +fields to deploy.rb. This means you may never need to edit the generated config files directly. You can generate a set of config files with the following: cap deprec:nginx:config_gen # generates config files for trac from templates - + config_gen is re-runnable and will prompt you before overwriting a file. It will also show you what changes overwriting would make (in diff format) to help you decide whether you want it to do so. -Changes to service configuration should never be made on the server. Deprec -acknowledges this by offering no assistance to people who want to copy config +Changes to service configuration should never be made on the server. Deprec +acknowledges this by offering no assistance to people who want to copy config files back from servers. But pushing the files out couldn't be simpler! cap deprec:nginx:config # pushes out all config files for trac -deprec2 takes into consideration the fact that that some services are used to -host more than one application. For example, a webserver will often have one +deprec2 takes into consideration the fact that that some services are used to +host more than one application. For example, a webserver will often have one main configuration and a number of virtual host configurations. Monit has a single config file (/etc/monitrc) but will also load other configs it finds in a certain directory (/etc/monit.d). When you deploy a Ruby on Rails app with deprec it drops configs for your project into the config/ directory for your project and symlinks them into a shared path -on the server. This means you can install multiple apps on a remote server and -they shouldn't stop on each other. - +on the server. This means you can install multiple apps on a remote server and +they shouldn't stop on each other. + == Extra services - nginx diff --git a/docs/README.install b/docs/README.install index f8199a9d..57e9958f 100644 --- a/docs/README.install +++ b/docs/README.install @@ -4,17 +4,17 @@ Install deprec with the following command (requires ruby and rubygems installed) sudo gem install deprec -Let's create a directory to manage all our host config details +Let's create a directory to manage all our host config details This supports as many hosts as you need to manage and will be the dir you run your deprec commands from when managing the servers. Note that -you don't need to do this if you just want to deploy a single Ruby on +you don't need to do this if you just want to deploy a single Ruby on Rails application. In this case the config/ dir in your project can serve the same purpose. For those who aren't interested in Ruby on Rails -or want to use deprec for more than just deploying one rails app, the +or want to use deprec for more than just deploying one rails app, the following may come in handy. mkdir -p sys/config # change 'sys' to whatever you want - cd sys # + cd sys # depify . # create Capfile and config/deploy.rb cap deprec:ssh:config_gen # generates ssh server configs @@ -39,28 +39,28 @@ Change the root password you received for your new slice. cap deprec:users:passwd USER=root Enter user to change password for |root| - Password: - Enter new UNIX password: - Retype new UNIX password: + Password: + Enter new UNIX password: + Retype new UNIX password: Create an account with sudo access for mysql^H^Hself - cap deprec:users:add USER=root + cap deprec:users:add USER=root Enter userid for new user |root| mbailey Should this be an admin account? |no| yes I've found an authorized_keys file for mbailey. Should I copy it out? |yes| - Password: + Password: Setting pasword for new account - Enter new UNIX password: - Retype new UNIX password: + Enter new UNIX password: + Retype new UNIX password: Create another account without sudo access for a colleague. -Notice how I longer need to specify USER=root? That's because I'm using the +Notice how I longer need to specify USER=root? That's because I'm using the account I just created. cap deprec:users:add @@ -68,19 +68,19 @@ account I just created. Enter userid for new user |mbailey| ben Should this be an admin account? |no| - Password: + Password: Setting pasword for new account - Enter new UNIX password: - Retype new UNIX password: - -I prefer to disallow ssh password based login for security reasons. I also -turn off DNS lookups by sshd as they are often responsible for a 2 second -lag on login. Be warned that turning off ssh passwords will prevent someone -without an ssh key setup from logging in so use this with caution. Deprec -makes it painless to upload their key when you create their account though + Enter new UNIX password: + Retype new UNIX password: + +I prefer to disallow ssh password based login for security reasons. I also +turn off DNS lookups by sshd as they are often responsible for a 2 second +lag on login. Be warned that turning off ssh passwords will prevent someone +without an ssh key setup from logging in so use this with caution. Deprec +makes it painless to upload their key when you create their account though so you've got no excuse to leave passwords turned on. -You can upload the ssh configs currently residing in config/ssh/etc/ssh by +You can upload the ssh configs currently residing in config/ssh/etc/ssh by running this: cap deprec:ssh:config diff --git a/docs/README.nagios b/docs/README.nagios index 64ce0b31..ac628001 100644 --- a/docs/README.nagios +++ b/docs/README.nagios @@ -5,7 +5,7 @@ deprec: Install and configure Nagios on Ubuntu 7.10 (gutsy) # You need the following item defined in config/deploy.rb (or ~/.caprc) role :nagios, 'monitor.blah.com' - + # Run the following on your workstation export HOSTS=nagios.domain.name # replace with desired domain cap deprec:apache:install diff --git a/docs/README.svn b/docs/README.svn index 86178d7a..a547a310 100644 --- a/docs/README.svn +++ b/docs/README.svn @@ -3,28 +3,28 @@ # Add the following to your deploy.rb (or ~/.caprc if always the same) set :scm, 'your.svn.server' -# The run the following from the root the project you wish to import +# The run the following from the root the project you wish to import cap deprec:svn:install cap deprec:svn:setup # XXX Not tested on deprec2 -# -# +# +# # Installs subversion and trac software on server. # Creates subversion repository on server and imports project. # Sets up trac installation for project. -# -# role :scm, 'deptest.deprecated.org' -# +# +# role :scm, 'deptest.deprecated.org' +# # # install packages # cap apache_install svn_install trac_install -# +# # # import project # cap svn_import_project # cap trac_init # cap trac_start -# +# # # your project will be viewable at http://yourdomain:8000/ # # you can add other users with 'cap trac_user_add' diff --git a/docs/ROADMAP.txt b/docs/ROADMAP.txt index 0e0d50da..908d4587 100644 --- a/docs/ROADMAP.txt +++ b/docs/ROADMAP.txt @@ -3,14 +3,14 @@ deprec 2.0 roadmap # expectations/constraints - all tasks should be re-runnable -- all install_ tasks should install required dependancies +- all install_ tasks should install required dependancies - users should expect that standard cap commands will work # interactive tools deprec should make it easy to perform commonly use sysadmin tasks. -While automation brings great power it's still often quicker to +While automation brings great power it's still often quicker to run 'semi automated' tasks that require some interactive input. For example, adding a user account to a number of servers could be @@ -34,39 +34,39 @@ server04 - user 'fred' exists. Set type to 'admin' for a project however there are many ways to get this list. -Plugin support for different distro's was too ambitious. I've tried other -distros and didn't like them much. I'm happy with Ubuntu at the moment and +Plugin support for different distro's was too ambitious. I've tried other +distros and didn't like them much. I'm happy with Ubuntu at the moment and # # plugin based support different distros, versions (and possibly OS's) -# +# # While deprec was built to work with Ubuntu 6.06, some people have shown interest # in using it with other distro's. I plan to move all of the Ubuntu specific code # into a separate gem 'deprec_ubuntu' which deprec will load by default. This will # mean anyone else can create and maintain plugins that allow the use of other linux # distros (and perhaps other OS's). -# +# # All platform dependent functions will be: -# +# # - cap extensions, not tasks # - plugins, not part of the deprec itself # - loaded using gemplugins http://mongrel.rubyforge.org/gem_plugin_rdoc/index.html -# +# # I'd like 'cap -T' to show the distros supported for each command when not arch independant. # add lots more useful tasks I'd like to extend deprec beyond just getting your rails app up and running. -Anything I need that takes some time to do right will go in. If you've got -something you want added then write it and let me know. +Anything I need that takes some time to do right will go in. If you've got +something you want added then write it and let me know. -install and configure the following package groups: +install and configure the following package groups: - source control (svn, trac) - mail (postfix, imap, mutt, mailx) # don't rely on third party servers to be available when installing software -As I write, www.apache.org is serving at a crawling pace. I'd like to make it easy for +As I write, www.apache.org is serving at a crawling pace. I'd like to make it easy for users to download and cache all required third party apps, gems, etc and have deprec use these. diff --git a/docs/deprec-1.x/deprec-1.x.quickstart b/docs/deprec-1.x/deprec-1.x.quickstart index 612c952f..dd7ec1ef 100644 --- a/docs/deprec-1.x/deprec-1.x.quickstart +++ b/docs/deprec-1.x/deprec-1.x.quickstart @@ -6,7 +6,7 @@ Here are instructions that will take a fresh install of Ubuntu Dapper (6.06.1 server), create a working rails app, create an SVN repository and trac installation for it and deploy it using apache, mongrel and mysql. -All commands below are run on your local host. You will *never* be requested +All commands below are run on your local host. You will *never* be requested to log into the remote server manually. Capistrano does all the work. - Mike @@ -28,7 +28,7 @@ deprec --apply-to . --name example --domain www.example.com # NOTE! Use following two commands if you only have 'root' account on server # Some VPS services provide you with this when you sign up cap change_root_password_as_root # '_as_root' means run this as 'root' user -cap setup_admin_account_as_root +cap setup_admin_account_as_root # Copy your ssh keys to remote server to avoid having to type passwords cap setup_ssh_keys @@ -46,5 +46,5 @@ cap trac_stop # if you had the need # Deploy application cap setup cap deploy_with_migrations -cap apache_restart +cap apache_restart # application is now running on http://www.example.com/people diff --git a/docs/windows_linux.txt b/docs/windows_linux.txt index ef82f682..bb58db0c 100644 --- a/docs/windows_linux.txt +++ b/docs/windows_linux.txt @@ -265,7 +265,7 @@ Now change the following lines to match your specifics: set :user, "deploy_user" set :application, "my_rails_project" -set :repository, +set :repository, "svn+ssh://my_svn_useruser@my_svn/path_to/my_rails_project/trunk" #or whatever set :domain, "my.slice.ip.address" #or domain name if you have that setup role :app, domain diff --git a/docs/xen/plan.txt b/docs/xen/plan.txt index 114149b8..f1e82118 100644 --- a/docs/xen/plan.txt +++ b/docs/xen/plan.txt @@ -1,5 +1,5 @@ # functions -create domu +create domu - xen-create-image - generate config file \ No newline at end of file diff --git a/docs/xen/traffic_monitoring_with_vnstat.txt b/docs/xen/traffic_monitoring_with_vnstat.txt index c559e880..a83586f1 100644 --- a/docs/xen/traffic_monitoring_with_vnstat.txt +++ b/docs/xen/traffic_monitoring_with_vnstat.txt @@ -26,11 +26,11 @@ http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.3.tar.gz vnstat -u -i web2-eth0 -2. +2. # -# Add all eth interfaces +# Add all eth interfaces # for x in `ls /proc/sys/net/ipv4/conf | grep eth | cut -f 1 -d' '`; do vnstat -u -i $x diff --git a/docs/xen/xen_on_hardy.txt b/docs/xen/xen_on_hardy.txt index 7bd55e54..a456478f 100644 --- a/docs/xen/xen_on_hardy.txt +++ b/docs/xen/xen_on_hardy.txt @@ -4,22 +4,22 @@ # ref: http://www.howtoforge.com/ubuntu-8.04-server-install-xen-from-ubuntu-repositories # -# Install Xen packages +# Install Xen packages # apt-get install ubuntu-xen-server # # Installs these: - # + # # binutils binutils-static bridge-utils debootstrap libasound2 libconfig-inifiles-perl libcurl3 libdirectfb-1.0-0 libsdl1.2debian # libsdl1.2debian-alsa libtext-template-perl libxen3 libxml2 linux-image-2.6.24-16-xen linux-image-xen # linux-restricted-modules-2.6.24-16-xen linux-restricted-modules-common linux-restricted-modules-xen # linux-ubuntu-modules-2.6.24-16-xen linux-xen nvidia-kernel-common python-dev python-xen-3.2 python2.5-dev ubuntu-xen-server # xen-docs-3.2 xen-hypervisor-3.2 xen-tools xen-utils-3.2 - + # before/after 'uname -a' # # Linux bb 2.6.24-16-server #1 SMP Thu Apr 10 13:15:38 UTC 2008 x86_64 GNU/Linux # Linux bb 2.6.24-16-xen #1 SMP Thu Apr 10 14:35:03 UTC 2008 x86_64 GNU/Linux -# +# # Stop apparmor # XXX investigate why # /etc/init.d/apparmor stop # update-rc.d -f apparmor remove @@ -29,7 +29,7 @@ # edit /etc/xen-tools/xen-tools.cfg # create image with xen-tools -# xen-create-image --hostname=x1 --size=2Gb --swap=256Mb --ide --ip=192.168.1.51 --memory=256Mb --install-method=debootstrap --dist=hardy +# xen-create-image --hostname=x1 --size=2Gb --swap=256Mb --ide --ip=192.168.1.51 --memory=256Mb --install-method=debootstrap --dist=hardy # update /etc/xen/.cfg # diff --git a/lib/deprec/capistrano_extensions.rb b/lib/deprec/capistrano_extensions.rb index 5d1cc77c..5ab083f7 100644 --- a/lib/deprec/capistrano_extensions.rb +++ b/lib/deprec/capistrano_extensions.rb @@ -3,7 +3,7 @@ require 'fileutils' module Deprec2 - + # Temporarily modify ROLES if HOSTS not set # Capistrano's default behaviour is for HOSTS to override ROLES def for_roles(roles) @@ -12,7 +12,7 @@ def for_roles(roles) yield ENV['ROLES'] = old_roles.to_s unless ENV['HOSTS'] end - + # Temporarily ignore ROLES and HOSTS def ignoring_roles_and_hosts old_roles = ENV['ROLES'] @@ -23,11 +23,11 @@ def ignoring_roles_and_hosts ENV['ROLES'] = old_roles ENV['HOSTS'] = old_hosts end - + DEPREC_TEMPLATES_BASE = File.join(File.dirname(__FILE__), 'templates') - # Render template (usually a config file) - # + # Render template (usually a config file) + # # Usually we render it to a file on the local filesystem. # This way, we keep a copy of the config file under source control. # We can make manual changes if required and push to new hosts. @@ -46,14 +46,14 @@ def render_template(app, options={}) remote = options[:remote] || false mode = options[:mode] || 0755 owner = options[:owner] || nil - + # replace this with a check for the file if ! template puts "render_template() requires a value for the template!" - return false + return false end - - # If local copies of deprec templates exist they will be used + + # If local copies of deprec templates exist they will be used # If you don't specify the location with the local_template_dir option # it defaults to config/templates. # e.g. config/templates/nginx/nginx.conf.erb @@ -66,15 +66,15 @@ def render_template(app, options={}) template = ERB.new(IO.read(File.join(DEPREC_TEMPLATES_BASE, app.to_s, template)), nil, '-') end rendered_template = template.result(binding) - - if remote + + if remote # render to remote machine puts 'You need to specify a path to render the template to!' unless path exit unless path sudo "test -d #{File.dirname(path)} || sudo mkdir -p #{File.dirname(path)}" std.su_put rendered_template, path, '/tmp/', :mode => mode sudo "chown #{owner} #{path}" if defined?(owner) - elsif path + elsif path # render to local file full_path = File.join('config', app.to_s, path) path_dir = File.dirname(full_path) @@ -91,7 +91,7 @@ def render_template(app, options={}) end FileUtils.mkdir_p "#{path_dir}" if ! File.directory?(path_dir) # added line above to make windows compatible - # system "mkdir -p #{path_dir}" if ! File.directory?(path_dir) + # system "mkdir -p #{path_dir}" if ! File.directory?(path_dir) File.open(full_path, 'w'){|f| f.write rendered_template } puts "[done] #{full_path} written" else @@ -99,24 +99,24 @@ def render_template(app, options={}) return rendered_template end end - + def overwrite?(full_path, rendered_template) - if defined?(overwrite_all) + if defined?(overwrite_all) if overwrite_all == true return true else return false end end - + # XXX add :always and :never later - not sure how to set persistent value from here # response = Capistrano::CLI.ui.ask "File exists. Overwrite? ([y]es, [n]o, [a]lways, n[e]ver)" do |q| puts - response = Capistrano::CLI.ui.ask "File exists (#{full_path}). + response = Capistrano::CLI.ui.ask "File exists (#{full_path}). Overwrite? ([y]es, [n]o, [d]iff)" do |q| q.default = 'n' end - + case response when 'y' return true @@ -124,7 +124,7 @@ def overwrite?(full_path, rendered_template) return false when 'd' require 'tempfile' - tf = Tempfile.new("deprec_diff") + tf = Tempfile.new("deprec_diff") tf.puts(rendered_template) tf.close puts @@ -133,13 +133,13 @@ def overwrite?(full_path, rendered_template) system "diff -u #{full_path} #{tf.path} | less" puts overwrite?(full_path, rendered_template) - # XXX add :always and :never later - not sure how to set persistent value from here + # XXX add :always and :never later - not sure how to set persistent value from here # when 'a' # set :overwrite_all, true # when 'e' # set :overwrite_all, false end - + end def render_template_to_file(template_name, destination_file_name, templates_dir = DEPREC_TEMPLATES_BASE) @@ -153,16 +153,16 @@ def render_template_to_file(template_name, destination_file_name, templates_dir sudo "cp #{temporary_location} #{destination_file_name}" delete temporary_location end - - # Copy configs to server(s). Note there is no :pull task. No changes should + + # Copy configs to server(s). Note there is no :pull task. No changes should # be made to configs on the servers so why would you need to pull them back? - def push_configs(app, files) + def push_configs(app, files) app = app.to_s files.each do |file| # If the file path is relative we will prepend a path to this projects # own config directory for this service. if file[:path][0,1] != '/' - full_remote_path = File.join(deploy_to, app, file[:path]) + full_remote_path = File.join(deploy_to, app, file[:path]) else full_remote_path = file[:path] end @@ -184,7 +184,7 @@ def push_configs(app, files) sudo "chown #{file[:owner]} #{full_remote_path}" end end - + def teardown_connections sessions.keys.each do |server| sessions[server].close @@ -197,7 +197,7 @@ def append_to_file_if_missing(filename, value, options={}) # XXX if options[:requires_sudo] and :use_sudo then use sudo sudo <<-END sh -c ' - grep -F "#{value}" #{filename} > /dev/null 2>&1 || + grep -F "#{value}" #{filename} > /dev/null 2>&1 || echo "#{value}" >> #{filename} ' END @@ -210,7 +210,7 @@ def useradd(user, options={}) switches += " --shell=#{options[:shell]} " if options[:shell] switches += ' --create-home ' unless options[:homedir] == false switches += " --gid #{options[:group]} " unless options[:group].nil? - invoke_command "grep '^#{user}:' /etc/passwd || sudo /usr/sbin/useradd #{switches} #{user}", + invoke_command "grep '^#{user}:' /etc/passwd || sudo /usr/sbin/useradd #{switches} #{user}", :via => run_method end @@ -240,16 +240,16 @@ def mkdir(path, options={}) groupadd(options[:group], :via => via) if options[:group] invoke_command "chgrp -R #{options[:group]} #{path}", :via => via if options[:group] end - + def create_src_dir mkdir(src_dir, :mode => 0775, :group => group_src, :via => :sudo) end - + # download source package if we don't already have it def download_src(src_package, src_dir) set_package_defaults(src_package) create_src_dir - # check if file exists and if we have an MD5 hash or bytecount to compare + # check if file exists and if we have an MD5 hash or bytecount to compare # against if so, compare and decide if we need to download again if defined?(src_package[:md5sum]) md5_clause = " && echo '#{src_package[:md5sum]}' | md5sum -c - " @@ -270,15 +270,15 @@ def unpack_src(src_package, src_dir) test -d #{package_dir}.old && rm -fr #{package_dir}.old; test -d #{package_dir} && mv #{package_dir} #{package_dir}.old; #{src_package[:unpack]} - chgrp -R #{group} #{package_dir}; + chgrp -R #{group} #{package_dir}; chmod -R g+w #{package_dir}; ' EOF end - + def set_package_defaults(pkg) - pkg[:filename] ||= File.basename(pkg[:url]) - pkg[:dir] ||= pkg[:filename].sub(/(\.tgz|\.tar\.gz)/,'') + pkg[:filename] ||= File.basename(pkg[:url]) + pkg[:dir] ||= pkg[:filename].sub(/(\.tgz|\.tar\.gz)/,'') pkg[:unpack] ||= "tar zxf #{pkg[:filename]};" pkg[:configure] ||= './configure ;' pkg[:make] ||= 'make;' @@ -355,20 +355,20 @@ def sudo_stream(command) # # Run a command using the root account. # # # # Some linux distros/VPS providers only give you a root login when you install. - # + # # def run_as_root(shell_command) # std.connect_as_root do |tempuser| # run shell_command # end # end - # + # # ## # # Run a task using root account. # # # # Some linux distros/VPS providers only give you a root login when you install. # # # # tempuser: contains the value replaced by 'root' for the duration of this call - # + # # def as_root() # std.connect_as_root do |tempuser| # yield tempuser @@ -390,14 +390,14 @@ def handle_command_with_input(local_run_method, shell_command, input_query, resp if data =~ input_query if response channel.send_data "#{response}\n" - else + else response = ::Capistrano::CLI.password_prompt "#{data}" channel.send_data "#{response}\n" end end end end - + end Capistrano.plugin :deprec2, Deprec2 diff --git a/lib/deprec/recipes/aoe.rb b/lib/deprec/recipes/aoe.rb index d19a178a..6435c6ab 100644 --- a/lib/deprec/recipes/aoe.rb +++ b/lib/deprec/recipes/aoe.rb @@ -1,32 +1,32 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do SRC_PACKAGES[:aoe] = { :url => "http://support.coraid.com/support/linux/aoe6-64.tar.gz", :md5sum => "c5e1ebb734e3b29c0a3d886a700ca44a aoe6-64.tar.gz", :configure => '' } - + SRC_PACKAGES[:cec] = { :url => "http://easynews.dl.sourceforge.net/sourceforge/aoetools/cec-8.tgz", :md5sum => "7899dc549f9a368e532f9c39ed819f71 cec-8.tgz", :configure => '', :install => "test -f /usr/sbin/cec && rm /usr/sbin/cec; make install;" } - + SRC_PACKAGES[:ddt] = { :url => "http://support.coraid.com/support/sr/ddt-8.tgz", :md5sum => "256a58aba5e05f9995fb9de6aadadf92 ddt-8.tgz" } - + SRC_PACKAGES[:aoemask] = { :url => "http://support.coraid.com/support/sr/aoemask-1.tgz", :md5sum => "379461a28d511e269f4593b846bd1288 aoemask-1.tgz" } - + namespace :deprec do namespace :aoe do - + desc "Install aoe drivers required to mount Coraid block devices" task :install, :roles => :aoe do install_deps @@ -37,7 +37,7 @@ task :install_deps, :roles => :aoe do apt.install( {:base => %w(build-essential linux-headers-$(uname -r) vblade aoetools)}, :stable ) end - + desc "Install all AoE related software" task :install_all, :roles => :aoe do top.deprec.aoe.install @@ -45,7 +45,7 @@ top.deprec.ddt.install top.deprec.aoemask.install end - + end namespace :cec do @@ -55,7 +55,7 @@ deprec2.install_from_src(SRC_PACKAGES[:cec], src_dir) end end - + namespace :ddt do desc "install DDT (tool for testing performance)" task :install, :roles => :aoe do @@ -63,7 +63,7 @@ deprec2.install_from_src(SRC_PACKAGES[:ddt], src_dir) end end - + namespace :aoemask do desc "install aoemask" task :install, :roles => :aoe do @@ -71,9 +71,9 @@ deprec2.install_from_src(SRC_PACKAGES[:aoemask], src_dir) end end - + end - + end diff --git a/lib/deprec/recipes/apache.rb b/lib/deprec/recipes/apache.rb index 0488b242..9b5bf345 100644 --- a/lib/deprec/recipes/apache.rb +++ b/lib/deprec/recipes/apache.rb @@ -1,22 +1,22 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :apache do - + # put apache config for site in shared/config/apache2 dir - # link it into apps to enable, unlink to disable? + # link it into apps to enable, unlink to disable? # http://times.usefulinc.com/2006/09/15-rails-debian-apache - + # XXX Check this over after a nice sleep # # def set_apache_conf # if apache_default_vhost # set :apache_conf, "/usr/local/apache2/conf/default.conf" unless apache_default_vhost_conf - # else + # else # set :apache_conf, "/usr/local/apache2/conf/apps/#{application}.conf" unless apache_conf # end # end - + set(:apache_server_name) { domain } set :apache_user, 'daemon' # XXX this is not yet being inserted into httpd.conf! # I've added it for deprec:nagios:install @@ -35,21 +35,21 @@ set :apache_docroot, '/usr/local/apache2/htdocs' set :apache_vhost_dir, '/usr/local/apache2/conf/apps' set :apache_config_file, '/usr/local/apache2/conf/httpd.conf' - + SRC_PACKAGES[:apache] = { - :md5sum => "80d3754fc278338033296f0d41ef2c04 httpd-2.2.9.tar.gz", + :md5sum => "80d3754fc278338033296f0d41ef2c04 httpd-2.2.9.tar.gz", :url => "http://www.apache.org/dist/httpd/httpd-2.2.9.tar.gz", :configure => %w( ./configure --enable-mods-shared=all - --enable-proxy - --enable-proxy-balancer - --enable-proxy-http - --enable-rewrite - --enable-cache - --enable-headers - --enable-ssl - --enable-deflate + --enable-proxy + --enable-proxy-balancer + --enable-proxy-http + --enable-rewrite + --enable-cache + --enable-headers + --enable-ssl + --enable-deflate --with-included-apr #_so_this_recipe_doesn't_break_when_rerun --enable-dav #_for_subversion_ --enable-so #_for_subversion_ @@ -58,7 +58,7 @@ :make => 'make;', :post_install => 'install -b support/apachectl /etc/init.d/httpd;' } - + desc "Install apache" task :install do install_deps @@ -71,25 +71,25 @@ deprec2.render_template(:apache, file.merge(:remote => true)) end end - + # install dependencies for apache task :install_deps do apt.install( {:base => %w(zlib1g-dev zlib1g openssl libssl-dev)}, :stable ) end - + # Create dir for vhost config files task :setup_vhost_dir do deprec2.mkdir(apache_vhost_dir, :owner => 'root', :group => group, :mode => 0775, :via => :sudo) deprec2.append_to_file_if_missing(apache_config_file, 'Include conf/apps/') end - + SYSTEM_CONFIG_FILES[:apache] = [ # They're generated and put in place during install # I may put them in here at some point ] PROJECT_CONFIG_FILES[:apache] = [ - + {:template => "httpd-vhost-app.conf.erb", :path => 'conf/httpd-vhost-app.conf', :mode => 0755, @@ -113,7 +113,7 @@ deprec2.render_template(:apache, file) end end - + desc "Push apache config files to server" task :config, :roles => :web do config_system @@ -126,7 +126,7 @@ task :config_project, :roles => :web do deprec2.push_configs(:apache, PROJECT_CONFIG_FILES[:apache]) - sudo "ln -sf #{deploy_to}/apache/conf/httpd-vhost-app.conf /usr/local/apache2/conf/apps/#{application}.conf" + sudo "ln -sf #{deploy_to}/apache/conf/httpd-vhost-app.conf /usr/local/apache2/conf/apps/#{application}.conf" end desc "Start Apache" @@ -153,27 +153,27 @@ task :activate do send(run_method, "update-rc.d httpd defaults") end - + desc "Set apache to not start on boot" task :deactivate, :roles => :web do send(run_method, "update-rc.d -f httpd remove") end - + task :backup, :roles => :web do # not yet implemented end - + task :restore, :roles => :web do # not yet implemented end - # Generate an index.html page + # Generate an index.html page task :install_index_page do deprec2.mkdir(apache_docroot, :owner => :root, :group => :deploy, :mode => 0775, :via => :sudo) std.su_put deprec2.render_template(:apache, :template => 'index.html.erb'), File.join(apache_docroot, 'index.html') std.su_put deprec2.render_template(:apache, :template => 'master.css'), File.join(apache_docroot, 'master.css') end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/apt.rb b/lib/deprec/recipes/apt.rb index 8564202b..850ae47d 100644 --- a/lib/deprec/recipes/apt.rb +++ b/lib/deprec/recipes/apt.rb @@ -1,6 +1,6 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do set :apt_mirror_hostname, 'archive.ubuntu.com' set :apt_releases_to_mirror, %w(gutsy) @@ -14,11 +14,11 @@ :mode => 0755, :owner => 'root:root'} ] - + desc <<-DESC Generate apt config from template. Note that this does not push the config to the server, it merely generates required - configuration files. These should be kept under source control. + configuration files. These should be kept under source control. The can be pushed to the server with the :config task. DESC task :config_gen do @@ -31,11 +31,11 @@ task :config do deprec2.push_configs(:apt, SYSTEM_CONFIG_FILES[:apt]) end - + end - + namespace :apt_mirror do - + desc "Install apt-mirror" task :install, :roles => :apt_mirror do install_deps @@ -56,7 +56,7 @@ :path => '/etc/apt/mirror.list', :mode => 0755, :owner => 'root:root'}, - + {:template => 'cron.daily', :path => '/etc/cron.daily/apt-mirror', :mode => 0755, @@ -66,7 +66,7 @@ desc <<-DESC Generate apt_mirror config from template. Note that this does not push the config to the server, it merely generates required - configuration files. These should be kept under source control. + configuration files. These should be kept under source control. The can be pushed to the server with the :config task. DESC task :config_gen do @@ -81,17 +81,17 @@ end # Update mirror - # + # # su - apt-mirror -c apt-mirror - + # Add cron job to update - + # Symlink for apache # ln -s /var/spool/apt-mirror/mirror/de.archive.ubuntu.com/ubuntu /var/www/ubuntu # Update sources.list on all hosts: # deb http://192.168.0.100/ubuntu/ gutsy main restricted universe - - end + + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/ar_sendmail.rb b/lib/deprec/recipes/ar_sendmail.rb index e7def3a9..b4eb8363 100644 --- a/lib/deprec/recipes/ar_sendmail.rb +++ b/lib/deprec/recipes/ar_sendmail.rb @@ -1,8 +1,8 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :ar_sendmail do - + desc "Install ar_mailer" task :install, :roles => :app do gem2.install 'ar_mailer' @@ -12,56 +12,56 @@ task :install_deps, :roles => :app do #pass end - + PROJECT_CONFIG_FILES[:ar_sendmail] = [ - + {:template => 'monit.conf.erb', - :path => "monit.conf", + :path => "monit.conf", :mode => 0600, :owner => 'root:root'}, - + {:template => 'logrotate.conf.erb', - :path => "logrotate.conf", + :path => "logrotate.conf", :mode => 0644, :owner => 'root:root'} ] - + task :config_gen do config_gen_project end - + desc "Generate configuration file(s) for ar_sendmail from template(s)" task :config_gen_project do PROJECT_CONFIG_FILES[:ar_sendmail].each do |file| deprec2.render_template(:ar_sendmail, file) end end - + desc "Push ar_sendmail config files to server" task :config, :roles => :app do config_project end - + task :config_project, :roles => :app do deprec2.push_configs(:ar_sendmail, PROJECT_CONFIG_FILES[:ar_sendmail]) symlink_monit_config symlink_logrotate_config end - + task :symlink_monit_config, :roles => :app do deprec2.mkdir(monit_confd_dir, :via => :sudo) sudo "ln -sf #{deploy_to}/ar_sendmail/monit.conf #{monit_confd_dir}/ar_sendmail_#{application}.conf" end - + task :unlink_monit_config, :roles => :app do link = "#{monit_confd_dir}/ar_sendmail_#{application}.conf" sudo "test -L #{link} && unlink #{link}" end - + task :symlink_logrotate_config, :roles => :app do sudo "ln -sf #{deploy_to}/ar_sendmail/logrotate.conf /etc/logrotate.d/ar_sendmail-#{application}" end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/canonical.rb b/lib/deprec/recipes/canonical.rb index 997b35f1..6d3329b8 100644 --- a/lib/deprec/recipes/canonical.rb +++ b/lib/deprec/recipes/canonical.rb @@ -1,57 +1,57 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. # canonical.rb # -# Running deprec:web:stop will be the same as running deprec:apache:stop or +# Running deprec:web:stop will be the same as running deprec:apache:stop or # deprec:nginx:stop depending what you have chosen. # # generic namespaces are linked up to chosen applications at runtime but these # stubs are so they'll be included in the output of "cap -T" # -Capistrano::Configuration.instance(:must_exist).load do - +Capistrano::Configuration.instance(:must_exist).load do + %w(web app db).each do |server| namespace "deprec:#{server}" do - + desc "Install #{server} server" - task :install, :roles => server do + task :install, :roles => server do end - + desc "Generate config file(s) for #{server} server from template(s)" task :config_gen do end - + desc "Deploy configuration files(s) for #{server} server" task :config, :roles => server do end - + desc "Start #{server} server" task :start, :roles => server do end - + desc "Stop #{server} server" task :stop, :roles => server do end - + desc "Stop #{server} server" task :restart, :roles => server do end - + desc "Enable startup script for #{server} server" task :activate, :roles => server do - end - + end + desc "Disable startup script for #{server} server" task :deactivate, :roles => server do end - + desc "Backup data for #{server} server" task :backup, :roles => server do end - + desc "Restore data for #{server} server from backup" task :restore, :roles => server do end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/deprec.rb b/lib/deprec/recipes/deprec.rb index c2f3f81c..ca8468f2 100644 --- a/lib/deprec/recipes/deprec.rb +++ b/lib/deprec/recipes/deprec.rb @@ -1,6 +1,6 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - +Capistrano::Configuration.instance(:must_exist).load do + # Set the value if not already set # This method is accessible to all recipe files def self.default(name, *args, &block) @@ -8,11 +8,11 @@ def self.default(name, *args, &block) set(name, *args, &block) end end - + # Deprec checks here for local versions of config templates before it's own set :local_template_dir, File.join('config','templates') - - # The following two Constants contain details of the configuration + + # The following two Constants contain details of the configuration # files used by each service. They're used when generating config # files from templates and when configs files are pushed out to servers. # @@ -20,38 +20,38 @@ def self.default(name, *args, &block) # SYSTEM_CONFIG_FILES = {} # e.g. httpd.conf PROJECT_CONFIG_FILES = {} # e.g. projectname-httpd-vhost.conf - + # For each service, the details of the file to download and options # to configure, build and install the service SRC_PACKAGES = {} unless defined?(SRC_PACKAGES) - + # Server options CHOICES_WEBSERVER = [:nginx, :apache, :none] CHOICES_APPSERVER = [:mongrel, :webrick, :none] CHOICES_DATABASE = [:mysql, :postgres, :none] - - + + # Server defaults default :web_server_type, :apache default :app_server_type, :mongrel default :db_server_type, :mysql default(:web_server_type) do - Capistrano::CLI.ui.choose do |menu| + Capistrano::CLI.ui.choose do |menu| CHOICES_WEBSERVER.each {|c| menu.choice(c)} menu.header = "select webserver type" end end default(:app_server_type) do - Capistrano::CLI.ui.choose do |menu| + Capistrano::CLI.ui.choose do |menu| CHOICES_APPSERVER.each {|c| menu.choice(c)} menu.header = "select application server type" end end default(:db_server_type) do - Capistrano::CLI.ui.choose do |menu| + Capistrano::CLI.ui.choose do |menu| CHOICES_DATABASE.each {|c| menu.choice(c)} menu.header = "select database server type" end @@ -61,7 +61,7 @@ def self.default(name, *args, &block) Capistrano::CLI.ui.ask "enter name of project(no spaces)" do |q| q.validate = /^[0-9a-z_]*$/ end - end + end default(:domain) do Capistrano::CLI.ui.ask "enter domain name for project" do |q| @@ -80,9 +80,9 @@ def self.default(name, *args, &block) # :invoke_command "command", :via => run_method # override this value if sudo is not an option # in that case, your use will need the correct privileges - default :run_method, :sudo + default :run_method, :sudo - default(:backup_dir) { '/var/backups'} + default(:backup_dir) { '/var/backups'} # XXX rails deploy stuff set :apps_root, File.join( %w(/ opt apps) ) # parent dir for apps @@ -96,16 +96,16 @@ def self.default(name, *args, &block) default :group, 'deploy' # deployment group default(:group_src) { group } # group ownership for src dir default :src_dir, '/usr/local/src' # 3rd party src on servers lives here - default(:web_server_aliases) { domain.match(/^www/) ? [] : ["www.#{domain}"] } + default(:web_server_aliases) { domain.match(/^www/) ? [] : ["www.#{domain}"] } # XXX for some reason this is causing "before deprec:rails:install" to be executed twice - # on :load, 'deprec:connect_canonical_tasks' + # on :load, 'deprec:connect_canonical_tasks' namespace :deprec do - task :connect_canonical_tasks, :hosts => 'localhost' do + task :connect_canonical_tasks, :hosts => 'localhost' do # link application specific recipes into canonical task names - # e.g. deprec:web:restart => deprec:nginx:restart + # e.g. deprec:web:restart => deprec:nginx:restart metaclass = class << self; self; end [:web, :app, :db].each do |server| server_type = send("#{server}_server_type") @@ -120,30 +120,30 @@ def self.default(name, *args, &block) require 'yaml' y variables end - + task :setup_src_dir do deprec2.groupadd(group_src) deprec2.add_user_to_group(user, group_src) deprec2.create_src_dir end - + # Download all packages used by deprec to your local host. # You can then push them to /usr/local/src on target hosts # to save time and bandwidth rather than repeatedly downloading # from the distribution sites. task :update_src do - SRC_PACKAGES.each{|key, src_package| + SRC_PACKAGES.each{|key, src_package| current_dir = Dir.pwd system "cd src/ && test -f #{src_package[:filename]} || wget --quiet --timestamping #{src_package[:url]}" system "cd #{current_dir}" } end - + # todo # # Copy files from src/ to /usr/local/src/ on remote hosts task :push_src do - SRC_PACKAGES.each do |key, src_package| + SRC_PACKAGES.each do |key, src_package| deprec2.set_package_defaults(src_package) file = File.join('src', src_package[:filename]) if File.exists?(file) @@ -151,38 +151,38 @@ def self.default(name, *args, &block) end end end - + task :list_src do # XXX ugly line - look away max_key_size = SRC_PACKAGES.keys.max{|a,b| a.to_s.size <=> b.to_s.size}.to_s.size - SRC_PACKAGES.each{|key, src_package| + SRC_PACKAGES.each{|key, src_package| deprec2.set_package_defaults(src_package) puts "#{key}#{' '*(max_key_size+1-key.to_s.size)}: #{src_package[:url]}" } end - + task :find_src do # XXX ugly line - look away max_key_size = SRC_PACKAGES.keys.max{|a,b| a.to_s.size <=> b.to_s.size}.to_s.size - SRC_PACKAGES.each{|key, src_package| + SRC_PACKAGES.each{|key, src_package| deprec2.set_package_defaults(src_package) puts "#{key}#{' '*(max_key_size+1-key.to_s.size)}: #{src_package[:url]}" puts `find . -name #{src_package[:filename]}` puts } end - + task :recover_src do # XXX ugly line - look away max_key_size = SRC_PACKAGES.keys.max{|a,b| a.to_s.size <=> b.to_s.size}.to_s.size - SRC_PACKAGES.each{|key, src_package| + SRC_PACKAGES.each{|key, src_package| puts "#{key}#{' '*(max_key_size+1-key.to_s.size)}: #{src_package[:url]}" file = `find . -name #{src_package[:filename]}`.split[0] `cp #{file} src/` if file puts } end - + end - + end diff --git a/lib/deprec/recipes/deprecated.rb b/lib/deprec/recipes/deprecated.rb index 8d764374..f4dccd07 100644 --- a/lib/deprec/recipes/deprecated.rb +++ b/lib/deprec/recipes/deprecated.rb @@ -1,13 +1,13 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - +Capistrano::Configuration.instance(:must_exist).load do + # deprecated tasks from deprec1 # we're now using namespaces and some different naming conventions - + # XXX use deprecated function to generate these dynamically - + deprec2_isnt_backwards_compatible = <<-EOF - + You've installed deprec2 but seem to be using a deprec1 command. You have two options: @@ -21,51 +21,51 @@ EOF cap2_warning = <<-EOF - + You're using Capistrano 2 but using a deprecated cap1 command. EOF - + task :setup_admin_account do - puts deprec2_isnt_backwards_compatible + puts deprec2_isnt_backwards_compatible puts " Replace 'cap setup_admin_account' with 'cap deprec:users:add'" puts end - + task :change_root_password do - puts deprec2_isnt_backwards_compatible + puts deprec2_isnt_backwards_compatible puts " Replace 'cap change_root_password' with 'cap deprec:users:passwd'" puts end - + task :setup_ssh_keys do - puts deprec2_isnt_backwards_compatible + puts deprec2_isnt_backwards_compatible puts " Replace 'cap setup_ssh_keys' with 'cap deprec:ssh:setup_keys'" puts end - + task :install_rails_stack do - puts deprec2_isnt_backwards_compatible + puts deprec2_isnt_backwards_compatible puts " Replace 'cap install_rails_stack' with 'cap deprec:rails:install_rails_stack'" puts end - + task :setup do - puts deprec2_isnt_backwards_compatible + puts deprec2_isnt_backwards_compatible puts " Replace 'cap setup' with 'cap deploy:setup'" puts end - + task :restart_apache do - puts deprec2_isnt_backwards_compatible + puts deprec2_isnt_backwards_compatible puts " Replace 'cap restart_apache' with 'cap deprec:apache:restart'" puts end - + task :show_tasks do - puts deprec2_isnt_backwards_compatible + puts deprec2_isnt_backwards_compatible puts " Replace 'cap show-tasks' with 'cap -T'" puts end - + end \ No newline at end of file diff --git a/lib/deprec/recipes/example.rb b/lib/deprec/recipes/example.rb index 58ee4855..7fbcc1eb 100644 --- a/lib/deprec/recipes/example.rb +++ b/lib/deprec/recipes/example.rb @@ -1,54 +1,54 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :example do - + SRC_PACKAGES[:example] = { - :filename => 'example-1.2.3.tar.gz', - :md5sum => "d050a49bd72222ec21c6bb593b3473a5d example-1.2.3.tar.gz", - :dir => 'example-1.2.3', + :filename => 'example-1.2.3.tar.gz', + :md5sum => "d050a49bd72222ec21c6bb593b3473a5d example-1.2.3.tar.gz", + :dir => 'example-1.2.3', :url => "http://www.example.org/dist/example/example-1.2.3.tar.gz", :unpack => "tar zxf example-1.2.3.tar.gz;", :configure => %w( ./configure --enable-mods-shared=all - --enable-proxy + --enable-proxy ; ).reject{|arg| arg.match '#'}.join(' '), :make => 'make;', :install => 'make install;', :post_install => 'install -b support/apachectl /etc/init.d/httpd;' } - + desc "Install example" task :install, :roles => :web do install_deps deprec2.download_src(SRC_PACKAGES[:example], src_dir) deprec2.install_from_src(SRC_PACKAGES[:example], src_dir) end - + task :install_deps do apt.install( {:base => %w(build-essential zlib1g-dev)}, :stable ) end - + SYSTEM_CONFIG_FILES[:example] = [ - + {:template => "example.conf.erb", :path => '/etc/example/example.conf', :mode => 0755, :owner => 'root:root'} - + ] PROJECT_CONFIG_FILES[:example] = [ - + {:template => "example.conf.erb", :path => 'conf/example.conf', :mode => 0755, :owner => 'root:root'} ] - - + + desc "Generate configuration file(s) for XXX from template(s)" task :config_gen do config_gen_system @@ -66,8 +66,8 @@ deprec2.render_template(:example, file) end end - - desc 'Deploy configuration files(s) for XXX' + + desc 'Deploy configuration files(s) for XXX' task :config, :roles => :web do config_system config_project @@ -80,36 +80,36 @@ task :config_project, :roles => :web do deprec2.push_configs(:example, PROJECT_CONFIG_FILES[:example]) end - - + + task :start, :roles => :web do send(run_method, "/etc/init.d/example reload") end - + task :stop, :roles => :web do send(run_method, "/etc/init.d/example reload") end - + task :restart, :roles => :web do send(run_method, "/etc/init.d/example restart") end - + task :reload, :roles => :web do send(run_method, "/etc/init.d/example reload") end - + task :activate, :roles => :web do - end - + end + task :deactivate, :roles => :web do end - + task :backup, :roles => :web do end - + task :restore, :roles => :web do end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/git.rb b/lib/deprec/recipes/git.rb index 1a592b71..8639ea2b 100644 --- a/lib/deprec/recipes/git.rb +++ b/lib/deprec/recipes/git.rb @@ -1,6 +1,6 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :git do set :git_user, 'git' @@ -27,14 +27,14 @@ task :install_deps do apt.install( {:base => %w(zlib1g-dev gettext)}, :stable ) end - + # "Start git server in local directory" task :serve do cmd = "git-daemon --verbose --port=#{git_port} --base-path=#{Dir.pwd} --base-path-relaxed" puts cmd `#{cmd}` end - + desc "Create git repos for current dir" task :init do `git init` @@ -42,39 +42,39 @@ create_files_in_empty_dirs `git add . && git commit -m 'initial import'` end - + task :create_gitignore do - system("echo '.DS_Store' >> .gitignore") # files sometimes created by OSX + system("echo '.DS_Store' >> .gitignore") # files sometimes created by OSX system("echo 'log/*' >> .gitignore") if File.directory?('log') system("echo 'tmp/**/*' >> .gitignore") if File.directory?('tmp') end - + task :create_files_in_empty_dirs do - %w(log tmp).each { |dir| + %w(log tmp).each { |dir| system("touch #{dir}/.gitignore") if File.directory?(dir) } end - + desc "Create remote origin for current dir" task :create_remote_origin do File.directory?('.git') || init - + # Push to remote git repo hostname = capture "echo $CAPISTRANO:HOST$" system "git remote add origin git@#{hostname.chomp}:#{application}" system "git push origin master:refs/heads/master" - - puts + + puts puts "New remote Git repo: #{git_user}@#{hostname.chomp}:#{application}" - puts - + puts + # File.open('.git/config', 'w') do |c| # c.write 'Add the following to .git/config' # c.write '[branch "master"]' # c.write ' remote = origin' # c.write ' merge = refs/heads/master' # end - + end # Create root dir for git repositories @@ -82,16 +82,16 @@ deprec2.mkdir(git_root, :mode => 02775, :owner => git_user, :group => git_group, :via => :sudo) sudo "chmod -R g+w #{git_root}" end - + # regenerate git authorized keys file from users file in same dir task :regenerate_authorized_keys do sudo "echo '' > #{git_keys_file}" sudo "for file in `ls #{git_keys_file}-*`; do cat $file >> #{git_keys_file}; echo \"\n\" >> #{git_keys_file} ; done" sudo "chown #{git_user}.#{git_group} #{git_keys_file}" - sudo "chmod 0600 #{git_keys_file}" + sudo "chmod 0600 #{git_keys_file}" end - end + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/gitosis.rb b/lib/deprec/recipes/gitosis.rb index 26338d81..0b0b2abc 100644 --- a/lib/deprec/recipes/gitosis.rb +++ b/lib/deprec/recipes/gitosis.rb @@ -1,8 +1,8 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :gitosis do - + # ref: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way set :gitosis_user, 'git' @@ -30,10 +30,10 @@ run "grep '^#{gitosis_user}:' /etc/passwd || #{sudo} adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/#{gitosis_user} #{gitosis_user}" sudo "passwd --unlock #{gitosis_user}" end - + task :init do sudo "sudo -H -u #{git_user} gitosis-init < ~/.ssh/authorized_keys" - sudo "chmod 0755 /home/git/repositories/gitosis-admin.git/hooks/post-update" + sudo "chmod 0755 /home/git/repositories/gitosis-admin.git/hooks/post-update" puts puts "Now check out the gitosis-admin repos, edit configs and push changes back" puts "Your changes with update gitosis as soon as they are checked in." @@ -43,6 +43,6 @@ puts "" end - end + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/heartbeat.rb b/lib/deprec/recipes/heartbeat.rb index c2cb1fff..3e57b296 100644 --- a/lib/deprec/recipes/heartbeat.rb +++ b/lib/deprec/recipes/heartbeat.rb @@ -1,60 +1,60 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :heartbeat do set(:heartbeat_nodes) { find_servers_for_task(current_task) } set(:heartbeat_preferred_node) { - Capistrano::CLI.ui.choose do |menu| + Capistrano::CLI.ui.choose do |menu| heartbeat_nodes.each {|c| menu.choice(c)} menu.header = "select preferred node" end } set(:heartbeat_resources) {Capistrano::CLI.ui.ask 'Enter resource to share. e.g. an ip address'} - set(:heartbeat_auth_key) { Capistrano::CLI.ui.ask 'Enter auth key for heartbeat to use' } - set(:heartbeat_ping) { Capistrano::CLI.ui.ask 'Enter IP address nodes will ping to test connectivity. e.g. gateway address' } - set(:heartbeat_bcast) { + set(:heartbeat_auth_key) { Capistrano::CLI.ui.ask 'Enter auth key for heartbeat to use' } + set(:heartbeat_ping) { Capistrano::CLI.ui.ask 'Enter IP address nodes will ping to test connectivity. e.g. gateway address' } + set(:heartbeat_bcast) { Capistrano::CLI.ui.ask 'Enter ethernet interface(s) Heartbeat sends UDP broadcast traffic on. e.g. eth0' do |q| q.default = 'eth0' end - } - set(:heartbeat_auto_failback) { + } + set(:heartbeat_auto_failback) { Capistrano::CLI.ui.ask 'Should resource(s) automatically fail back to its "primary" node ' do |q| q.default = 'yes' end } - + desc "Install Heartbeat" task :install do install_deps end - + # Install dependencies for heartbeat task :install_deps do apt.install( {:base => %w(heartbeat-2)}, :stable ) end - + SYSTEM_CONFIG_FILES[:heartbeat] = [ - + {:template => 'ha.cf.erb', :path => '/etc/ha.d/ha.cf', :mode => 0644, :owner => 'root:root'}, - + {:template => 'haresources.erb', :path => '/etc/ha.d/haresources', :mode => 0644, :owner => 'root:root'}, - + {:template => 'authkeys.erb', :path => '/etc/ha.d/authkeys', :mode => 0600, :owner => 'root:root'} - + ] desc "Generate configuration file(s) for heartbeat from template(s)" task :config_gen do - if ENV['ROLES'] + if ENV['ROLES'] SYSTEM_CONFIG_FILES[:heartbeat].each do |file| file.merge!({:path => "#{file[:path]}-#{ENV['ROLES']}"}) deprec2.render_template(:heartbeat, file) @@ -65,10 +65,10 @@ puts puts "You need to specify the cluster to work on by defining ROLES env variable." puts "e.g. cap deprec:heartbeat:config ROLES=cluster_web" - puts + puts end end - + desc "Push heartbeat config files to server" task :config do if ENV['ROLES'] @@ -79,32 +79,32 @@ } # puts config_files else - puts + puts puts "Whoops!" puts puts "You need to specify the cluster to work on by defining ROLES env variable." puts "e.g. cap deprec:heartbeat:config ROLES=cluster_web" - puts + puts end end - + desc "Set Heartbeat to start on boot" task :activate, :roles => :heartbeat do send(run_method, "update-rc.d heartbeat defaults") end - + desc "Set Heartbeat to not start on boot" task :deactivate, :roles => :heartbeat do send(run_method, "update-rc.d -f heartbeat remove") end - - + + # Control # XXX perhaps define a cluster to work with # XXX e.g. set :cluster, 'rolename' # XXX and then target that rolename with these tasks - + desc "Start Heartbeat" task :start, :roles => :heartbeat do send(run_method, "/etc/init.d/heartbeat start") @@ -124,15 +124,15 @@ task :reload, :roles => :heartbeat do send(run_method, "/etc/init.d/heartbeat reload") end - + task :backup, :roles => :web do # not yet implemented end - + task :restore, :roles => :web do # not yet implemented end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/logrotate.rb b/lib/deprec/recipes/logrotate.rb index 4d35dbb6..fa2a8422 100644 --- a/lib/deprec/recipes/logrotate.rb +++ b/lib/deprec/recipes/logrotate.rb @@ -1,9 +1,9 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :logrotate do - # Install + # Install desc "Install logrotate" task :install do @@ -42,13 +42,13 @@ # Control # - # logrotate is run via cron with a script in /etc/cron.daily/logrotate - + # logrotate is run via cron with a script in /etc/cron.daily/logrotate + desc "Force logrotate to run" task :force do sudo "logrotate -f /etc/logrotate.conf" end - end + end end end diff --git a/lib/deprec/recipes/lvm.rb b/lib/deprec/recipes/lvm.rb index 1bc73a9e..161f7473 100644 --- a/lib/deprec/recipes/lvm.rb +++ b/lib/deprec/recipes/lvm.rb @@ -1,20 +1,20 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :lvm do - + task :pvdisplay do sudo "pvdisplay" end - + task :vgdisplay do sudo "vgdisplay" end - + task :lvdisplay do sudo "lvdisplay" end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/memcache.rb b/lib/deprec/recipes/memcache.rb index 74cb8bae..2d8b7e1a 100644 --- a/lib/deprec/recipes/memcache.rb +++ b/lib/deprec/recipes/memcache.rb @@ -1,39 +1,39 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :memcache do - + set :memcache_ip, '127.0.0.1' set :memcache_port, 11211 set :memcache_memory, 256 - + # XXX needs thought/work task :memcached_start do run "memcached -d -m #{memcache_memory} -l #{memcache_ip} -p #{memcache_port}" end - + # XXX needs thought/work task :memcached_stop do run "killall memcached" end - + # XXX needs thought/work task :memcached_restart do memcached_stop memcached_start end - + task :install_memcached do version = 'memcached-1.2.2' set :src_package, { - :file => version + '.tar.gz', - :md5sum => 'a08851f7fa7b15e92ee6320b7a79c321 memcached-1.2.2.tar.gz', - :dir => version, + :file => version + '.tar.gz', + :md5sum => 'a08851f7fa7b15e92ee6320b7a79c321 memcached-1.2.2.tar.gz', + :dir => version, :url => "http://www.danga.com/memcached/dist/#{version}.tar.gz", :unpack => "tar zxf #{version}.tar.gz;", :configure => %w{ ./configure - --prefix=/usr/local + --prefix=/usr/local ; }.reject{|arg| arg.match '#'}.join(' '), :make => 'make;', @@ -45,5 +45,5 @@ deprec.install_from_src(src_package, src_dir) end end end - + end \ No newline at end of file diff --git a/lib/deprec/recipes/mongrel.rb b/lib/deprec/recipes/mongrel.rb index 7b0034f4..82c45f2b 100644 --- a/lib/deprec/recipes/mongrel.rb +++ b/lib/deprec/recipes/mongrel.rb @@ -1,9 +1,9 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :mongrel do - + set :mongrel_servers, 2 set :mongrel_port, 8000 set :mongrel_address, "127.0.0.1" @@ -11,15 +11,15 @@ set(:mongrel_log_dir) { "#{deploy_to}/shared/log" } set(:mongrel_pid_dir) { "#{deploy_to}/shared/pids" } set :mongrel_conf_dir, '/etc/mongrel_cluster' - set(:mongrel_conf) { "/etc/mongrel_cluster/#{application}.yml" } + set(:mongrel_conf) { "/etc/mongrel_cluster/#{application}.yml" } set :mongrel_user_prefix, 'mongrel_' set(:mongrel_user) { mongrel_user_prefix + application } set :mongrel_group_prefix, 'app_' set(:mongrel_group) { mongrel_group_prefix + application } - - # Install - + + # Install + desc "Install mongrel" task :install, :roles => :app do gem2.install 'mongrel' @@ -31,26 +31,26 @@ end activate_system end - + task :symlink_mongrel_rails, :roles => :app do sudo "ln -sf /usr/local/bin/mongrel_rails /usr/bin/mongrel_rails" end - + task :symlink_logrotate_config, :roles => :app do sudo "ln -sf #{deploy_to}/mongrel/logrotate.conf /etc/logrotate.d/mongrel-#{application}" end - + # Configure - + SYSTEM_CONFIG_FILES[:mongrel] = [ {:template => 'mongrel_cluster-init-script', :path => '/etc/init.d/mongrel_cluster', :mode => 0755, :owner => 'root:root'} - + ] - + PROJECT_CONFIG_FILES[:mongrel] = [ {:template => 'mongrel_cluster.yml.erb', @@ -59,45 +59,45 @@ :owner => 'root:root'}, {:template => 'monit.conf.erb', - :path => "monit.conf", + :path => "monit.conf", :mode => 0600, :owner => 'root:root'}, - + {:template => 'logrotate.conf.erb', - :path => "logrotate.conf", + :path => "logrotate.conf", :mode => 0644, :owner => 'root:root'} - + ] - + desc "Generate configuration file(s) for mongrel from template(s)" task :config_gen do config_gen_system config_gen_project end - + task :config_gen_system do SYSTEM_CONFIG_FILES[:mongrel].each do |file| deprec2.render_template(:mongrel, file) - end + end end - + task :config_gen_project do PROJECT_CONFIG_FILES[:mongrel].each do |file| deprec2.render_template(:mongrel, file) - end + end end - - desc 'Deploy configuration files(s) for mongrel' + + desc 'Deploy configuration files(s) for mongrel' task :config, :roles => :app do config_system config_project end - + task :config_system, :roles => :app do deprec2.push_configs(:mongrel, SYSTEM_CONFIG_FILES[:mongrel]) end - + task :config_project, :roles => :app do create_mongrel_user_and_group deprec2.push_configs(:mongrel, PROJECT_CONFIG_FILES[:mongrel]) @@ -105,57 +105,57 @@ symlink_monit_config symlink_logrotate_config end - + task :symlink_monit_config, :roles => :app do deprec2.mkdir(monit_confd_dir, :via => :sudo) sudo "ln -sf #{deploy_to}/mongrel/monit.conf #{monit_confd_dir}/mongrel_#{application}.conf" end - + task :unlink_monit_config, :roles => :app do sudo "test -L #{monit_confd_dir}/mongrel_#{application}.conf && unlink #{monit_confd_dir}/mongrel_#{application}.conf" end - + task :symlink_mongrel_cluster, :roles => :app do deprec2.mkdir(mongrel_conf_dir, :via => :sudo) sudo "ln -sf #{deploy_to}/mongrel/cluster.yml #{mongrel_conf}" end - + task :unlink_mongrel_cluster, :roles => :app do sudo "test -L #{mongrel_conf} && unlink #{mongrel_conf}" end - - + + # Control - + desc "Start application server." task :start, :roles => :app do send(run_method, "mongrel_rails cluster::start --clean -C #{mongrel_conf}") end - + desc "Stop application server." task :stop, :roles => :app do send(run_method, "mongrel_rails cluster::stop -C #{mongrel_conf}") end - + desc "Restart application server." task :restart, :roles => :app do send(run_method, "mongrel_rails cluster::restart --clean -C #{mongrel_conf}") end - + task :activate do - activate_system + activate_system activate_project - end - + end + task :activate_system do send(run_method, "update-rc.d mongrel_cluster defaults") end - + task :activate_project do symlink_mongrel_cluster symlink_monit_config end - + task :deactivate, :roles => :app do puts puts "******************************************************************" @@ -171,32 +171,32 @@ puts "******************************************************************" puts end - + task :deactivate_system, :roles => :app do send(run_method, "update-rc.d -f mongrel_cluster remove") end - + task :deactivate_project, :roles => :app do unlink_mongrel_cluster unlink_monit_config restart end - + task :backup, :roles => :app do end - + task :restore, :roles => :app do end - + desc "create user and group for mongel to run as" task :create_mongrel_user_and_group, :roles => :app do - deprec2.groupadd(mongrel_group) + deprec2.groupadd(mongrel_group) deprec2.useradd(mongrel_user, :group => mongrel_group, :homedir => false) # Set the primary group for the mongrel user (in case user already existed # when previous command was run) sudo "usermod --gid #{mongrel_group} #{mongrel_user}" end - + desc "set group ownership and permissions on dirs mongrel needs to write to" task :set_perms_for_mongrel_dirs, :roles => :app do tmp_dir = "#{deploy_to}/current/tmp" @@ -204,16 +204,16 @@ files = ["#{mongrel_log_dir}/mongrel.log", "#{mongrel_log_dir}/#{rails_env}.log"] sudo "chgrp -R #{mongrel_group} #{tmp_dir} #{shared_dir}" - sudo "chmod -R g+w #{tmp_dir} #{shared_dir}" - # set owner and group of log files + sudo "chmod -R g+w #{tmp_dir} #{shared_dir}" + # set owner and group of log files files.each { |file| sudo "touch #{file}" - sudo "chown #{mongrel_user} #{file}" - sudo "chgrp #{mongrel_group} #{file}" - sudo "chmod g+w #{file}" - } + sudo "chown #{mongrel_user} #{file}" + sudo "chgrp #{mongrel_group} #{file}" + sudo "chmod g+w #{file}" + } end - + end end end diff --git a/lib/deprec/recipes/monit.rb b/lib/deprec/recipes/monit.rb index 8b335a08..a80433e5 100644 --- a/lib/deprec/recipes/monit.rb +++ b/lib/deprec/recipes/monit.rb @@ -1,11 +1,11 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :monit do - + set :monit_user, 'monit' set :monit_group, 'monit' set :monit_confd_dir, '/etc/monit.d' - + set :monit_check_interval, 60 set :monit_log, 'syslog facility log_daemon' set :monit_mailserver, nil @@ -18,13 +18,13 @@ set :monit_webserver_allowed_hosts_and_networks, %w(localhost) set :monit_webserver_auth_user, 'admin' set :monit_webserver_auth_pass, 'monit' - - # Upstream changes: http://www.tildeslash.com/monit/dist/CHANGES.txt - # Ubuntu package version = monit-4.8.1 + + # Upstream changes: http://www.tildeslash.com/monit/dist/CHANGES.txt + # Ubuntu package version = monit-4.8.1 SRC_PACKAGES[:monit] = { - :filename => 'monit-4.10.1.tar.gz', - :md5sum => "d3143b0bbd79b53f1b019d2fc1dae656 monit-4.10.1.tar.gz", - :dir => 'monit-4.10.1', + :filename => 'monit-4.10.1.tar.gz', + :md5sum => "d3143b0bbd79b53f1b019d2fc1dae656 monit-4.10.1.tar.gz", + :dir => 'monit-4.10.1', :url => "http://www.tildeslash.com/monit/dist/monit-4.10.1.tar.gz", :unpack => "tar zxf monit-4.10.1.tar.gz;", :configure => %w( @@ -34,7 +34,7 @@ :make => 'make;', :install => 'make install;' } - + desc "Install monit" task :install do install_deps @@ -46,34 +46,34 @@ end activate end - + # install dependencies for monit task :install_deps do apt.install( {:base => %w(flex bison libssl-dev)}, :stable ) end - + SYSTEM_CONFIG_FILES[:monit] = [ - + {:template => 'monit-init-script', :path => '/etc/init.d/monit', :mode => 0755, :owner => 'root:root'}, - + {:template => 'monitrc.erb', :path => "/etc/monitrc", :mode => 0700, :owner => 'root:root'}, - + {:template => 'nothing', :path => "/etc/monit.d/nothing", :mode => 0700, :owner => 'root:root'} ] - + desc <<-DESC Generate nginx config from template. Note that this does not push the config to the server, it merely generates required - configuration files. These should be kept under source control. + configuration files. These should be kept under source control. The can be pushed to the server with the :config task. DESC task :config_gen do @@ -81,7 +81,7 @@ deprec2.render_template(:monit, file) end end - + desc "Push monit config files to server" task :config do deprec2.push_configs(:monit, SYSTEM_CONFIG_FILES[:monit]) @@ -106,7 +106,7 @@ task :reload, :roles => :app do send(run_method, "/etc/init.d/monit reload") end - + desc <<-DESC Activate monit start scripts on server. Setup server to start monit on boot. @@ -114,7 +114,7 @@ task :activate do send(run_method, "update-rc.d monit defaults") end - + desc <<-DESC Dectivate monit start scripts on server. Setup server to start monit on boot. @@ -122,11 +122,11 @@ task :deactivate do send(run_method, "update-rc.d -f monit remove") end - + task :backup do # there's nothing to backup for monit end - + task :restore do # there's nothing to restore for monit end diff --git a/lib/deprec/recipes/mysql.rb b/lib/deprec/recipes/mysql.rb index dd0ec930..b2c56177 100644 --- a/lib/deprec/recipes/mysql.rb +++ b/lib/deprec/recipes/mysql.rb @@ -1,87 +1,87 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :mysql do - + # Installation - + desc "Install mysql" task :install, :roles => :db do install_deps # symlink_mysql_sockfile # XXX still needed? end - + # Install dependencies for Mysql task :install_deps, :roles => :db do apt.install( {:base => %w(mysql-server mysql-client)}, :stable ) end - + # task :symlink_mysql_sockfile, :roles => :db do # # rails puts "socket: /tmp/mysql.sock" into config/database.yml # # this is not the location for our ubuntu's mysql socket file # # so we create this link to make deployment using rails defaults simpler # sudo "ln -sf /var/run/mysqld/mysqld.sock /tmp/mysql.sock" # end - + # Configuration - + SYSTEM_CONFIG_FILES[:mysql] = [ - + {:template => "my.cnf.erb", :path => '/etc/mysql/my.cnf', :mode => 0644, :owner => 'root:root'} ] - + desc "Generate configuration file(s) for mysql from template(s)" task :config_gen do SYSTEM_CONFIG_FILES[:mysql].each do |file| deprec2.render_template(:mysql, file) end end - + desc "Push mysql config files to server" task :config, :roles => :db do deprec2.push_configs(:mysql, SYSTEM_CONFIG_FILES[:mysql]) end - + task :activate, :roles => :db do send(run_method, "update-rc.d mysql defaults") - end - + end + task :deactivate, :roles => :db do send(run_method, "update-rc.d -f mysql remove") end - + # Control - + desc "Start Mysql" task :start, :roles => :db do send(run_method, "/etc/init.d/mysql start") end - + desc "Stop Mysql" task :stop, :roles => :db do send(run_method, "/etc/init.d/mysql stop") end - + desc "Restart Mysql" task :restart, :roles => :db do send(run_method, "/etc/init.d/mysql restart") end - + desc "Reload Mysql" task :reload, :roles => :db do send(run_method, "/etc/init.d/mysql reload") end - - + + task :backup, :roles => :db do end - + task :restore, :roles => :db do end - + end end end @@ -96,18 +96,18 @@ # get current position of binlog # mysql> FLUSH TABLES WITH READ LOCK; # Query OK, 0 rows affected (0.00 sec) -# +# # mysql> SHOW MASTER STATUS; # +------------------+----------+--------------+------------------+ # | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | # +------------------+----------+--------------+------------------+ -# | mysql-bin.000012 | 296 | | | +# | mysql-bin.000012 | 296 | | | # +------------------+----------+--------------+------------------+ # 1 row in set (0.00 sec) -# +# # # get current data # mysqldump --all-databases --master-data >dbdump.db -# +# # UNLOCK TABLES; diff --git a/lib/deprec/recipes/nagios.rb b/lib/deprec/recipes/nagios.rb index b070ba07..beddfd11 100644 --- a/lib/deprec/recipes/nagios.rb +++ b/lib/deprec/recipes/nagios.rb @@ -1,26 +1,26 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :nagios do - + set :nagios_user, 'nagios' set :nagios_group, 'nagios' set(:nagios_host) { Capistrano::CLI.ui.ask "Enter hostname of nagios server" } set :nagios_cmd_group, 'nagcmd' # Allow external commands to be submitted through the web interface - default :application, 'nagios' - + default :application, 'nagios' + SRC_PACKAGES[:nagios] = { :url => "http://internap.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.2.tar.gz", - :md5sum => "008d71aac08660bc007f7130ea82ab80 nagios-3.0.2.tar.gz", + :md5sum => "008d71aac08660bc007f7130ea82ab80 nagios-3.0.2.tar.gz", :configure => %w( - ./configure + ./configure --with-command-group=nagcmd ; ).reject{|arg| arg.match '#'}.join(' '), :make => 'make all;', :install => 'make install install-init install-commandmode' } - + desc "Install nagios" task :install do install_deps @@ -32,7 +32,7 @@ deprec2.install_from_src(SRC_PACKAGES[:nagios], src_dir) activate end - + task :create_nagios_user do deprec2.groupadd(nagios_group) deprec2.useradd(nagios_user, :group => nagios_group, :homedir => false) @@ -41,14 +41,14 @@ # Add apache user to nagios group to permit commands via web interface deprec2.add_user_to_group(apache_user, nagios_cmd_group) end - + # Install dependencies for nagios task :install_deps do apt.install( {:base => %w(mailx)}, :stable ) end - + SYSTEM_CONFIG_FILES[:nagios] = [ - + {:template => 'nagios.cfg.erb', :path => '/usr/local/nagios/etc/nagios.cfg', :mode => 0664, @@ -58,7 +58,7 @@ :path => '/usr/local/nagios/etc/resource.cfg', :mode => 0660, :owner => 'nagios:nagios'}, - + {:template => 'cgi.cfg.erb', :path => '/usr/local/nagios/etc/cgi.cfg', :mode => 0664, @@ -73,47 +73,47 @@ :path => '/usr/local/nagios/etc/objects/templates.cfg', :mode => 0664, :owner => 'nagios:nagios'}, - + {:template => 'commands.cfg.erb', :path => '/usr/local/nagios/etc/objects/commands.cfg', :mode => 0664, :owner => 'nagios:nagios'}, - + {:template => 'timeperiods.cfg.erb', :path => '/usr/local/nagios/etc/objects/timeperiods.cfg', :mode => 0664, :owner => 'nagios:nagios'}, - + {:template => 'localhost.cfg.erb', :path => '/usr/local/nagios/etc/objects/localhost.cfg', :mode => 0664, :owner => 'nagios:nagios'}, - + {:template => 'contacts.cfg.erb', :path => '/usr/local/nagios/etc/objects/contacts.cfg', :mode => 0664, :owner => 'nagios:nagios'}, - + {:template => 'hosts.cfg.erb', :path => '/usr/local/nagios/etc/objects/hosts.cfg', :mode => 0664, :owner => 'nagios:nagios'}, - + {:template => 'services.cfg.erb', :path => '/usr/local/nagios/etc/objects/services.cfg', :mode => 0664, :owner => 'nagios:nagios'}, - + {:template => 'localhost.cfg.erb', :path => '/usr/local/nagios/etc/objects/localhost.cfg', :mode => 0664, :owner => 'nagios:nagios'}, - + {:template => 'nagios_apache_vhost.conf.erb', :path => "conf/nagios_apache_vhost.conf", :mode => 0644, :owner => 'root:root'} - + ] desc "Generate configuration file(s) for nagios from template(s)" @@ -122,7 +122,7 @@ deprec2.render_template(:nagios, file) end end - + desc "Push nagios config files to server" task :config, :roles => :nagios do set :application, 'nagios' @@ -131,25 +131,25 @@ config_check restart end - + desc "Run Nagios config check" task :config_check, :roles => :nagios do send(run_method, "/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg") end - + desc "Set Nagios to start on boot" task :activate, :roles => :nagios do send(run_method, "update-rc.d nagios defaults") sudo "ln -sf #{deploy_to}/nagios/conf/nagios_apache_vhost.conf /usr/local/apache2/conf/apps" end - + desc "Set Nagios to not start on boot" task :deactivate, :roles => :nagios do send(run_method, "update-rc.d -f nagios remove") link = "#{apache_vhost_dir}/nagios_#{application}.conf" sudo "test -h #{link} && sudo unlink #{link} || true" end - + # Control desc "Start Nagios" @@ -171,19 +171,19 @@ task :reload, :roles => :nagios do send(run_method, "/etc/init.d/nagios reload") end - + task :backup, :roles => :web do # not yet implemented end - + task :restore, :roles => :web do # not yet implemented end - + # # Service specific tasks # - + # XXX quick and dirty - clean up later desc "Grant a user access to the web interface" task :htpass, :roles => :nagios do @@ -192,47 +192,47 @@ end system "htpasswd config/nagios/usr/local/nagios/etc/htpasswd.users #{target_user}" end - + end - + SRC_PACKAGES[:nagios_plugins] = { :url => "http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.12.tar.gz", - :md5sum => "af68d00bbe2c39de02803d23e5eecca3 nagios-plugins-1.4.12.tar.gz", + :md5sum => "af68d00bbe2c39de02803d23e5eecca3 nagios-plugins-1.4.12.tar.gz", :configure => "./configure --with-nagios-user=#{nagios_user} --with-nagios-group=#{nagios_group};", - } - + } + namespace :nagios_plugins do - + desc "Install nagios plugins" task :install do install_deps top.deprec.nagios.create_nagios_user deprec2.download_src(SRC_PACKAGES[:nagios_plugins], src_dir) - deprec2.install_from_src(SRC_PACKAGES[:nagios_plugins], src_dir) + deprec2.install_from_src(SRC_PACKAGES[:nagios_plugins], src_dir) end - + # Install dependencies for nagios plugins task :install_deps do apt.install( {:base => %w(libmysqlclient15-dev)}, :stable ) end - - + + end - + namespace :nrpe do - + default :nrpe_enable_command_args, false # set to true to compile nrpe to accept arguments # note that you'll need to set it before these recipes are loaded (e.g. in .caprc) - + SRC_PACKAGES[:nrpe] = { :url => "http://downloads.sourceforge.net/nagios/nrpe-2.12.tar.gz", - :md5sum => "b2d75e2962f1e3151ef58794d60c9e97 nrpe-2.12.tar.gz", + :md5sum => "b2d75e2962f1e3151ef58794d60c9e97 nrpe-2.12.tar.gz", :configure => "./configure --with-nagios-user=#{nagios_user} --with-nagios-group=#{nagios_group} #{ '--enable-command-args' if nrpe_enable_command_args};", :make => 'make all;', :install => 'make install-plugin; make install-daemon; make install-daemon-config;' } - + desc 'Install NRPE' task :install do install_deps @@ -240,66 +240,66 @@ deprec2.download_src(SRC_PACKAGES[:nrpe], src_dir) deprec2.install_from_src(SRC_PACKAGES[:nrpe], src_dir) # XXX this should only be run on the nrpe clients - # XXX currently it's run on the nagios server too - # XXX shouldn't do any harm but we should split them up later - deprec2.append_to_file_if_missing('/etc/services', 'nrpe 5666/tcp # NRPE') + # XXX currently it's run on the nagios server too + # XXX shouldn't do any harm but we should split them up later + deprec2.append_to_file_if_missing('/etc/services', 'nrpe 5666/tcp # NRPE') end - + task :install_deps do apt.install( {:base => %w(xinetd libssl-dev openssl)}, :stable ) end - + SYSTEM_CONFIG_FILES[:nrpe] = [ - + {:template => 'nrpe.xinetd.erb', :path => "/etc/xinetd.d/nrpe", :mode => 0644, :owner => 'root:root'}, - + {:template => 'nrpe.cfg.erb', :path => "/usr/local/nagios/etc/nrpe.cfg", :mode => 0644, :owner => 'nagios:nagios'}, # XXX hard coded file owner is bad... - # It's done here because we aren't using + # It's done here because we aren't using # lazy eval in hash constant. {:template => "check_mongrel_cluster.rb", :path => '/usr/local/nagios/libexec/check_mongrel_cluster.rb', :mode => 0755, :owner => 'root:root'}, - + {:template => "check_linux_free_memory.pl", :path => '/usr/local/nagios/libexec/check_linux_free_memory.pl', :mode => 0755, :owner => 'root:root'} - + ] - + desc "Generate configuration file(s) for nrpe from template(s)" task :config_gen do SYSTEM_CONFIG_FILES[:nrpe].each do |file| deprec2.render_template(:nagios, file) end end - + desc "Push nrpe config files to server" task :config do deprec2.push_configs(:nagios, SYSTEM_CONFIG_FILES[:nrpe]) # XXX should really only do this on targets - sudo "/etc/init.d/xinetd stop" - sudo "/etc/init.d/xinetd start" + sudo "/etc/init.d/xinetd stop" + sudo "/etc/init.d/xinetd start" end - + task :test_local do run "/usr/local/nagios/libexec/check_nrpe -H localhost" end - + task :test_remote, :roles => :nagios do target_host = Capistrano::CLI.ui.ask "target hostname" run "/usr/local/nagios/libexec/check_nrpe -H #{target_host}" end - + end - - + + end end \ No newline at end of file diff --git a/lib/deprec/recipes/network.rb b/lib/deprec/recipes/network.rb index 97100334..230e5676 100644 --- a/lib/deprec/recipes/network.rb +++ b/lib/deprec/recipes/network.rb @@ -1,14 +1,14 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :network do - - set(:network_number_of_ports) { + + set(:network_number_of_ports) { Capistrano::CLI.ui.ask "Number of network ports" do |q| q.default = 1 - end + end } - + set(:network_interfaces) { foo = {} network_number_of_ports.to_i.times do |port| @@ -26,22 +26,22 @@ end foo } - set(:network_hostname) { + set(:network_hostname) { Capistrano::CLI.ui.ask "hostname" do |q| # q.validate = /add hostname validation here/ - end - } - set(:network_gateway) { + end + } + set(:network_gateway) { Capistrano::CLI.ui.ask "default gateway" do |q| q.default = '192.168.1.1' - end + end } - set(:network_dns_nameservers) { + set(:network_dns_nameservers) { Capistrano::CLI.ui.ask "dns nameservers (separated by spaces)" do |q| q.default = '203.8.183.1 4.2.2.1' - end + end } - + SYSTEM_CONFIG_FILES[:network] = [ {:template => "interfaces.erb", @@ -58,9 +58,9 @@ :path => '/etc/hostname', :mode => 0644, :owner => 'root:root'} - + ] - + # XXX need to set the order for these as it breaks sudo currently desc "Update system networking configuration" task :config do @@ -68,14 +68,14 @@ deprec2.render_template(:network, file.merge(:remote=>true)) end end - + desc "Restart network interface" task :restart do sudo '/etc/init.d/networking restart' end - - + + end end - + end \ No newline at end of file diff --git a/lib/deprec/recipes/nginx.rb b/lib/deprec/recipes/nginx.rb index e0a29cdb..c966fd22 100644 --- a/lib/deprec/recipes/nginx.rb +++ b/lib/deprec/recipes/nginx.rb @@ -1,6 +1,6 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :nginx do set :nginx_server_name, nil @@ -66,7 +66,7 @@ desc <<-DESC Generate nginx config from template. Note that this does not push the config to the server, it merely generates required - configuration files. These should be kept under source control. + configuration files. These should be kept under source control. The can be pushed to the server with the :config task. DESC task :config_gen do @@ -132,13 +132,13 @@ task :restore, :roles => :web do # there's nothing to store for nginx end - + # Helper task to get rid of pesky "it works" page - not called by deprec tasks task :rename_index_page, :roles => :web do index_file = '/usr/local/nginx/html/index.html' sudo "test -f #{index_file} && sudo mv #{index_file} #{index_file}.orig || exit 0" end - end + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/ntp.rb b/lib/deprec/recipes/ntp.rb index 996d9bf9..af65b6d9 100644 --- a/lib/deprec/recipes/ntp.rb +++ b/lib/deprec/recipes/ntp.rb @@ -1,9 +1,9 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :ntp do - # Install + # Install desc "Install ntp" task :install do @@ -84,7 +84,7 @@ # there's nothing to store for ntp end - end + end end end @@ -99,5 +99,5 @@ # # reconfigure timezone on hardy -# +# # dpkg-reconfigure tzdata diff --git a/lib/deprec/recipes/php.rb b/lib/deprec/recipes/php.rb index 84e16b16..d1c87479 100644 --- a/lib/deprec/recipes/php.rb +++ b/lib/deprec/recipes/php.rb @@ -1,19 +1,19 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :php do - + desc "Install PHP from source" task :install do version = 'php-5.2.4' set :src_package, { :file => version + '.tar.gz', - :md5sum => '0826e231c3148b29fd039d7a8c893ad3 php-5.2.4.tar.gz', + :md5sum => '0826e231c3148b29fd039d7a8c893ad3 php-5.2.4.tar.gz', :dir => version, :url => "http://www.php.net/distributions/#{version}.tar.gz", :unpack => "tar zxf #{version}.tar.gz;", :configure => %w( - ./configure + ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --disable-ipv6 @@ -21,7 +21,7 @@ --enable-soap --with-pcre-regex --with-mysql - --with-zlib + --with-zlib --with-gettext --with-sqlite --enable-sqlite-utf8 @@ -32,7 +32,7 @@ --with-gd --with-ctype --enable-mbstring - --with-curl==/usr/lib + --with-curl==/usr/lib ; ).reject{|arg| arg.match '#'}.join(' '), :make => 'make;', @@ -45,55 +45,55 @@ deprec2.install_from_src(src_package, src_dir) deprec2.append_to_file_if_missing('/usr/local/apache2/conf/httpd.conf', 'AddType application/x-httpd-php .php') end - + # install dependencies for php task :install_deps do puts "This function should be overridden by your OS plugin!" - apt.install( {:base => %w(zlib1g-dev zlib1g openssl libssl-dev - flex libcurl3 libcurl3-dev libmcrypt-dev libmysqlclient15-dev libncurses5-dev + apt.install( {:base => %w(zlib1g-dev zlib1g openssl libssl-dev + flex libcurl3 libcurl3-dev libmcrypt-dev libmysqlclient15-dev libncurses5-dev libxml2-dev libjpeg62-dev libpng12-dev)}, :stable ) end - + desc "generate config file for php" task :config_gen do # not yet implemented end - - desc "deploy config file for php" + + desc "deploy config file for php" task :config, :roles => :web do # not yet implemented end - + task :start, :roles => :web do # not applicable end - + task :stop, :roles => :web do # not applicable end - + task :restart, :roles => :web do # not applicable end - + desc "enable php in webserver" task :activate, :roles => :web do # not yet implemented - end - + end + desc "disable php in webserver" task :deactivate, :roles => :web do # not yet implemented end - + task :backup, :roles => :web do # not applicable end - + task :restore, :roles => :web do # not applicable end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/postfix.rb b/lib/deprec/recipes/postfix.rb index 262779ab..3990d792 100644 --- a/lib/deprec/recipes/postfix.rb +++ b/lib/deprec/recipes/postfix.rb @@ -1,65 +1,65 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do # XXX not complete namespace :deprec do namespace :postfix do - - set(:postfix_relayhost) { Capistrano::CLI.ui.ask "What host should we relay mail through?" } + + set(:postfix_relayhost) { Capistrano::CLI.ui.ask "What host should we relay mail through?" } desc "Install Postfix" task :install, :roles => :mail do install_deps end - + # Install dependencies for Postfix task :install_deps do # mutt and mailx are useful tools for testing mail # e.g. echo test | mail test@gmail.com apt.install( {:base => %w(postfix mutt mailx)}, :stable ) end - - # This is my default Postfix setup on servers that + + # This is my default Postfix setup on servers that # aren't my main outgoing mailserver. # It accepts mail from localhost only and relays # all mail to a master mailserver for delivery. # SYSTEM_CONFIG_FILES[:postfix] = [ - + {:template => "main.cf.erb", :path => '/etc/postfix/main.cf', :mode => 0644, :owner => 'root:root'}, - + {:template => "master.cf.erb", :path => '/etc/postfix/master.cf', :mode => 0644, :owner => 'root:root'}, - + {:template => "dynamicmaps.cf.erb", :path => '/etc/postfix/dynamicmaps.cf', :mode => 0644, :owner => 'root:root'}, - + {:template => "aliases.erb", :path => '/etc/aliases', :mode => 0644, :owner => 'root:root'} - + ] - - desc 'Generate configuration files(s) for postfix' + + desc 'Generate configuration files(s) for postfix' task :config_gen do SYSTEM_CONFIG_FILES[:postfix].each do |file| deprec2.render_template(:postfix, file) end end - - desc 'Deploy configuration files(s) for postfix' + + desc 'Deploy configuration files(s) for postfix' task :config, :roles => :mail, :except => { :master => true } do deprec2.push_configs(:postfix, SYSTEM_CONFIG_FILES[:postfix]) send(run_method, "/usr/bin/newaliases") reload end - + desc "Start Postfix" task :start, :roles => :mail do send(run_method, "/etc/init.d/postfix start") @@ -79,29 +79,29 @@ task :reload, :roles => :mail do send(run_method, "/etc/init.d/postfix reload") end - + task :activate, :roles => :web do - end - + end + task :deactivate, :roles => :web do end - + task :backup, :roles => :web do end - + task :restore, :roles => :web do end - + end end end - - - # Capistrano::Configuration.instance(:must_exist).load do -# + + + # Capistrano::Configuration.instance(:must_exist).load do +# # namespace :deprec do namespace :nginx do -# -# #Craig: I've kept this generic rather than calling the task setup postfix. +# +# #Craig: I've kept this generic rather than calling the task setup postfix. # # if people want other smtp servers, it could be configurable # desc "install and configure postfix" # task :setup_smtp_server do @@ -109,6 +109,6 @@ # set :postfix_destination_domains, [domain] + apache_server_aliases # deprec.render_template_to_file('postfix_main', '/etc/postfix/main.cf') # end -# +# # end end # end \ No newline at end of file diff --git a/lib/deprec/recipes/rails.rb b/lib/deprec/recipes/rails.rb index 82a49668..0b7950ee 100644 --- a/lib/deprec/recipes/rails.rb +++ b/lib/deprec/recipes/rails.rb @@ -1,5 +1,5 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do set :database_yml_in_scm, true set :app_symlinks, nil @@ -34,7 +34,7 @@ namespace :deprec do namespace :rails do - + task :install, :roles => :app do install_deps install_gems @@ -43,7 +43,7 @@ task :install_deps do apt.install( {:base => %w(libmysqlclient15-dev sqlite3 libsqlite3-ruby libsqlite3-dev)}, :stable ) end - + # install some required ruby gems task :install_gems do gem2.install 'sqlite3-ruby' @@ -51,45 +51,45 @@ gem2.install 'rails' gem2.install 'rspec' end - + desc <<-DESC Install full rails stack on a stock standard ubuntu server (7.10, 8.04) DESC - task :install_stack do - + task :install_stack do + # Ruby everywhere! - top.deprec.ruby.install + top.deprec.ruby.install top.deprec.rubygems.install - + deprec2.for_roles('web') do - top.deprec.nginx.install + top.deprec.nginx.install end - + deprec2.for_roles('app') do top.deprec.svn.install - top.deprec.git.install + top.deprec.git.install top.deprec.mongrel.install top.deprec.monit.install top.deprec.rails.install end - + deprec2.for_roles('web,app') do - top.deprec.logrotate.install + top.deprec.logrotate.install end - - # Install database separately + + # Install database separately deprec2.for_roles('db') do top.deprec.mysql.install - top.deprec.mysql.start + top.deprec.mysql.start end end - + task :install_rails_stack do puts "deprecated: this task is now called install_stack" install_stack end - + task :install_gems_for_project, :roles => :app do if gems_for_project gems_for_project.each { |gem| gem2.install(gem) } @@ -97,18 +97,18 @@ end PROJECT_CONFIG_FILES[:nginx] = [ - + {:template => 'rails_nginx_vhost.conf.erb', - :path => "rails_nginx_vhost.conf", + :path => "rails_nginx_vhost.conf", :mode => 0644, :owner => 'root:root'}, - + {:template => 'logrotate.conf.erb', - :path => "logrotate.conf", + :path => "logrotate.conf", :mode => 0644, - :owner => 'root:root'} + :owner => 'root:root'} ] - + desc "Generate config files for rails app." task :config_gen do PROJECT_CONFIG_FILES[:nginx].each do |file| @@ -128,7 +128,7 @@ task :symlink_nginx_vhost, :roles => :web do sudo "ln -sf #{deploy_to}/nginx/rails_nginx_vhost.conf #{nginx_vhost_dir}/#{application}.conf" end - + task :symlink_nginx_logrotate_config, :roles => :web do sudo "ln -sf #{deploy_to}/nginx/logrotate.conf /etc/logrotate.d/nginx-#{application}" end @@ -136,7 +136,7 @@ task :create_config_dir, :roles => :app do deprec2.mkdir("#{shared_path}/config", :group => group, :mode => 0775, :via => :sudo) end - + desc "Create deployment group and add current user to it" task :setup_user_perms, :roles => [:app, :web] do deprec2.groupadd(group) @@ -144,10 +144,10 @@ deprec2.groupadd(mongrel_group) deprec2.add_user_to_group(user, mongrel_group) # we've just added ourself to a group - need to teardown connection - # so that next command uses new session where we belong in group + # so that next command uses new session where we belong in group deprec2.teardown_connections end - + task :set_perms_on_shared_and_releases, :roles => :app do releases = File.join(deploy_to, 'releases') sudo "chgrp -R #{group} #{shared_path} #{releases}" @@ -164,7 +164,7 @@ deprec2.mkdir(deploy_to, :mode => 0775, :group => group, :via => :sudo) deprec2.mkdir(shared_path, :mode => 0775, :group => group, :via => :sudo) end - + # Symlink list of files and dirs from shared to current # # XXX write up explanation @@ -179,16 +179,16 @@ desc "Symlink shared dirs." task :symlink_shared_dirs, :roles => [:app, :web] do if shared_dirs - shared_dirs.each do |dir| + shared_dirs.each do |dir| path = File.split(dir)[0] if path != '.' deprec2.mkdir("#{current_path}/#{path}") end - run "ln -nfs #{shared_path}/#{dir} #{current_path}/#{dir}" + run "ln -nfs #{shared_path}/#{dir} #{current_path}/#{dir}" end end end - + # desc "Symlink shared files." # task :symlink_shared_files, :roles => [:app, :web] do # if shared_files @@ -198,7 +198,7 @@ # database.yml stuff # - # XXX DRY this up + # XXX DRY this up # I don't know how to let :gen_db_yml check if values have been set. # # if (self.respond_to?("db_host_#{rails_env}".to_sym)) # doesn't seem to work @@ -227,7 +227,7 @@ set :db_socket_staging, lambda { db_socket_default } set :db_socket_production, lambda { db_socket_default } - task :generate_database_yml, :roles => :app do + task :generate_database_yml, :roles => :app do database_configuration = render :template => <<-EOF #{rails_env}: adapter: #{self.send("db_adaptor_#{rails_env}")} @@ -237,21 +237,21 @@ host: #{self.send("db_host_#{rails_env}")} socket: #{self.send("db_socket_#{rails_env}")} EOF - run "mkdir -p #{deploy_to}/#{shared_dir}/config" - put database_configuration, "#{deploy_to}/#{shared_dir}/config/database.yml" + run "mkdir -p #{deploy_to}/#{shared_dir}/config" + put database_configuration, "#{deploy_to}/#{shared_dir}/config/database.yml" end - desc "Link in the production database.yml" + desc "Link in the production database.yml" task :symlink_database_yml, :roles => :app do - run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" + run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" end - + desc "setup and configure servers" task :setup_servers do - top.deprec.nginx.activate - top.deprec.mongrel.create_mongrel_user_and_group + top.deprec.nginx.activate + top.deprec.mongrel.create_mongrel_user_and_group top.deprec.mongrel.activate top.deprec.monit.activate top.deprec.rails.config_gen @@ -260,7 +260,7 @@ end namespace :db do - + desc "Create database" task :create, :roles => :db do run "cd #{deploy_to}/current && rake db:create RAILS_ENV=#{rails_env}" @@ -270,7 +270,7 @@ task :migrate, :roles => :db do run "cd #{deploy_to}/current && rake db:migrate RAILS_ENV=#{rails_env}" end - + desc "Run database migrations" task :schema_load, :roles => :db do run "cd #{deploy_to}/current && rake db:schema:load RAILS_ENV=#{rails_env}" @@ -284,5 +284,5 @@ end end - + end diff --git a/lib/deprec/recipes/ruby.rb b/lib/deprec/recipes/ruby.rb index b297abc8..4bbbab21 100644 --- a/lib/deprec/recipes/ruby.rb +++ b/lib/deprec/recipes/ruby.rb @@ -1,13 +1,13 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :ruby do - + SRC_PACKAGES[:ruby] = { - :filename => 'ruby-1.8.6-p287.tar.gz', - :md5sum => "f6cd51001534ced5375339707a757556 ruby-1.8.6-p287.tar.gz", - :dir => 'ruby-1.8.6-p287', + :filename => 'ruby-1.8.6-p287.tar.gz', + :md5sum => "f6cd51001534ced5375339707a757556 ruby-1.8.6-p287.tar.gz", + :dir => 'ruby-1.8.6-p287', :url => "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p287.tar.gz", :unpack => "tar zxf ruby-1.8.6-p287.tar.gz;", :configure => %w( @@ -18,51 +18,51 @@ :make => 'make;', :install => 'make install;' } - + task :install do install_deps deprec2.download_src(SRC_PACKAGES[:ruby], src_dir) deprec2.install_from_src(SRC_PACKAGES[:ruby], src_dir) end - + task :install_deps do apt.install( {:base => %w(zlib1g-dev libssl-dev libncurses5-dev libreadline5-dev)}, :stable ) end end end - - + + namespace :deprec do namespace :rubygems do - + SRC_PACKAGES[:rubygems] = { - :filename => 'rubygems-1.2.0.tgz', - :md5sum => "b77a4234360735174d1692e6fc598402 rubygems-1.2.0.tgz", - :dir => 'rubygems-1.2.0', + :filename => 'rubygems-1.2.0.tgz', + :md5sum => "b77a4234360735174d1692e6fc598402 rubygems-1.2.0.tgz", + :dir => 'rubygems-1.2.0', :url => "http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz", :unpack => "tar zxf rubygems-1.2.0.tgz;", :configure => "", :make => "", :install => 'ruby setup.rb;' } - + task :install do install_deps deprec2.download_src(SRC_PACKAGES[:rubygems], src_dir) deprec2.install_from_src(SRC_PACKAGES[:rubygems], src_dir) # gem2.upgrade # you may not want to upgrade your gems right now - # If we want to selfupdate then we need to + # If we want to selfupdate then we need to # create symlink as latest gems version is broken # gem2.update_system # sudo ln -s /usr/bin/gem1.8 /usr/bin/gem end - + # install dependencies for rubygems task :install_deps do end - - end + + end end - + end diff --git a/lib/deprec/recipes/sphinx.rb b/lib/deprec/recipes/sphinx.rb index f6e47c3e..20b6842f 100644 --- a/lib/deprec/recipes/sphinx.rb +++ b/lib/deprec/recipes/sphinx.rb @@ -1,11 +1,11 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :sphinx do - + SRC_PACKAGES[:sphinx] = { - :filename => 'sphinx-0.9.8-rc2.tar.gz', - :dir => 'sphinx-0.9.8-rc2', + :filename => 'sphinx-0.9.8-rc2.tar.gz', + :dir => 'sphinx-0.9.8-rc2', :url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.8-rc2.tar.gz", :unpack => "tar zxf sphinx-0.9.8-rc2.tar.gz;", :configure => %w( @@ -15,33 +15,33 @@ :make => 'make;', :install => 'make install;' } - + desc "install Sphinx Search Engine" task :install do deprec2.download_src(SRC_PACKAGES[:sphinx], src_dir) deprec2.install_from_src(SRC_PACKAGES[:sphinx], src_dir) end - + # install dependencies for sphinx task :install_deps do # apt.install( {:base => %w(blah)}, :stable ) end SYSTEM_CONFIG_FILES[:sphinx] = [] - + PROJECT_CONFIG_FILES[:sphinx] = [ {:template => 'monit.conf.erb', :path => 'monit.conf', :mode => 0644, :owner => 'root:root'} - + ] desc <<-DESC Generate sphinx config from template. Note that this does not push the config to the server, it merely generates required - configuration files. These should be kept under source control. + configuration files. These should be kept under source control. The can be pushed to the server with the :config task. DESC task :config_gen do @@ -54,20 +54,20 @@ task :config, :roles => :sphinx do config_project end - + desc "Push sphinx config files to server" task :config_project, :roles => :sphinx do deprec2.push_configs(:sphinx, PROJECT_CONFIG_FILES[:sphinx]) symlink_monit_config end - + task :symlink_monit_config, :roles => :sphinx do sudo "ln -sf #{deploy_to}/sphinx/monit.conf #{monit_confd_dir}/sphinx_#{application}.conf" end # Control - + desc "Restart the sphinx searchd daemon" task :restart, :roles => :app do run("cd #{deploy_to}/current; /usr/bin/rake us:start") ### start or restart? SUDO ? ### @@ -78,7 +78,7 @@ run("cd #{deploy_to}/current; /usr/bin/rake us:in") ### SUDO ? ### end - end + end end end diff --git a/lib/deprec/recipes/ssh.rb b/lib/deprec/recipes/ssh.rb index e24dbb45..5992c890 100644 --- a/lib/deprec/recipes/ssh.rb +++ b/lib/deprec/recipes/ssh.rb @@ -1,22 +1,22 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :ssh do - + SYSTEM_CONFIG_FILES[:ssh] = [ - + {:template => "sshd_config.erb", :path => '/etc/ssh/sshd_config', :mode => 0644, :owner => 'root:root'}, - + {:template => "ssh_config.erb", :path => '/etc/ssh/ssh_config', :mode => 0644, :owner => 'root:root'} ] - - task :config_gen do + + task :config_gen do SYSTEM_CONFIG_FILES[:ssh].each do |file| deprec2.render_template(:ssh, file) end @@ -26,7 +26,7 @@ Dir.mkdir(auth_keys_dir) end end - + desc "Push ssh config files to server" task :config do deprec2.push_configs(:ssh, SYSTEM_CONFIG_FILES[:ssh]) @@ -37,34 +37,34 @@ task :start do send(run_method, "/etc/init.d/ssh reload") end - + desc "Stop ssh" task :stop do send(run_method, "/etc/init.d/ssh reload") end - + desc "Restart ssh" task :restart do send(run_method, "/etc/init.d/ssh restart") end - + desc "Reload ssh" task :reload do send(run_method, "/etc/init.d/ssh reload") end - + desc "Sets up authorized_keys file on remote server" task :setup_keys do - - default(:target_user) { + + default(:target_user) { Capistrano::CLI.ui.ask "Setup keys for which user?" do |q| q.default = user end } - + if target_user == user - - unless ssh_options[:keys] + + unless ssh_options[:keys] puts <<-ERROR You need to define the name of your SSH key(s) @@ -75,19 +75,19 @@ ERROR exit end - + deprec2.mkdir '.ssh', :mode => 0700 put(ssh_options[:keys].collect{|key| File.read(key+'.pub')}.join("\n"), '.ssh/authorized_keys', :mode => 0600 ) - - else - + + else + deprec2.mkdir "/home/#{target_user}/.ssh", :mode => 0700, :owner => "#{target_user}.users", :via => :sudo std.su_put File.read("config/ssh/authorized_keys/#{target_user}"), "/home/#{target_user}/.ssh/authorized_keys", '/tmp/', :mode => 0600 sudo "chown #{target_user}.users /home/#{target_user}/.ssh/authorized_keys" - + end end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/svn.rb b/lib/deprec/recipes/svn.rb index 9ec06ffd..71c7c8e3 100644 --- a/lib/deprec/recipes/svn.rb +++ b/lib/deprec/recipes/svn.rb @@ -4,14 +4,14 @@ # http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.serverconfig.choosing.apache -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :svn do - + set :scm_group, 'scm' - + # Extract svn attributes from :repository URL - # + # # Two examples of :repository entries are: # # set :repository, 'svn+ssh://scm.deprecated.org/var/svn/deprec/trunk' @@ -19,21 +19,21 @@ # # This has only been tested with svn+ssh but file: should work. # - set (:svn_scheme) { URI.parse(repository).scheme } + set (:svn_scheme) { URI.parse(repository).scheme } set (:svn_host) { URI.parse(repository).host } set (:repos_path) { URI.parse(repository).path } - set (:repos_root) { - URI.parse(repository).path.sub(/\/(trunk|tags|branches)$/, '') + set (:repos_root) { + URI.parse(repository).path.sub(/\/(trunk|tags|branches)$/, '') } - + # account name to perform actions on (such as granting access to an account) - # this is a hack to allow us to optionally pass a variable to tasks + # this is a hack to allow us to optionally pass a variable to tasks set (:svn_account) do Capistrano::CLI.ui.ask 'account name' end - + set(:svn_backup_dir) { File.join(backup_dir, 'svn') } - + desc "Install Subversion" task :install do install_deps @@ -42,28 +42,28 @@ # deprec2.download_src(src_package, src_dir) # deprec2.install_from_src(src_package, src_dir) end - + desc "install dependencies for Subversion" task :install_deps do apt.install( {:base => %w(subversion)}, :stable ) # XXX deprec1 - was building from source to get subversion-1.4.5 onto dapper. Compiled swig bindings for trac # apt.install( {:base => %w(build-essential wget libneon25 libneon25-dev swig python-dev libexpat1-dev)}, :stable ) end - + desc "grant a user access to svn repos" task :grant_user_access, :roles => :scm do # creates account, scm_group and adds account to group deprec2.useradd(svn_account) - deprec2.groupadd(scm_group) + deprec2.groupadd(scm_group) deprec2.add_user_to_group(svn_account, scm_group) end - + desc "Create subversion repository and import project into it" - task :setup, :roles => :scm do + task :setup, :roles => :scm do create_repos import end - + desc "Create a subversion repository" task :create_repos, :roles => :scm do set :svn_account, top.user @@ -72,10 +72,10 @@ sudo "svnadmin verify #{repos_root} > /dev/null 2>&1 || sudo svnadmin create #{repos_root}" sudo "chmod -R g+w #{repos_root}" end - + # Adapted from code in Bradley Taylors RailsMachine gem desc "Import project into subversion repository." - task :import, :roles => :scm do + task :import, :roles => :scm do new_path = "../#{application}" tags = repository.sub("trunk", "tags") branches = repository.sub("trunk", "branches") @@ -91,9 +91,9 @@ system "svn co #{repository} #{application}" Dir.chdir application remove_log_and_tmp - puts "Your repository is: #{repository}" + puts "Your repository is: #{repository}" end - + # Lifted from Bradley Taylors RailsMachine gem desc "remove and ignore log files and tmp from subversion" task :remove_log_and_tmp, :roles => :scm do @@ -116,19 +116,19 @@ puts "committing changes" system "svn commit -m 'Removed and ignored log files and tmp'" end - + # desc "Cache svn name and password on the server. Useful for http-based repositories." task :cache_credentials do run_with_input "svn list #{repository}" end - + desc "create backup of trac repository" task :backup, :roles => :scm do # http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.backup # XXX do we need this? insane! # echo "REPOS_BASE=/var/svn" > ~/.svntoolsrc DATE=`date +%Y%m%d-%a` - + timestamp = Time.now.strftime("%Y%m%d-%a") deprec2.mkdir(svn_backup_dir, :owner => :root, :group => :deploy, :mode => 0775, :via => :sudo) dest_dir = File.join(svn_backup_dir, "#{application}_#{timestamp}") @@ -140,15 +140,15 @@ # tracd_stop # copy out backup end - - + + # XXX TODO - # desc "backup repository" + # desc "backup repository" # task :svn_backup_respository, :roles => :scm do # puts "read http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.reposadmin.maint.backup" # end - end + end end end @@ -163,9 +163,9 @@ # # XXX put password file into svn and command to push it -# +# # # run svnserve # sudo -u svn svnserve --daemon --root /var/svn/deprec_svnserve_root -# +# # # check it out now # svn co svn://scm.deprecated.org/deprec/trunk deprec diff --git a/lib/deprec/recipes/trac.rb b/lib/deprec/recipes/trac.rb index fc500fcb..b58bf950 100644 --- a/lib/deprec/recipes/trac.rb +++ b/lib/deprec/recipes/trac.rb @@ -1,16 +1,16 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :trac do - + # Master tracd process for server set :tracd_cmd, '/usr/bin/tracd' set :tracd_port, '9000' set :tracd_pidfile, '/var/run/tracd.pid' - + # Settings for this projects trac instance set(:tracd_domain_root) { domain.sub(/.*?\./,'') } # strip subdomain from domain set(:tracd_vhost_domain) { "trac-#{application}.#{tracd_domain_root}" } # nginx will proxy this domain to tracd - + set(:trac_backup_dir) { "#{backup_dir}/trac" } set(:trac_path) { exists?(:deploy_to) ? "#{deploy_to}/trac" : Capistrano::CLI.ui.ask('path to trac config') } set(:tracd_parent_dir) { "/etc/trac.d" } @@ -23,8 +23,8 @@ # project set(:trac_domain) { domain.sub(/^.*?\./, 'trac.') } set(:trac_home_url) { "http://#{trac_domain}/" } - set(:trac_desc) { application } - + set(:trac_desc) { application } + # Settings only used for generating trac.ini for this project # - notification set :trac_always_notify_owner, false @@ -43,10 +43,10 @@ set :trac_smtp_user, '' set :trac_use_public_cc, false set :trac_use_short_addr, false - set :trac_use_tls, false + set :trac_use_tls, false # - other set(:trac_base_url) { trac_home_url } - + desc "Install trac on server" task :install, :roles => :scm do install_deps @@ -57,11 +57,11 @@ config_system activate_system end - + task :install_deps do apt.install( {:base => %w(sqlite3 python-setuptools python-subversion)}, :stable ) end - + # The start script has a couple of config values in it. # We may want to extract them into a config file later # and install this script as part of the :install task. @@ -71,42 +71,42 @@ :mode => 0755, :owner => 'root:root'} ] - + PROJECT_CONFIG_FILES[:trac] = [ {:template => 'users.htdigest.erb', :path => "conf/users.htdigest", :mode => 0644, :owner => 'root:root'}, - + {:template => 'trac.ini.erb', :path => "conf/trac.ini", :mode => 0644, :owner => 'root:root'}, - + {:template => 'nginx_vhost.conf.erb', :path => "conf/nginx_vhost.conf", :mode => 0644, :owner => 'root:root'} ] - + desc "Generate config files for trac" task :config_gen do config_gen_system config_gen_project end - + task :config_gen_system do SYSTEM_CONFIG_FILES[:trac].each do |file| deprec2.render_template(:trac, file) end end - + task :config_gen_project do PROJECT_CONFIG_FILES[:trac].each do |file| deprec2.render_template(:trac, file) end end - + desc "Push trac config files to server" task :config, :roles => :scm do config_system @@ -114,11 +114,11 @@ restart top.deprec.nginx.restart end - + task :config_system, :roles => :scm do deprec2.push_configs(:trac, SYSTEM_CONFIG_FILES[:trac]) end - + task :config_project, :roles => :scm do deprec2.push_configs(:trac, PROJECT_CONFIG_FILES[:trac]) symlink_nginx_vhost @@ -131,22 +131,22 @@ config_project activate_project # set_default_permissions # XXX re-enable this - # create trac account for current user + # create trac account for current user set :trac_account, user set :trac_passwordfile_exists, false # hack - should check on remote system instead # user_add # XXX re-enable end - + task :init, :roles => :scm do deprec2.mkdir(trac_path, :via => :sudo) sudo "trac-admin #{trac_path} initenv #{application} sqlite:db/trac.db svn #{repos_root}" end - + task :set_default_permissions, :roles => :scm do anonymous_disable authenticated_enable end - + task :start, :roles => :scm do sudo "/etc/init.d/tracd start" end @@ -154,7 +154,7 @@ task :stop, :roles => :scm do sudo "/etc/init.d/tracd stop" end - + task :restart, :roles => :scm do stop start @@ -164,30 +164,30 @@ activate_system activate_project end - + task :activate_system, :roles => :scm do sudo "update-rc.d tracd defaults" end - + task :activate_project, :roles => :scm do symlink_project end - + task :deactivate, :roles => :scm do deactivate_system deactivate_project end - + task :deactivate_system, :roles => :scm do sudo "update-rc.d -f tracd remove" end - + task :deactivate_project, :roles => :scm do unlink_project unlink_nginx_vhost restart end - + desc "Create backup of trac repository" task :backup, :roles => :web do # http://trac.edgewall.org/wiki/TracBackup @@ -195,14 +195,14 @@ dest_dir = File.join(trac_backup_dir, "trac_#{application}_#{timestamp}") sudo "trac-admin #{trac_path} hotcopy #{dest_dir}" end - + desc "Restore trac repository from backup" task :restore, :roles => :web do # prompt user to select from list of locally stored backups # tracd_stop # copy out backup end - + # # Service specific tasks for end users # @@ -213,65 +213,65 @@ # XXX check if htdigest file exists and add '-c' option if not # sudo "test -f #{trac_path/conf/users.htdigest} create_file = trac_passwordfile_exists ? '' : ' -c ' - deprec2.sudo_with_input("#{htdigest} #{create_file} #{trac_path}/conf/users.htdigest #{application} #{trac_account}", /password:/) + deprec2.sudo_with_input("#{htdigest} #{create_file} #{trac_path}/conf/users.htdigest #{application} #{trac_account}", /password:/) end - + desc "list trac users" task :list_users, :roles => :scm do sudo "cat #{trac_path}/conf/users.htdigest" end - + # desc "disable anonymous access to everything" task :anonymous_disable, :roles => :scm do sudo "trac-admin #{trac_path} permission remove anonymous '*'" end - + # desc "enable authenticated users access to everything" task :authenticated_enable, :roles => :scm do sudo "trac-admin #{trac_path} permission add authenticated TRAC_ADMIN" end - + # # Helper tasks used by other tasks # - + # Link the trac repos for this project into the master trac repos dir # We do this so we can use trac for multiple projects on the same server task :symlink_project, :roles => :scm do sudo "ln -sf #{trac_path} #{tracd_parent_dir}/#{application}" end - + task :unlink_project, :roles => :scm do link = "#{tracd_parent_dir}/#{application}" sudo "test -h #{link} && sudo unlink #{link} || true" end - + task :symlink_nginx_vhost, :roles => :scm do sudo "ln -sf #{deploy_to}/trac/conf/nginx_vhost.conf #{nginx_vhost_dir}/tracd-#{application}.conf" end - + task :unlink_nginx_vhost, :roles => :scm do link = "#{nginx_vhost_dir}/tracd-#{application}.conf" sudo "test -h #{link} && unlink #{link} || true" end - + # task :symlink_apache_vhost, :roles => :scm do # sudo "ln -sf #{deploy_to}/trac/conf/trac_apache_vhost.conf #{apache_vhost_dir}/#{application}-trac.conf" # end - # + # # task :unlink_apache_vhost, :roles => :scm do # link = "#{apache_vhost_dir}/#{application}-trac.conf" # sudo "test -h #{link} && unlink #{link} || true" # end - + task :create_pid_dir, :roles => :scm do deprec2.mkdir(File.dirname(tracd_pidfile)) end - + task :create_parent_dir, :roles => :scm do deprec2.mkdir(tracd_parent_dir, :via => :sudo) end - + end end - + end \ No newline at end of file diff --git a/lib/deprec/recipes/ubuntu.rb b/lib/deprec/recipes/ubuntu.rb index a0d5cd3a..f3612a7b 100644 --- a/lib/deprec/recipes/ubuntu.rb +++ b/lib/deprec/recipes/ubuntu.rb @@ -1,20 +1,20 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :ubuntu do - + task :update do apt.update end - + task :upgrade do apt.upgrade end - + task :restart do sudo "reboot" end - + end end end \ No newline at end of file diff --git a/lib/deprec/recipes/users.rb b/lib/deprec/recipes/users.rb index 0f4c3a1b..0c9bc100 100644 --- a/lib/deprec/recipes/users.rb +++ b/lib/deprec/recipes/users.rb @@ -1,8 +1,8 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :users do - + # desc "Create user account" # task :add do # target_user = Capistrano::CLI.ui.ask "Enter userid for new user" do |q| @@ -12,12 +12,12 @@ # puts "Setting password for new account" # deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/) # end - + desc "Create account" task :add do target_user = Capistrano::CLI.ui.ask "Enter userid for new user" do |q| q.default = user - end + end make_admin = Capistrano::CLI.ui.ask "Should this be an admin account?" do |q| q.default = 'no' end @@ -27,42 +27,42 @@ q.default = 'yes' end end - + new_password = Capistrano::CLI.ui.ask("Enter new password for #{target_user}") { |q| q.echo = false } - + deprec2.useradd(target_user, :shell => '/bin/bash') deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/, new_password) - + if make_admin.grep(/y/i) deprec2.groupadd('admin') deprec2.add_user_to_group(target_user, 'admin') deprec2.append_to_file_if_missing('/etc/sudoers', '%admin ALL=(ALL) ALL') end - + if copy_keys && copy_keys.grep(/y/i) set :target_user, target_user top.deprec.ssh.setup_keys end - + end - + desc "Create account" task :add_admin do puts 'deprecated! use deprec:users:add' add end - + desc "Change user password" task :passwd do target_user = Capistrano::CLI.ui.ask "Enter user to change password for" do |q| q.default = user if user.is_a?(String) end new_password = Capistrano::CLI.ui.ask("Enter new password for #{target_user}") { |q| q.echo = false } - - deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/, new_password) + + deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/, new_password) end - + desc "Add user to group" task :add_user_to_group do target_user = Capistrano::CLI.ui.ask "Which user?" do |q| @@ -76,10 +76,10 @@ # desc "Create group" # task :add_group do - # target_group = Capistrano::CLI.ui.ask "Enter name for new group" + # target_group = Capistrano::CLI.ui.ask "Enter name for new group" # deprec2.groupadd(target_group) # end - # + # # desc "Add user to group" # task :add_user_to_group do # # XXX not yet implemented diff --git a/lib/deprec/recipes/utils.rb b/lib/deprec/recipes/utils.rb index 63b1ecb3..1dbaf4ba 100644 --- a/lib/deprec/recipes/utils.rb +++ b/lib/deprec/recipes/utils.rb @@ -1,12 +1,12 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + namespace :deprec do namespace :utils do - + SRC_PACKAGES[:daemonize] = { - :filename => 'daemonize-1.5.2.tar.gz', - :md5sum => "c016f1a17f03ec976873d0a283a1a038 daemonize-1.5.2.tar.gz", - :dir => 'daemonize-1.5.2', + :filename => 'daemonize-1.5.2.tar.gz', + :md5sum => "c016f1a17f03ec976873d0a283a1a038 daemonize-1.5.2.tar.gz", + :dir => 'daemonize-1.5.2', :url => "http://www.clapper.org/software/daemonize/daemonize-1.5.2.tar.gz", :unpack => "tar zxf daemonize-1.5.2.tar.gz;", :configure => %w( @@ -16,23 +16,23 @@ :make => 'make;', :install => 'make install;' } - + namespace :daemonize do - + desc "Install daemonize" task :install do deprec2.download_src(SRC_PACKAGES[:daemonize], src_dir) deprec2.install_from_src(SRC_PACKAGES[:daemonize], src_dir) end - + end - + task :net do apps = %w(lynx nmap netcat mailx mutt telnet vim-full dnsutils) apt.install( {:base => apps}, :stable ) end - - end + + end end end diff --git a/lib/deprec/recipes/vnstat.rb b/lib/deprec/recipes/vnstat.rb index 14c8b243..1ead68ed 100644 --- a/lib/deprec/recipes/vnstat.rb +++ b/lib/deprec/recipes/vnstat.rb @@ -1,26 +1,26 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do - - namespace :deprec do +Capistrano::Configuration.instance(:must_exist).load do + + namespace :deprec do namespace :vnstat do - + desc <<-EOF vnstat description EOF task :default do end - + SRC_PACKAGES[:vnstat] = { :url => "http://humdi.net/vnstat/vnstat-1.6.tar.gz", - :md5sum => "ccaffe8e70d47e0cf2f25e52daa25712 vnstat-1.6.tar.gz", + :md5sum => "ccaffe8e70d47e0cf2f25e52daa25712 vnstat-1.6.tar.gz", :configure => '', :post_install => 'vnstat --testkernel && vnstat -u -i eth0' } - + desc <<-EOF - Install vnstat. Add interfaces with 'vnstat -u -i ethN' - (where N is interface number). - + Install vnstat. Add interfaces with 'vnstat -u -i ethN' + (where N is interface number). + View stats using the vnstat command line tool. EOF task :install do @@ -28,46 +28,46 @@ deprec2.download_src(SRC_PACKAGES[:vnstat], src_dir) deprec2.install_from_src(SRC_PACKAGES[:vnstat], src_dir) end - + # install dependencies for monit task :install_deps do # apt.install( {:base => %w(flex bison libssl-dev)}, :stable ) end - - end - - + + end + + namespace :vnstat_php do - + SRC_PACKAGES[:vnstat_php] = { :url => "http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.3.tar.gz", - :md5sum => "190b37808ae16bd1c1a132434b170437 vnstat_php_frontend-1.3.tar.gz", + :md5sum => "190b37808ae16bd1c1a132434b170437 vnstat_php_frontend-1.3.tar.gz", :configure => '', :make => '', - :install => "test -d /var/www/vnstat_php_frontend-1.3 && rm -fr /var/www/vnstat_php_frontend-1.3; mv #{src_dir}/vnstat_php_frontend-1.3 /var/www && + :install => "test -d /var/www/vnstat_php_frontend-1.3 && rm -fr /var/www/vnstat_php_frontend-1.3; mv #{src_dir}/vnstat_php_frontend-1.3 /var/www && ln -sf /var/www/vnstat_php_frontend-1.3 /var/www/vnstat" } - + task :install do install_deps deprec2.download_src(SRC_PACKAGES[:vnstat_php], src_dir) deprec2.install_from_src(SRC_PACKAGES[:vnstat_php], src_dir) end - + # install dependencies for monit task :install_deps do apt.install( {:base => %w(apache2 php5 php5-gd)}, :stable ) end - + SYSTEM_CONFIG_FILES[:vnstat] = [ {:template => 'config.php', :path => '/var/www/vnstat', :mode => 0755, :owner => 'root:root'} - + ] - + task :config_gen do SYSTEM_CONFIG_FILES[:vnstat].each do |file| deprec2.render_template(:vnstat, file) @@ -78,8 +78,8 @@ task :config do deprec2.push_configs(:vnstat, SYSTEM_CONFIG_FILES[:vnstat]) end - + end - + end end diff --git a/lib/deprec/recipes/xen.rb b/lib/deprec/recipes/xen.rb index 5bed6650..603fcef6 100644 --- a/lib/deprec/recipes/xen.rb +++ b/lib/deprec/recipes/xen.rb @@ -1,90 +1,90 @@ # Copyright 2006-2008 by Mike Bailey. All rights reserved. -Capistrano::Configuration.instance(:must_exist).load do +Capistrano::Configuration.instance(:must_exist).load do namespace :deprec do namespace :xen do - + # Config variables for migration default(:xen_slice) { Capistrano::CLI.ui.ask("Slice name") } default(:xen_old_host) { Capistrano::CLI.ui.ask("Old Xen host") } default(:xen_new_host) { Capistrano::CLI.ui.ask("New Xen host") } set(:xen_disk_size) { Capistrano::CLI.ui.ask("Disk size (GB)") } set(:xen_swap_size) { Capistrano::CLI.ui.ask("Swap size (GB)") } - + # ref: http://www.eadz.co.nz/blog/article/xen-gutsy.html - + SYSTEM_CONFIG_FILES[:xen] = [ - + {:template => "xend-config.sxp.erb", :path => '/etc/xen/xend-config.sxp', :mode => 0644, :owner => 'root:root'}, - + {:template => "xen-tools.conf.erb", :path => '/etc/xen-tools/xen-tools.conf', :mode => 0644, :owner => 'root:root'}, - + {:template => "xm.tmpl.erb", :path => '/etc/xen-tools/xm.tmpl', :mode => 0644, :owner => 'root:root'}, - + {:template => "xendomains.erb", :path => '/etc/default/xendomains', :mode => 0755, :owner => 'root:root'}, - - # This one is a bugfix for gutsy + + # This one is a bugfix for gutsy {:template => "15-disable-hwclock", :path => '/usr/lib/xen-tools/gutsy.d/15-disable-hwclock', :mode => 0755, :owner => 'root:root'}, - + # So is this - xendomains fails to shut down domains on system shutdown {:template => "xend-init.erb", :path => '/etc/init.d/xend', :mode => 0755, :owner => 'root:root'}, - - # This gives you a second network bridge on second ethernet device + + # This gives you a second network bridge on second ethernet device {:template => "network-bridge-wrapper", :path => '/etc/xen/scripts/network-bridge-wrapper', :mode => 0755, :owner => 'root:root'} - + ] - + desc "Install Xen" task :install, :roles => :dom0 do install_deps enable_hardy_domu end - + task :install_deps, :roles => :dom0 do # for amd64 version of ubuntu 7.10 apt.install( {:base => %w(linux-image-xen bridge-utils libxen3.1 python-xen-3.1 xen-docs-3.1 xen-hypervisor-3.1 xen-ioemu-3.1 xen-tools xen-utils-3.1 lvm2)}, :stable ) # alternatively, for x86 version of ubuntu: - # apt-get install ubuntu-xen-server libc6-xen + # apt-get install ubuntu-xen-server libc6-xen end - + desc "Generate configuration file(s) for Xen from template(s)" task :config_gen do SYSTEM_CONFIG_FILES[:xen].each do |file| deprec2.render_template(:xen, file) end end - + desc "Push Xen config files to server" task :config, :roles => :dom0 do deprec2.push_configs(:xen, SYSTEM_CONFIG_FILES[:xen]) end - + # Create new virtual machine # xen-create-image --force --ip=192.168.1.31 --hostname=x1 --mac=00:16:3E:11:12:31 - + # Start a virtual image (and open console to it) # xm create -c /etc/xen/x1.cfg - + desc "Start Xen" task :start, :roles => :dom0 do send(run_method, "/etc/init.d/xend start") @@ -104,11 +104,11 @@ task :reload, :roles => :dom0 do send(run_method, "/etc/init.d/xend reload") end - + task :list, :roles => :dom0 do sudo "xm list" end - + task :info, :roles => :dom0 do sudo "xm info" end @@ -179,7 +179,7 @@ sudo "umount #{mnt_dir}", :hosts => xen_new_host sudo "rmdir #{mnt_dir}", :hosts => xen_new_host end - + desc "Enable hardy heron domU's on gutsy dom0" task :enable_hardy_domu, :roles => :dom0 do # create debootstrap symlink @@ -187,11 +187,11 @@ # link xen-tools hooks sudo "ln -sf /usr/lib/xen-tools/edgy.d /usr/lib/xen-tools/hardy.d" end - + task :touch_hwclock do sudo "touch /etc/init.d/hwclock.sh" end - + end end end @@ -201,7 +201,7 @@ # # Ubuntu stores the MAC addresses of the NICs it sees. If you change an ethernet card (real or virtual) # it will assign is a new ethX address. That's why you'll sometimes find eth2 but no eth1. -# Your domU's should have a MAC address assigned in their config file but if you come across this problem, +# Your domU's should have a MAC address assigned in their config file but if you come across this problem, # fix it with this: # # sudo rm /etc/udev/rules.d/70-persistent-net.rules @@ -209,7 +209,7 @@ # ubuntu bugs -# +# # check if they're fixed in hardy heron # 1: domains are not shut down on system shutdown @@ -220,29 +220,29 @@ # /etc/init.d/xendomains stop # make sure domains are shut down # xend stop # ;; - + # # Install xen on ubuntu hardy # # ref: http://www.howtoforge.com/ubuntu-8.04-server-install-xen-from-ubuntu-repositories # -# Install Xen packages +# Install Xen packages # apt-get install ubuntu-xen-server # # Installs these: - # + # # binutils binutils-static bridge-utils debootstrap libasound2 libconfig-inifiles-perl libcurl3 libdirectfb-1.0-0 libsdl1.2debian # libsdl1.2debian-alsa libtext-template-perl libxen3 libxml2 linux-image-2.6.24-16-xen linux-image-xen # linux-restricted-modules-2.6.24-16-xen linux-restricted-modules-common linux-restricted-modules-xen # linux-ubuntu-modules-2.6.24-16-xen linux-xen nvidia-kernel-common python-dev python-xen-3.2 python2.5-dev ubuntu-xen-server # xen-docs-3.2 xen-hypervisor-3.2 xen-tools xen-utils-3.2 - + # before/after 'uname -a' # # Linux bb 2.6.24-16-server #1 SMP Thu Apr 10 13:15:38 UTC 2008 x86_64 GNU/Linux # Linux bb 2.6.24-16-xen #1 SMP Thu Apr 10 14:35:03 UTC 2008 x86_64 GNU/Linux -# +# # Stop apparmor # XXX investigate why # /etc/init.d/apparmor stop # update-rc.d -f apparmor remove @@ -252,11 +252,11 @@ # edit /etc/xen-tools/xen-tools.cfg # create image with xen-tools -# xen-create-image --hostname=x1 --size=2Gb --swap=256Mb --ide --ip=192.168.1.51 --memory=256Mb --install-method=debootstrap --dist=hardy +# xen-create-image --hostname=x1 --size=2Gb --swap=256Mb --ide --ip=192.168.1.51 --memory=256Mb --install-method=debootstrap --dist=hardy # update /etc/xen/.cfg # # disk = [ # 'tap:aio:/home/xen/domains/xen1.example.com/swap.img,hda1,w', # 'tap:aio:/home/xen/domains/xen1.example.com/disk.img,hda2,w', - # ] + # ] diff --git a/lib/deprec/templates/aoe/aoe-init b/lib/deprec/templates/aoe/aoe-init index 6c25cc91..baa13953 100644 --- a/lib/deprec/templates/aoe/aoe-init +++ b/lib/deprec/templates/aoe/aoe-init @@ -1,6 +1,6 @@ #! /bin/sh # aoe-init - example init script for ATA over Ethernet storage -# +# # Edit this script for your purposes. (Changing "eth1" to the # appropriate interface name, adding commands, etc.) You might # need to tune the sleep times. diff --git a/lib/deprec/templates/aoe/fence_aoemask b/lib/deprec/templates/aoe/fence_aoemask index d7f16328..54ec1852 100644 --- a/lib/deprec/templates/aoe/fence_aoemask +++ b/lib/deprec/templates/aoe/fence_aoemask @@ -13,43 +13,43 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # ======================================================================= # # ~~~~~ REVISION HISTORY ~~~~~ -# 2007-08-17 - v1 - Brian Weck +# 2007-08-17 - v1 - Brian Weck # Initial release. # # ~~~~~ OVERVIEW ~~~~~ -# Initial mask settings on the AoE device should contain the set of all +# Initial mask settings on the AoE device should contain the set of all # MAC addresses using the AoE device from the cluster. -# -# When a fence operation occurs on a node, the fenced node's mac address is -# removed from the mask list on the AoE device. This method is conceptually +# +# When a fence operation occurs on a node, the fenced node's mac address is +# removed from the mask list on the AoE device. This method is conceptually # the same as fencing via a fabric switch. -# -# Once a node is fenced, the MAC address is removed from the mask list on +# +# Once a node is fenced, the MAC address is removed from the mask list on # the AoE device. When the fenced node is ready to rejoin the cluster, -# the MAC address must be added to the device's mask list using this +# the MAC address must be added to the device's mask list using this # script or using aoemask. # # Script returns 0 on SUCCESS and non-zero otherwise. # # ~~~~~ INSTALLATION ~~~~~ -# Add this file as /sbin/fence_aoemask directory and ensure the file has -# simliar permissions as the other fence_* agents. +# Add this file as /sbin/fence_aoemask directory and ensure the file has +# simliar permissions as the other fence_* agents. # # ~~~~~ CONFIGURATION ~~~~~ -# This software operates on a single shelf / slot at a time. In order to -# fence multiple shelf and slots the user should create multiple fences. +# This software operates on a single shelf / slot at a time. In order to +# fence multiple shelf and slots the user should create multiple fences. # # e.g. a cluster.conf snippet. # @@ -73,10 +73,10 @@ # # # -# +# # Command line options: # see man aoemask.8 -# +# # stdin options (passed from fenced): # shelf= | # slot= | @@ -89,7 +89,7 @@ # [ spoof= ] | Spoof behavior is to assume success always. # [ timeout= ] | # [ verbose= ] | Option is used to increase logging of fence agent. -# +# # Define where you aoemask binary lives if it is not in the path. my $aoemask_prog="/usr/local/sbin/aoemask"; @@ -142,7 +142,7 @@ sub fail_usage # # If running command line, pass args as specified directly to aoemask -if (@ARGV > 0) +if (@ARGV > 0) { # Check for min number of args, 5 if( @ARGV < 5 ) @@ -152,7 +152,7 @@ if (@ARGV > 0) else { # stub in the args - foreach $i (0 .. $#ARGV) + foreach $i (0 .. $#ARGV) { $aoemask .= " $ARGV[$i]"; } @@ -202,10 +202,10 @@ open(FH, "$aoemask 2>&1 |"); close FH; # -if ($opt_verbose) -{ +if ($opt_verbose) +{ _log "-- begin read response --\n"; - foreach $line (@lines) { chop $line; _log "$line\n"; } + foreach $line (@lines) { chop $line; _log "$line\n"; } _log "-- end read response --\n"; } @@ -278,7 +278,7 @@ sub read_stdin_as_options() ($name,$val)=split /\s*=\s*/, $opt; if ( $name eq "" ) - { + { _log "parse error: illegal name in option $line\n"; exit_fail(); } @@ -288,28 +288,28 @@ sub read_stdin_as_options() # interface= # mac= # action=(disable|enable) - elsif ($name eq "shelf" ) + elsif ($name eq "shelf" ) { $opt_shelf = $val; - } - elsif ($name eq "slot" ) + } + elsif ($name eq "slot" ) { $opt_slot = $val; - } + } elsif ($name eq "interface" ) { $opt_interface = $val; } - elsif ($name eq "mac" ) + elsif ($name eq "mac" ) { $opt_mac = $val; - # pull out any ':' if configured as such. + # pull out any ':' if configured as such. # (even though aoemask can handle it) $opt_mac =~ s/://g; # uppercase the alphas $opt_mac =~ tr/a-z/A-Z/; - } - elsif ($name eq "action") + } + elsif ($name eq "action") { $opt_action = $val; } @@ -319,33 +319,33 @@ sub read_stdin_as_options() # list= # spoof= # timeout= - elsif ($name eq "debug" ) + elsif ($name eq "debug" ) { $opt_debug = 1; - } - elsif ($name eq "exclusive" ) + } + elsif ($name eq "exclusive" ) { $opt_exclusive = 1; - } - elsif ($name eq "list" ) + } + elsif ($name eq "list" ) { $opt_list = 1; $opt_user_says_list = 1; - } - elsif ($name eq "spoof" ) + } + elsif ($name eq "spoof" ) { $opt_spoof = $val; - } - elsif ($name eq "timeout" ) + } + elsif ($name eq "timeout" ) { $opt_timeout = $val; - } + } # verbose= - elsif ($name eq "verbose" ) + elsif ($name eq "verbose" ) { $opt_verbose = 1; - } + } } } diff --git a/lib/deprec/templates/apache/httpd-vhost-app.conf.erb b/lib/deprec/templates/apache/httpd-vhost-app.conf.erb index 0207521f..34fc7369 100644 --- a/lib/deprec/templates/apache/httpd-vhost-app.conf.erb +++ b/lib/deprec/templates/apache/httpd-vhost-app.conf.erb @@ -13,7 +13,7 @@ Allow from all - # Configure mongrel_cluster + # Configure mongrel_cluster > <% start_port = apache_proxy_port %> <% end_port = apache_proxy_port + apache_proxy_servers - 1 %> @@ -23,11 +23,11 @@ RewriteEngine On - + <% if apache_ssl_enabled && apache_ssl_forward_all %> RewriteRule ^(.*)$ https://<%= domain %>$1 <% end %> - + # Prevent access to .svn directories RewriteRule ^(.*/)?\.svn/ - [F,L] ErrorDocument 403 "Access Forbidden" @@ -39,7 +39,7 @@ RewriteRule ^.*$ /system/maintenance.html [L] # Rewrite index to check for static - RewriteRule ^/$ /index.html [QSA] + RewriteRule ^/$ /index.html [QSA] # Rewrite to check for Rails cached page RewriteRule ^([^.]+)$ $1.html [QSA] @@ -47,7 +47,7 @@ # Redirect all non-static requests to cluster RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L] - + # Deflate AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html @@ -75,7 +75,7 @@ DocumentRoot <%= "#{current_path}/public" %> Allow from all -# Configure mongrel_cluster +# Configure mongrel_cluster > <% start_port = apache_proxy_port %> <% end_port = apache_proxy_port + apache_proxy_servers - 1 %> @@ -97,7 +97,7 @@ RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^.*$ /system/maintenance.html [L] # Rewrite index to check for static -RewriteRule ^/$ /index.html [QSA] +RewriteRule ^/$ /index.html [QSA] # Rewrite to check for Rails cached page RewriteRule ^([^.]+)$ $1.html [QSA] @@ -137,7 +137,7 @@ BrowserMatch ".*MSIE.*" \ downgrade-1.0 force-response-1.0 ErrorLog logs/<%= domain %>-error_log -CustomLog logs/<%= domain %>-access_log combined +CustomLog logs/<%= domain %>-access_log combined CustomLog logs/<%= domain %>-ssl_log \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" diff --git a/lib/deprec/templates/apache/httpd.conf b/lib/deprec/templates/apache/httpd.conf index b2ceba62..1033c7c7 100755 --- a/lib/deprec/templates/apache/httpd.conf +++ b/lib/deprec/templates/apache/httpd.conf @@ -2,13 +2,13 @@ # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See for detailed information. -# In particular, see +# In particular, see # # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure -# consult the online docs. You have been warned. +# consult the online docs. You have been warned. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the @@ -33,7 +33,7 @@ ServerRoot "/usr/local/apache2" # ports, instead of the default. See also the # directive. # -# Change this to Listen on specific IP addresses as shown below to +# Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 @@ -112,7 +112,7 @@ LoadModule rewrite_module modules/mod_rewrite.so # # If you wish httpd to run as a different user or group, you must run -# httpd as root initially and it will switch. +# httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for @@ -160,10 +160,10 @@ DocumentRoot "/usr/local/apache2/htdocs" # # Each directory to which Apache has access can be configured with respect # to which services and features are allowed and/or disabled in that -# directory (and its subdirectories). +# directory (and its subdirectories). # -# First, we configure the "default" to be a very restrictive set of -# features. +# First, we configure the "default" to be a very restrictive set of +# features. # Options FollowSymLinks @@ -221,8 +221,8 @@ DocumentRoot "/usr/local/apache2/htdocs" # -# The following lines prevent .htaccess and .htpasswd files from being -# viewed by Web clients. +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. # Order allow,deny @@ -277,8 +277,8 @@ LogLevel warn # - # Redirect: Allows you to tell clients about documents that used to - # exist in your server's namespace, but do not anymore. The client + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client # will make a new request for the document at its new location. # Example: # Redirect permanent /foo http://www.example.com/bar @@ -295,7 +295,7 @@ LogLevel warn # the filesystem path. # - # ScriptAlias: This controls which directories contain server scripts. + # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the target directory are treated as applications and # run by the server when requested rather than as documents sent to the @@ -403,10 +403,10 @@ DefaultType text/plain # # -# EnableMMAP and EnableSendfile: On systems that support it, +# EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall is used to deliver # files. This usually improves server performance, but must -# be turned off when serving from networked-mounted +# be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise # broken on your system. # @@ -415,9 +415,9 @@ DefaultType text/plain # Supplemental configuration # -# The configuration files in the conf/extra/ directory can be -# included to add extra features or to modify the default configuration of -# the server, or you may simply copy their contents here and change as +# The configuration files in the conf/extra/ directory can be +# included to add extra features or to modify the default configuration of +# the server, or you may simply copy their contents here and change as # necessary. # Server-pool management (MPM specific) diff --git a/lib/deprec/templates/apache/index.html.erb b/lib/deprec/templates/apache/index.html.erb index 9a0d1254..846dc831 100644 --- a/lib/deprec/templates/apache/index.html.erb +++ b/lib/deprec/templates/apache/index.html.erb @@ -16,15 +16,15 @@
cap deprec:apache:stop
Stop apache
cap deprec:apache:restart
Stop restart
cap deprec:apache:reload
Reload apache
- +
cap deprec:apache:install
Install apache
cap deprec:apache:config_gen
Generate apache configs
- +
cap deprec:apache:activate
Start Apache when server boots
cap deprec:apache:deactivate
Don't start Apache when server boots
- + - +

Installation options

<% SRC_PACKAGES[:apache].each do |key, val| %> diff --git a/lib/deprec/templates/apt_mirror/mirror.list b/lib/deprec/templates/apt_mirror/mirror.list index 283022d4..fe9dedb6 100644 --- a/lib/deprec/templates/apt_mirror/mirror.list +++ b/lib/deprec/templates/apt_mirror/mirror.list @@ -14,7 +14,7 @@ set _tilde 0 # ############# end config ############## -<% Array(apt_releases_to_mirror).each do |release| %> +<% Array(apt_releases_to_mirror).each do |release| %> # <%= release %> deb http://archive.ubuntu.com/ubuntu <%= release %> main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu <%= release %>-updates main restricted universe multiverse diff --git a/lib/deprec/templates/deprec/caprc.erb b/lib/deprec/templates/deprec/caprc.erb index e8f76fec..9226e5ce 100644 --- a/lib/deprec/templates/deprec/caprc.erb +++ b/lib/deprec/templates/deprec/caprc.erb @@ -5,7 +5,7 @@ ssh_options[:forward_agent] = true # Just import the general purpose tasks require '/deprec/general_purpose' if respond_to?(:namespace) -# Enable all deprec tasks all the time. This will change the +# Enable all deprec tasks all the time. This will change the # behviour of some standard cap tasks (like 'cap deploy') so # only enable it if you know what you're doing! # diff --git a/lib/deprec/templates/mongrel/logrotate.conf.erb b/lib/deprec/templates/mongrel/logrotate.conf.erb index 5292fbe1..70625a47 100644 --- a/lib/deprec/templates/mongrel/logrotate.conf.erb +++ b/lib/deprec/templates/mongrel/logrotate.conf.erb @@ -7,5 +7,5 @@ sharedscripts copytruncate } - + diff --git a/lib/deprec/templates/mongrel/mongrel_cluster-init-script b/lib/deprec/templates/mongrel/mongrel_cluster-init-script index dcc77ecc..f2890d9d 100644 --- a/lib/deprec/templates/mongrel/mongrel_cluster-init-script +++ b/lib/deprec/templates/mongrel/mongrel_cluster-init-script @@ -7,7 +7,7 @@ # chkconfig: - 85 15 # description: mongrel_cluster manages multiple Mongrel processes for use \ # behind a load balancer. -# +# PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local:/usr/local/sbin:/usr/local/bin CONF_DIR=/etc/mongrel_cluster @@ -49,6 +49,6 @@ case "$1" in echo "Usage: mongrel_cluster {start|stop|restart|status}" exit 1 ;; -esac +esac exit $RETVAL diff --git a/lib/deprec/templates/mongrel/mongrel_cluster.logrotate.d b/lib/deprec/templates/mongrel/mongrel_cluster.logrotate.d index 79587a00..bb26aab3 100644 --- a/lib/deprec/templates/mongrel/mongrel_cluster.logrotate.d +++ b/lib/deprec/templates/mongrel/mongrel_cluster.logrotate.d @@ -9,6 +9,6 @@ postrotate for i in `ls /data/<%= @username %>/shared/log/*.pid`; do kill -USR2 `cat $i` - done + done endscript } \ No newline at end of file diff --git a/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb b/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb index 8637e02b..d9bcf828 100644 --- a/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +++ b/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb @@ -1,4 +1,4 @@ ---- +--- user: <%= mongrel_user %> group: <%= mongrel_group %> cwd: <%= current_path %> diff --git a/lib/deprec/templates/mongrel/monit.conf.erb b/lib/deprec/templates/mongrel/monit.conf.erb index d2d0674f..e83d6b97 100644 --- a/lib/deprec/templates/mongrel/monit.conf.erb +++ b/lib/deprec/templates/mongrel/monit.conf.erb @@ -3,7 +3,7 @@ group mongrel_<%= application %> start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails cluster::start --clean -C <%= mongrel_conf %> --only <%=mongrel_port+counter%>" stop program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails cluster::stop -C <%= mongrel_conf %> --only <%=mongrel_port+counter%>" - + if failed host 127.0.0.1 port <%=mongrel_port+counter%> protocol http with timeout 10 seconds then alert diff --git a/lib/deprec/templates/monit/monit-init-script b/lib/deprec/templates/monit/monit-init-script index acec23c6..dfe7f452 100644 --- a/lib/deprec/templates/monit/monit-init-script +++ b/lib/deprec/templates/monit/monit-init-script @@ -35,9 +35,9 @@ monit_check_config () { } monit_check_perms () { - # Check the permission on configfile. + # Check the permission on configfile. # The permission must not have more than -rwx------ (0700) permissions. - + # Skip checking, fix perms instead. /bin/chmod go-rwx $CONFIG diff --git a/lib/deprec/templates/monit/monitrc.erb b/lib/deprec/templates/monit/monitrc.erb index 8e19f924..571a6b5e 100644 --- a/lib/deprec/templates/monit/monitrc.erb +++ b/lib/deprec/templates/monit/monitrc.erb @@ -5,8 +5,8 @@ ## Comments begin with a '#' and extend through the end of the line. Keywords ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'. ## -## Below you will find examples of some frequently used statements. For -## information about the control file, a complete list of statements and +## Below you will find examples of some frequently used statements. For +## information about the control file, a complete list of statements and ## options please have a look in the monit manual. ## ## @@ -14,20 +14,20 @@ ## Global section ############################################################################### ## -## Start monit in the background (run as a daemon) and check services at +## Start monit in the background (run as a daemon) and check services at ## 2-minute intervals. # set daemon <%= monit_check_interval %> # # ## Set syslog logging with the 'daemon' facility. If the FACILITY option is -## omitted, monit will use 'user' facility by default. If you want to log to +## omitted, monit will use 'user' facility by default. If you want to log to ## a stand alone log file instead, specify the path to a log file # -set logfile <%= monit_log %> +set logfile <%= monit_log %> # # -## Set the list of mail servers for alert delivery. Multiple servers may be +## Set the list of mail servers for alert delivery. Multiple servers may be ## specified using comma separator. By default monit uses port 25 - this ## is possible to override with the PORT option. # @@ -37,11 +37,11 @@ set logfile <%= monit_log %> # localhost # fallback relay # # -## By default monit will drop alert events if no mail servers are available. -## If you want to keep the alerts for a later delivery retry, you can use the -## EVENTQUEUE statement. The base directory where undelivered alerts will be +## By default monit will drop alert events if no mail servers are available. +## If you want to keep the alerts for a later delivery retry, you can use the +## EVENTQUEUE statement. The base directory where undelivered alerts will be ## stored is specified by the BASEDIR option. You can limit the maximal queue -## size using the SLOTS option (if omitted, the queue is limited by space +## size using the SLOTS option (if omitted, the queue is limited by space ## available in the back end filesystem). # # set eventqueue @@ -73,9 +73,9 @@ set logfile <%= monit_log %> <%= '# ' unless monit_mailserver %>set mail-format { from: <%= monit_mail_from %> } # # -## You can set alert recipients here whom will receive alerts if/when a -## service defined in this file has errors. Alerts may be restricted on -## events by using a filter as in the second example below. +## You can set alert recipients here whom will receive alerts if/when a +## service defined in this file has errors. Alerts may be restricted on +## events by using a filter as in the second example below. # <% monit_alert_recipients.each do |recipient| %> <%= '# ' unless monit_mailserver %>set alert <%= recipient %> # receive all alerts @@ -87,7 +87,7 @@ set logfile <%= monit_log %> # # -## Monit has an embedded web server which can be used to view status of +## Monit has an embedded web server which can be used to view status of ## services monitored, the current configuration, actual services parameters ## and manage services from a web interface. # @@ -117,14 +117,14 @@ set httpd port <%= monit_webserver_port %> and # if cpu usage (system) > 30% then alert # if cpu usage (wait) > 20% then alert # -# +# ## Check a file for existence, checksum, permissions, uid and gid. In addition -## to alert recipients in the global section, customized alert will be sent to -## additional recipients by specifying a local alert handler. The service may +## to alert recipients in the global section, customized alert will be sent to +## additional recipients by specifying a local alert handler. The service may ## be grouped using the GROUP option. -# +# # check file apache_bin with path /usr/local/apache/bin/httpd -# if failed checksum and +# if failed checksum and # expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor # if failed permission 755 then unmonitor # if failed uid root then unmonitor @@ -134,15 +134,15 @@ set httpd port <%= monit_webserver_port %> and # } with the mail-format { subject: Alarm! } # group server # -# +# ## Check that a process is running, in this case Apache, and that it respond ## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory, -## and number of children. If the process is not running, monit will restart -## it by default. In case the service was restarted very often and the +## and number of children. If the process is not running, monit will restart +## it by default. In case the service was restarted very often and the ## problem remains, it is possible to disable monitoring using the TIMEOUT ## statement. This service depends on another service (apache_bin) which ## is defined above. -# +# # check process apache with pidfile /usr/local/apache/logs/httpd.pid # start program = "/etc/init.d/httpd start" # stop program = "/etc/init.d/httpd stop" @@ -160,8 +160,8 @@ set httpd port <%= monit_webserver_port %> and # if 3 restarts within 5 cycles then timeout # depends on apache_bin # group server -# -# +# +# ## Check device permissions, uid, gid, space and inode usage. Other services, ## such as databases, may depend on this resource and an automatically graceful ## stop may be cascaded to them before the filesystem will become full and data @@ -180,7 +180,7 @@ set httpd port <%= monit_webserver_port %> and # group server # # -## Check a file's timestamp. In this example, we test if a file is older +## Check a file's timestamp. In this example, we test if a file is older ## than 15 minutes and assume something is wrong if its not updated. Also, ## if the file size exceed a given limit, execute a script # @@ -192,8 +192,8 @@ set httpd port <%= monit_webserver_port %> and # if size > 100 MB then exec "/my/cleanup/script" # # -## Check directory permission, uid and gid. An event is triggered if the -## directory does not belong to the user with uid 0 and gid 0. In addition, +## Check directory permission, uid and gid. An event is triggered if the +## directory does not belong to the user with uid 0 and gid 0. In addition, ## the permissions have to match the octal description of 755 (see chmod(1)). # # check directory bin with path /bin @@ -202,8 +202,8 @@ set httpd port <%= monit_webserver_port %> and # if failed gid 0 then unmonitor # # -## Check a remote host network services availability using a ping test and -## check response content from a web server. Up to three pings are sent and +## Check a remote host network services availability using a ping test and +## check response content from a web server. Up to three pings are sent and ## connection to a port and a application level network check is performed. # # check host myserver with address 192.168.1.1 diff --git a/lib/deprec/templates/mysql/create_databases.sql b/lib/deprec/templates/mysql/create_databases.sql index c4566e91..ef9fbfb4 100644 --- a/lib/deprec/templates/mysql/create_databases.sql +++ b/lib/deprec/templates/mysql/create_databases.sql @@ -1,7 +1,7 @@ create database <%= @username %>_prod; GRANT USAGE ON *.* TO '<%= @username %>_db'@'%'; -GRANT ALL PRIVILEGES +GRANT ALL PRIVILEGES ON <%= @username %>_prod.* TO <%= @username %>_db@'%' IDENTIFIED BY '<%= @mysqlpass %>'; @@ -12,7 +12,7 @@ FLUSH PRIVILEGES; create database <%= @username %>_stage; GRANT USAGE ON *.* TO '<%= @username %>_db'@'%'; -GRANT ALL PRIVILEGES +GRANT ALL PRIVILEGES ON <%= @username %>_stage.* TO <%= @username %>_db@'%' IDENTIFIED BY '<%= @mysqlpass %>'; diff --git a/lib/deprec/templates/mysql/my.cnf.erb b/lib/deprec/templates/mysql/my.cnf.erb index 72b71c09..937e47fa 100644 --- a/lib/deprec/templates/mysql/my.cnf.erb +++ b/lib/deprec/templates/mysql/my.cnf.erb @@ -4,7 +4,7 @@ # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set user-specific options. -# +# # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. diff --git a/lib/deprec/templates/mysql/sphinx.conf.prod b/lib/deprec/templates/mysql/sphinx.conf.prod index 99ce45dc..ca5cc293 100644 --- a/lib/deprec/templates/mysql/sphinx.conf.prod +++ b/lib/deprec/templates/mysql/sphinx.conf.prod @@ -30,7 +30,7 @@ source src1 index_html_attrs = ##################################################################### - + # some straightforward parameters for 'mysql' source type sql_host = <%= @mysql_host %> sql_user = <%= @username %>_db @@ -127,7 +127,7 @@ source src1 # # sql_date_column is used to declare UNIX timestamp attributes. # - # sql_str2ordinal_column is used to declare integer attributes which + # sql_str2ordinal_column is used to declare integer attributes which # values are computed as ordinal numbers of corresponding column value # in sorted list of column values. WARNING, all such strings values # are going to be stored in RAM while indexing, and "C" locale will @@ -170,7 +170,7 @@ source src1 # # ONLY used by search utility to display document information # MUST be able to fetch document info by its id, therefore - # MUST contain '$id' macro + # MUST contain '$id' macro # # optional, default is empty sql_query_info = SELECT * FROM documents WHERE id=$id diff --git a/lib/deprec/templates/mysql/sphinx.conf.stage b/lib/deprec/templates/mysql/sphinx.conf.stage index aaac7a24..11920d58 100644 --- a/lib/deprec/templates/mysql/sphinx.conf.stage +++ b/lib/deprec/templates/mysql/sphinx.conf.stage @@ -30,7 +30,7 @@ source src1 index_html_attrs = ##################################################################### - + # some straightforward parameters for 'mysql' source type sql_host = <%= @mysql_host %> sql_user = <%= @username %>_db @@ -127,7 +127,7 @@ source src1 # # sql_date_column is used to declare UNIX timestamp attributes. # - # sql_str2ordinal_column is used to declare integer attributes which + # sql_str2ordinal_column is used to declare integer attributes which # values are computed as ordinal numbers of corresponding column value # in sorted list of column values. WARNING, all such strings values # are going to be stored in RAM while indexing, and "C" locale will @@ -170,7 +170,7 @@ source src1 # # ONLY used by search utility to display document information # MUST be able to fetch document info by its id, therefore - # MUST contain '$id' macro + # MUST contain '$id' macro # # optional, default is empty sql_query_info = SELECT * FROM documents WHERE id=$id diff --git a/lib/deprec/templates/nagios/cgi.cfg.erb b/lib/deprec/templates/nagios/cgi.cfg.erb index d16d4a7d..c937c0f3 100644 --- a/lib/deprec/templates/nagios/cgi.cfg.erb +++ b/lib/deprec/templates/nagios/cgi.cfg.erb @@ -59,9 +59,9 @@ use_pending_states=1 # AUTHENTICATION USAGE -# This option controls whether or not the CGIs will use any +# This option controls whether or not the CGIs will use any # authentication when displaying host and service information, as -# well as committing commands to Nagios for processing. +# well as committing commands to Nagios for processing. # # Read the HTML documentation to learn how the authorization works! # @@ -92,7 +92,7 @@ use_authentication=1 # access to the CGIs has been authenticated in some manner! If you # define this variable, anyone who has not authenticated to the web # server will inherit all rights you assign to this user! - + #default_user_name=guest @@ -151,9 +151,9 @@ authorized_for_all_hosts=nagiosadmin # GLOBAL HOST/SERVICE COMMAND ACCESS # These two options are comma-delimited lists of all usernames that # can issue host or service related commands via the command -# CGI (cmd.cgi) for all hosts and services that are being monitored. -# By default, users can only issue commands for hosts or services -# that they are contacts for (unless you you choose to not use +# CGI (cmd.cgi) for all hosts and services that are being monitored. +# By default, users can only issue commands for hosts or services +# that they are contacts for (unless you you choose to not use # authorization). You may use an asterisk (*) to authorize any # user who has authenticated to the web server. @@ -164,7 +164,7 @@ authorized_for_all_host_commands=nagiosadmin # STATUSMAP BACKGROUND IMAGE -# This option allows you to specify an image to be used as a +# This option allows you to specify an image to be used as a # background in the statusmap CGI. It is assumed that the image # resides in the HTML images path (i.e. /usr/local/nagios/share/images). # This path is automatically determined by appending "/images" @@ -209,7 +209,7 @@ default_statuswrl_layout=4 # STATUSWRL INCLUDE -# This option allows you to include your own objects in the +# This option allows you to include your own objects in the # generated VRML world. It is assumed that the file # resides in the HTML path (i.e. /usr/local/nagios/share). @@ -235,7 +235,7 @@ ping_syntax=/bin/ping -n -U -c 5 $HOSTADDRESS$ # REFRESH RATE # This option allows you to specify the refresh rate in seconds -# of various CGIs (status, statusmap, extinfo, and outages). +# of various CGIs (status, statusmap, extinfo, and outages). refresh_rate=90 @@ -278,7 +278,7 @@ escape_html_tags=1 # URL TARGET FRAMES -# These options determine the target frames in which notes and +# These options determine the target frames in which notes and # action URLs will open. action_url_target=_blank @@ -288,8 +288,8 @@ notes_url_target=_blank # LOCK AUTHOR NAMES OPTION -# This option determines whether users can change the author name -# when submitting comments, scheduling downtime. If disabled, the +# This option determines whether users can change the author name +# when submitting comments, scheduling downtime. If disabled, the # author names will be locked into their contact name, as defined in Nagios. # Values: 0 = allow editing author names # 1 = lock author names (disallow editing) diff --git a/lib/deprec/templates/nagios/commands.cfg.erb b/lib/deprec/templates/nagios/commands.cfg.erb index 0c2483e2..3f2b3037 100644 --- a/lib/deprec/templates/nagios/commands.cfg.erb +++ b/lib/deprec/templates/nagios/commands.cfg.erb @@ -5,7 +5,7 @@ # # NOTES: This config file provides you with some example command definitions # that you can reference in host, service, and contact definitions. -# +# # You don't need to keep commands in a separate file from your other # object definitions. This has been done just to make things easier to # understand. @@ -18,7 +18,7 @@ # SAMPLE NOTIFICATION COMMANDS # # These are some example notification commands. They may or may not work on -# your system without modification. As an example, some systems will require +# your system without modification. As an example, some systems will require # you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below. # ################################################################################ @@ -48,7 +48,7 @@ define command{ # This command checks to see if a host is "alive" by pinging it -# The check must result in a 100% packet loss or 5 second (5000ms) round trip +# The check must result in a 100% packet loss or 5 second (5000ms) round trip # average time to produce a critical error. # Note: Five ICMP echo packets are sent (determined by the '-p 5' argument) @@ -66,7 +66,7 @@ define command{ # SAMPLE SERVICE CHECK COMMANDS # # These are some example service check commands. They may or may not work on -# your system, as they must be modified for your plugins. See the HTML +# your system, as they must be modified for your plugins. See the HTML # documentation on the plugins for examples of how to configure command definitions. # # NOTE: The following 'check_local_...' functions are designed to monitor @@ -218,7 +218,7 @@ define command{ # # These are sample performance data commands that can be used to send performance # data output to two text files (one for hosts, another for services). If you -# plan on simply writing performance data out to a file, consider using the +# plan on simply writing performance data out to a file, consider using the # host_perfdata_file and service_perfdata_file options in the main config file. # ################################################################################ diff --git a/lib/deprec/templates/nagios/contacts.cfg.erb b/lib/deprec/templates/nagios/contacts.cfg.erb index 358606af..68d0b5ed 100644 --- a/lib/deprec/templates/nagios/contacts.cfg.erb +++ b/lib/deprec/templates/nagios/contacts.cfg.erb @@ -40,14 +40,14 @@ define contact{ ############################################################################### define contact{ - name generic-contact - service_notification_period 24x7 - host_notification_period 24x7 - service_notification_options w,u,c,r,f,s - host_notification_options d,u,r,f,s - service_notification_commands notify-service-by-email - host_notification_commands notify-host-by-email - register 0 + name generic-contact + service_notification_period 24x7 + host_notification_period 24x7 + service_notification_options w,u,c,r,f,s + host_notification_options d,u,r,f,s + service_notification_commands notify-service-by-email + host_notification_commands notify-host-by-email + register 0 } diff --git a/lib/deprec/templates/nagios/hosts.cfg.erb b/lib/deprec/templates/nagios/hosts.cfg.erb index 33e599d6..bfa878c0 100644 --- a/lib/deprec/templates/nagios/hosts.cfg.erb +++ b/lib/deprec/templates/nagios/hosts.cfg.erb @@ -6,19 +6,19 @@ ############################################################################### ############################################################################### -define hostgroup{ +define hostgroup{ hostgroup_name servers } -define hostgroup{ +define hostgroup{ hostgroup_name app } -define hostgroup{ +define hostgroup{ hostgroup_name web } -define hostgroup{ +define hostgroup{ hostgroup_name routers } diff --git a/lib/deprec/templates/nagios/localhost.cfg.erb b/lib/deprec/templates/nagios/localhost.cfg.erb index 6882cedc..18fcf686 100644 --- a/lib/deprec/templates/nagios/localhost.cfg.erb +++ b/lib/deprec/templates/nagios/localhost.cfg.erb @@ -3,7 +3,7 @@ # # Last Modified: 05-31-2007 # -# NOTE: This config file is intended to serve as an *extremely* simple +# NOTE: This config file is intended to serve as an *extremely* simple # example of how you can create configuration entries to monitor # the local (Linux) machine. # @@ -108,7 +108,7 @@ define service{ -# Define a service to check the load on the local machine. +# Define a service to check the load on the local machine. define service{ use local-service ; Name of service template to use @@ -119,7 +119,7 @@ define service{ -# Define a service to check the swap usage the local machine. +# Define a service to check the swap usage the local machine. # Critical if less than 10% of swap is free, warning if less than 20% is free define service{ diff --git a/lib/deprec/templates/nagios/nagios.cfg.erb b/lib/deprec/templates/nagios/nagios.cfg.erb index 7020bcec..60b6612e 100644 --- a/lib/deprec/templates/nagios/nagios.cfg.erb +++ b/lib/deprec/templates/nagios/nagios.cfg.erb @@ -13,7 +13,7 @@ # LOG FILE # This is the main log file where service and host events are logged -# for historical purposes. This should be the first option specified +# for historical purposes. This should be the first option specified # in the config file!!! log_file=/usr/local/nagios/var/nagios.log @@ -62,7 +62,7 @@ cfg_dir=/usr/local/nagios/etc/objects # OBJECT CACHE FILE # This option determines where object definitions are cached when -# Nagios starts/restarts. The CGIs read object definitions from +# Nagios starts/restarts. The CGIs read object definitions from # this cache file (rather than looking at the object config files # directly) in order to prevent inconsistencies that can occur # when the config files are modified after Nagios starts. @@ -78,7 +78,7 @@ object_cache_file=/usr/local/nagios/var/objects.cache # file. You can then start Nagios with the -u option to have it read # object definitions from this precached file, rather than the standard # object configuration files (see the cfg_file and cfg_dir options above). -# Using a precached object file can speed up the time needed to (re)start +# Using a precached object file can speed up the time needed to (re)start # the Nagios process if you've got a large and/or complex configuration. # Read the documentation section on optimizing Nagios to find our more # about how this feature works. @@ -113,7 +113,7 @@ status_file=/usr/local/nagios/var/status.dat # STATUS FILE UPDATE INTERVAL # Combined with the aggregate_status_updates option, # this option determines the frequency (in seconds) that -# Nagios will periodically dump program, host, and +# Nagios will periodically dump program, host, and # service status data. status_update_interval=10 @@ -121,7 +121,7 @@ status_update_interval=10 # NAGIOS USER -# This determines the effective user that Nagios should run as. +# This determines the effective user that Nagios should run as. # You can either supply a username or a UID. nagios_user=nagios @@ -129,7 +129,7 @@ nagios_user=nagios # NAGIOS GROUP -# This determines the effective group that Nagios should run as. +# This determines the effective group that Nagios should run as. # You can either supply a group name or a GID. nagios_group=nagios @@ -155,7 +155,7 @@ check_external_commands=1 # Nagios to check for external commands every minute. If you specify a # number followed by an "s" (i.e. 15s), this will be interpreted to mean # actual seconds rather than a multiple of the interval_length variable. -# Note: In addition to reading the external command file at regularly +# Note: In addition to reading the external command file at regularly # scheduled intervals, Nagios will also check for external commands after # event handlers are executed. # NOTE: Setting this value to -1 causes Nagios to check the external @@ -170,7 +170,7 @@ command_check_interval=-1 # This is the file that Nagios checks for external command requests. # It is also where the command CGI will write commands that are submitted # by users, so it must be writeable by the user that the web server -# is running as (usually 'nobody'). Permissions should be set at the +# is running as (usually 'nobody'). Permissions should be set at the # directory level instead of on the file, as the file is deleted every # time its contents are processed. @@ -180,9 +180,9 @@ command_file=/usr/local/nagios/var/rw/nagios.cmd # EXTERNAL COMMAND BUFFER SLOTS # This settings is used to tweak the number of items or "slots" that -# the Nagios daemon should allocate to the buffer that holds incoming -# external commands before they are processed. As external commands -# are processed by the daemon, they are removed from the buffer. +# the Nagios daemon should allocate to the buffer that holds incoming +# external commands before they are processed. As external commands +# are processed by the daemon, they are removed from the buffer. external_command_buffer_slots=4096 @@ -265,7 +265,7 @@ log_rotation_method=d # LOG ARCHIVE PATH -# This is the directory where archived (rotated) log files should be +# This is the directory where archived (rotated) log files should be # placed (assuming you've chosen to do log rotation). log_archive_path=/usr/local/nagios/var/archives @@ -428,7 +428,7 @@ max_host_check_spread=30 # MAXIMUM CONCURRENT SERVICE CHECKS -# This option allows you to specify the maximum number of +# This option allows you to specify the maximum number of # service checks that can be run in parallel at any given time. # Specifying a value of 1 for this variable essentially prevents # any service checks from being parallelized. A value of 0 @@ -450,7 +450,7 @@ check_result_reaper_frequency=10 # MAX CHECK RESULT REAPER TIME # This is the max amount of time (in seconds) that a single -# check result reaper event will be allowed to run before +# check result reaper event will be allowed to run before # returning control back to Nagios so it can perform other # duties. @@ -464,7 +464,7 @@ max_check_result_reaper_time=30 # service checks that have not yet been processed. # # Note: Make sure that only one instance of Nagios has access -# to this directory! +# to this directory! check_result_path=/usr/local/nagios/var/spool/checkresults @@ -473,7 +473,7 @@ check_result_path=/usr/local/nagios/var/spool/checkresults # MAX CHECK RESULT FILE AGE # This option determines the maximum age (in seconds) which check -# result files are considered to be valid. Files older than this +# result files are considered to be valid. Files older than this # threshold will be mercilessly deleted without further processing. max_check_result_file_age=3600 @@ -538,7 +538,7 @@ enable_predictive_service_dependency_checks=1 # This option determines whether or not Nagios will attempt to # automatically reschedule active host and service checks to # "smooth" them out over time. This can help balance the load on -# the monitoring server. +# the monitoring server. # WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE # PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY @@ -601,7 +601,7 @@ perfdata_timeout=5 # This setting determines whether or not Nagios will save state # information for services and hosts before it shuts down. Upon # startup Nagios will reload all saved service and host state -# information before starting to monitor. This is useful for +# information before starting to monitor. This is useful for # maintaining long-term data on state statistics, etc, but will # slow Nagios down a bit when it (re)starts. Since its only # a one-time penalty, I think its well worth the additional @@ -613,7 +613,7 @@ retain_state_information=1 # STATE RETENTION FILE # This is the file that Nagios should use to store host and -# service state information before it shuts down. The state +# service state information before it shuts down. The state # information in this file is also read immediately prior to # starting to monitor the network when Nagios is restarted. # This file is used only if the preserve_state_information @@ -636,7 +636,7 @@ retention_update_interval=60 # USE RETAINED PROGRAM STATE -# This setting determines whether or not Nagios will set +# This setting determines whether or not Nagios will set # program status variables based on the values saved in the # retention file. If you want to use retained program status # information, set this value to 1. If not, set this value @@ -663,7 +663,7 @@ use_retained_scheduling_info=1 # program restarts. # # The values of the masks are bitwise ANDs of values specified -# by the "MODATTR_" definitions found in include/common.h. +# by the "MODATTR_" definitions found in include/common.h. # For example, if you do not want the current enabled/disabled state # of flap detection and event handlers for hosts to be retained, you # would use a value of 24 for the host attribute mask... @@ -714,7 +714,7 @@ use_aggressive_host_checking=0 # SERVICE CHECK EXECUTION OPTION # This determines whether or not Nagios will actively execute -# service checks when it initially starts. If this option is +# service checks when it initially starts. If this option is # disabled, checks are not actively made, but Nagios can still # receive and process passive check results that come in. Unless # you're implementing redundant hosts or have a special need for @@ -736,7 +736,7 @@ accept_passive_service_checks=1 # HOST CHECK EXECUTION OPTION # This determines whether or not Nagios will actively execute -# host checks when it initially starts. If this option is +# host checks when it initially starts. If this option is # disabled, checks are not actively made, but Nagios can still # receive and process passive check results that come in. Unless # you're implementing redundant hosts or have a special need for @@ -793,7 +793,7 @@ process_performance_data=0 # These commands are run after every host and service check is # performed. These commands are executed only if the # enable_performance_data option (above) is set to 1. The command -# argument is the short name of a command definition that you +# argument is the short name of a command definition that you # define in your host configuration file. Read the HTML docs for # more information on performance data. @@ -873,7 +873,7 @@ obsess_over_services=0 # OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND # This is the command that is run for every service check that is # processed by Nagios. This command is executed only if the -# obsess_over_services option (above) is set to 1. The command +# obsess_over_services option (above) is set to 1. The command # argument is the short name of a command definition that you # define in your host configuration file. Read the HTML docs for # more information on implementing distributed monitoring. @@ -897,7 +897,7 @@ obsess_over_hosts=0 # OBSESSIVE COMPULSIVE HOST PROCESSOR COMMAND # This is the command that is run for every host check that is # processed by Nagios. This command is executed only if the -# obsess_over_hosts option (above) is set to 1. The command +# obsess_over_hosts option (above) is set to 1. The command # argument is the short name of a command definition that you # define in your host configuration file. Read the HTML docs for # more information on implementing distributed monitoring. @@ -936,9 +936,9 @@ passive_host_checks_are_soft=0 # ORPHANED HOST/SERVICE CHECK OPTIONS -# These options determine whether or not Nagios will periodically +# These options determine whether or not Nagios will periodically # check for orphaned host service checks. Since service checks are -# not rescheduled until the results of their previous execution +# not rescheduled until the results of their previous execution # instance are processed, there exists a possibility that some # checks may never get rescheduled. A similar situation exists for # host checks, although the exact scheduling details differ a bit @@ -1006,9 +1006,9 @@ additional_freshness_latency=15 # FLAP DETECTION OPTION # This option determines whether or not Nagios will try -# and detect hosts and services that are "flapping". +# and detect hosts and services that are "flapping". # Flapping occurs when a host or service changes between -# states too frequently. When Nagios detects that a +# states too frequently. When Nagios detects that a # host or service is flapping, it will temporarily suppress # notifications for that host/service until it stops # flapping. Flap detection is very experimental, so read @@ -1052,7 +1052,7 @@ date_format=us # the system configured timezone. # # NOTE: In order to display the correct timezone in the CGIs, you -# will also need to alter the Apache directives for the CGI path +# will also need to alter the Apache directives for the CGI path # to include your timezone. Example: # # @@ -1089,7 +1089,7 @@ enable_embedded_perl=1 # This option determines whether or not Nagios will process Perl plugins # and scripts with the embedded Perl interpreter if the plugins/scripts # do not explicitly indicate whether or not it is okay to do so. Read -# the HTML documentation on the embedded Perl interpreter for more +# the HTML documentation on the embedded Perl interpreter for more # information on how this option works. use_embedded_perl_implicitly=1 @@ -1136,7 +1136,7 @@ use_regexp_matching=0 # "TRUE" REGULAR EXPRESSION MATCHING -# This option controls whether or not "true" regular expression +# This option controls whether or not "true" regular expression # matching takes place in the object config files. This option # only has an effect if regular expression matching is enabled # (see above). If this option is DISABLED, regular expression @@ -1189,7 +1189,7 @@ use_large_installation_tweaks=0 # This option determines whether or not Nagios will make all standard # macros available as environment variables when host/service checks # and system commands (event handlers, notifications, etc.) are -# executed. Enabling this option can cause performance issues in +# executed. Enabling this option can cause performance issues in # large installations, as it will consume a bit more memory and (more # importantly) consume more CPU. # Values: 1 - Enable environment variable macros (default) diff --git a/lib/deprec/templates/nagios/nrpe.cfg.erb b/lib/deprec/templates/nagios/nrpe.cfg.erb index 2e7d5954..dab0b45e 100644 --- a/lib/deprec/templates/nagios/nrpe.cfg.erb +++ b/lib/deprec/templates/nagios/nrpe.cfg.erb @@ -1,7 +1,7 @@ ############################################################################# -# Sample NRPE Config File +# Sample NRPE Config File # Written by: Ethan Galstad (nagios@nagios.org) -# +# # Last Modified: 03-09-2007 # # NOTES: @@ -39,9 +39,9 @@ server_port=5666 # NRPE USER -# This determines the effective user that the NRPE daemon should run as. +# This determines the effective user that the NRPE daemon should run as. # You can either supply a username or a UID. -# +# # NOTE: This option is ignored if NRPE is running under either inetd or xinetd nrpe_user=nagios @@ -49,9 +49,9 @@ nrpe_user=nagios # NRPE GROUP -# This determines the effective group that the NRPE daemon should run as. +# This determines the effective group that the NRPE daemon should run as. # You can either supply a group name or a GID. -# +# # NOTE: This option is ignored if NRPE is running under either inetd or xinetd nrpe_group=nagios @@ -59,7 +59,7 @@ nrpe_group=nagios # ALLOWED HOST ADDRESSES -# This is an optional comma-delimited list of IP address or hostnames +# This is an optional comma-delimited list of IP address or hostnames # that are allowed to talk to the NRPE daemon. # # Note: The daemon only does rudimentary checking of the client's IP @@ -70,16 +70,16 @@ nrpe_group=nagios # NOTE: This option is ignored if NRPE is running under either inetd or xinetd allowed_hosts=127.0.0.1 - + # COMMAND ARGUMENT PROCESSING # This option determines whether or not the NRPE daemon will allow clients # to specify arguments to commands that are executed. This option only works # if the daemon was configured with the --enable-command-args configure script -# option. +# option. # -# *** ENABLING THIS OPTION IS A SECURITY RISK! *** +# *** ENABLING THIS OPTION IS A SECURITY RISK! *** # Read the SECURITY file for information on some of the security implications # of enabling this variable. # @@ -95,9 +95,9 @@ dont_blame_nrpe=0 # command line from the command definition. # # *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! *** -# Usage scenario: +# Usage scenario: # Execute restricted commmands using sudo. For this to work, you need to add -# the nagios user to your /etc/sudoers. An example entry for alllowing +# the nagios user to your /etc/sudoers. An example entry for alllowing # execution of the plugins from might be: # # nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/ @@ -106,7 +106,7 @@ dont_blame_nrpe=0 # without asking for a password. If you do this, make sure you don't give # random users write access to that directory or its contents! -# command_prefix=/usr/bin/sudo +# command_prefix=/usr/bin/sudo @@ -193,13 +193,13 @@ command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1 command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z -command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 -command[check_memory]=/usr/local/nagios/libexec/check_linux_free_memory.pl -w 10% -c 0% +command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 +command[check_memory]=/usr/local/nagios/libexec/check_linux_free_memory.pl -w 10% -c 0% # The following examples allow user-supplied arguments and can -# only be used if the NRPE daemon was compiled with support for +# only be used if the NRPE daemon was compiled with support for # command arguments *AND* the dont_blame_nrpe directive in this # config file is set to '1'. This poses a potential security risk, so # make sure you read the SECURITY file before doing this. diff --git a/lib/deprec/templates/nagios/nrpe.xinetd.erb b/lib/deprec/templates/nagios/nrpe.xinetd.erb index a3b51aaa..ff4daafe 100644 --- a/lib/deprec/templates/nagios/nrpe.xinetd.erb +++ b/lib/deprec/templates/nagios/nrpe.xinetd.erb @@ -3,8 +3,8 @@ service nrpe { flags = REUSE - socket_type = stream - port = 5666 + socket_type = stream + port = 5666 wait = no user = nagios group = nagios diff --git a/lib/deprec/templates/nagios/resource.cfg.erb b/lib/deprec/templates/nagios/resource.cfg.erb index bee7a78c..1c3faa9b 100644 --- a/lib/deprec/templates/nagios/resource.cfg.erb +++ b/lib/deprec/templates/nagios/resource.cfg.erb @@ -6,8 +6,8 @@ # # You can define $USERx$ macros in this file, which can in turn be used # in command definitions in your host config file(s). $USERx$ macros are -# useful for storing sensitive information such as usernames, passwords, -# etc. They are also handy for specifying the path to plugins and +# useful for storing sensitive information such as usernames, passwords, +# etc. They are also handy for specifying the path to plugins and # event handlers - if you decide to move the plugins or event handlers to # a different directory in the future, you can just update one or two # $USERx$ macros, instead of modifying a lot of command definitions. diff --git a/lib/deprec/templates/nagios/services.cfg.erb b/lib/deprec/templates/nagios/services.cfg.erb index a80be8fe..b2612bbb 100644 --- a/lib/deprec/templates/nagios/services.cfg.erb +++ b/lib/deprec/templates/nagios/services.cfg.erb @@ -6,27 +6,27 @@ ############################################################################### ############################################################################### -define service{ - use generic-service - hostgroup_name servers - service_description Swap +define service{ + use generic-service + hostgroup_name servers + service_description Swap servicegroups memory - check_command check_nrpe!check_swap + check_command check_nrpe!check_swap } -define service{ - use generic-service - hostgroup_name servers - service_description CPU - check_command check_nrpe!check_load -} +define service{ + use generic-service + hostgroup_name servers + service_description CPU + check_command check_nrpe!check_load +} -define service{ - use generic-service - hostgroup_name servers +define service{ + use generic-service + hostgroup_name servers servicegroups disk - service_description Disk - check_command check_nrpe!check_sda1 + service_description Disk + check_command check_nrpe!check_sda1 } ############################################################################### @@ -75,5 +75,5 @@ define service{ retry_check_interval 1 ; Re-check the service every minute until a hard state can be determined register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE! } - + diff --git a/lib/deprec/templates/nagios/timeperiods.cfg.erb b/lib/deprec/templates/nagios/timeperiods.cfg.erb index f677e57a..3280d4ca 100644 --- a/lib/deprec/templates/nagios/timeperiods.cfg.erb +++ b/lib/deprec/templates/nagios/timeperiods.cfg.erb @@ -6,7 +6,7 @@ # NOTES: This config file provides you with some example timeperiod definitions # that you can reference in host, service, contact, and dependency # definitions. -# +# # You don't need to keep timeperiods in a separate file from your other # object definitions. This has been done just to make things easier to # understand. @@ -23,7 +23,7 @@ ############################################################################### ############################################################################### -# This defines a timeperiod where all times are valid for checks, +# This defines a timeperiod where all times are valid for checks, # notifications, etc. The classic "24x7" support nightmare. :-) define timeperiod{ timeperiod_name 24x7 @@ -59,7 +59,7 @@ define timeperiod{ # Some U.S. holidays # Note: The timeranges for each holiday are meant to *exclude* the holidays from being -# treated as a valid time for notifications, etc. You probably don't want your pager +# treated as a valid time for notifications, etc. You probably don't want your pager # going off on New Year's. Although you're employer might... :-) define timeperiod{ name us-holidays diff --git a/lib/deprec/templates/nginx/nginx-init-script b/lib/deprec/templates/nginx/nginx-init-script index 0563eb3e..cb0a2bb4 100644 --- a/lib/deprec/templates/nginx/nginx-init-script +++ b/lib/deprec/templates/nginx/nginx-init-script @@ -49,13 +49,13 @@ case "$1" in reload) echo -n "Reloading $DESC configuration: " start-stop-daemon --stop --signal HUP --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \ - --exec $DAEMON + --exec $DAEMON echo "$NAME." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 - exit 1 + exit 1 ;; esac diff --git a/lib/deprec/templates/nginx/nginx.conf.erb b/lib/deprec/templates/nginx/nginx.conf.erb index aeb425a0..97dda174 100644 --- a/lib/deprec/templates/nginx/nginx.conf.erb +++ b/lib/deprec/templates/nginx/nginx.conf.erb @@ -18,7 +18,7 @@ events { http { server_names_hash_bucket_size 512; include /usr/local/nginx/conf/vhosts/*.conf; - include conf/mime.types; + include conf/mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] $request ' @@ -42,7 +42,7 @@ http { server { listen 80; - server_name localhost; + server_name localhost; #charset koi8-r; diff --git a/lib/deprec/templates/nginx/nothing.conf b/lib/deprec/templates/nginx/nothing.conf index 5679231f..5e388f44 100644 --- a/lib/deprec/templates/nginx/nothing.conf +++ b/lib/deprec/templates/nginx/nothing.conf @@ -1 +1 @@ -# This dir is for vhost config files \ No newline at end of file +# This dir is for vhost config files \ No newline at end of file diff --git a/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb b/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb index 1e8a450f..083520c2 100644 --- a/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +++ b/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb @@ -27,7 +27,7 @@ server { } if (-f $request_filename.html) { rewrite (.*) $1.html break; - } + } if (!-f $request_filename) { proxy_pass http://<%= application %>; break; diff --git a/lib/deprec/templates/postfix/dynamicmaps.cf.erb b/lib/deprec/templates/postfix/dynamicmaps.cf.erb index 837c78ab..93326c1c 100644 --- a/lib/deprec/templates/postfix/dynamicmaps.cf.erb +++ b/lib/deprec/templates/postfix/dynamicmaps.cf.erb @@ -5,4 +5,4 @@ # #type location of .so file open function (mkmap func) #==== ================================ ============= ============ -tcp /usr/lib/postfix/dict_tcp.so dict_tcp_open +tcp /usr/lib/postfix/dict_tcp.so dict_tcp_open diff --git a/lib/deprec/templates/postfix/main.cf.erb b/lib/deprec/templates/postfix/main.cf.erb index 346dfb1a..4c53c898 100644 --- a/lib/deprec/templates/postfix/main.cf.erb +++ b/lib/deprec/templates/postfix/main.cf.erb @@ -25,7 +25,7 @@ smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. -# myhostname = +# myhostname = alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = $myhostname localhost.$mydomain $myorigin diff --git a/lib/deprec/templates/trac/apache_vhost.conf.erb b/lib/deprec/templates/trac/apache_vhost.conf.erb index 4e7fb176..92bec507 100644 --- a/lib/deprec/templates/trac/apache_vhost.conf.erb +++ b/lib/deprec/templates/trac/apache_vhost.conf.erb @@ -1,18 +1,18 @@ ServerName <%= trac_home_url %> - - # Configure trac_cluster + + # Configure trac_cluster BalancerMember http://127.0.0.1:<%= tracd_port %> RewriteEngine On - + # Redirect to the AGR track instance RewriteRule ^/$ /<%= application %>/ [R] # Send all traffic to tracd RewriteRule ^/(.*)$ balancer://trac_cluster%{REQUEST_URI} [P,QSA,L] - + # Deflate AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html diff --git a/lib/deprec/templates/trac/trac.ini.erb b/lib/deprec/templates/trac/trac.ini.erb index f9dd5261..8019be17 100644 --- a/lib/deprec/templates/trac/trac.ini.erb +++ b/lib/deprec/templates/trac/trac.ini.erb @@ -8,8 +8,8 @@ render_unsafe_content = false color_scale = True downloadable_paths = /trunk, /branches/*, /tags/* hide_properties = svk:merge -intermediate_color = -intermediate_point = +intermediate_color = +intermediate_point = newest_color = (255, 136, 136) oldest_color = (136, 136, 255) oneliner_properties = trac:summary @@ -24,13 +24,13 @@ wiki_format_messages = true [header_logo] alt = (please configure the [header_logo] section in trac.ini) height = -1 -link = +link = src = site/your_project_logo.png width = -1 [inherit] -plugins_dir = -templates_dir = +plugins_dir = +templates_dir = [logging] log_file = trac.log @@ -50,36 +50,36 @@ php_path = php tab_width = 8 [notification] -admit_domains = +admit_domains = always_notify_owner = false always_notify_reporter = false always_notify_updater = true -ignore_domains = +ignore_domains = mime_encoding = base64 -smtp_always_bcc = -smtp_always_cc = -smtp_default_domain = +smtp_always_bcc = +smtp_always_cc = +smtp_default_domain = smtp_enabled = false smtp_from = trac@localhost -smtp_from_name = -smtp_password = +smtp_from_name = +smtp_password = smtp_port = 25 smtp_replyto = trac@localhost smtp_server = localhost smtp_subject_prefix = __default__ -smtp_user = +smtp_user = ticket_subject_template = $prefix #$ticket.id: $summary use_public_cc = false use_short_addr = false use_tls = false [project] -admin = +admin = descr = My example project footer = Visit the Trac open source project at
http://trac.edgewall.org/ icon = common/trac.ico name = mikehome -url = +url = [query] default_anonymous_query = status!=closed&cc~=$USER @@ -104,12 +104,12 @@ branches = trunk,branches/* tags = tags/* [ticket] -default_component = -default_milestone = +default_component = +default_milestone = default_priority = major default_resolution = fixed default_type = defect -default_version = +default_version = max_description_size = 262144 preserve_newlines = default restrict_owner = false @@ -143,14 +143,14 @@ newticket_formatter = oneliner ticket_show_details = false [trac] -authz_file = -authz_module_name = +authz_file = +authz_module_name = auto_reload = False -base_url = +base_url = check_auth_ip = true database = sqlite:db/trac.db default_charset = iso-8859-15 -htdocs_location = +htdocs_location = ignore_auth_case = false mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search metanav = login,logout,prefs,help,about diff --git a/lib/deprec/templates/trac/tracd-init.erb b/lib/deprec/templates/trac/tracd-init.erb index f096a702..90f41c2d 100755 --- a/lib/deprec/templates/trac/tracd-init.erb +++ b/lib/deprec/templates/trac/tracd-init.erb @@ -21,7 +21,7 @@ Usage: $0 {start|stop} case "$1" in start) echo "Starting tracd" - for dir in `ls $trac_parent_dir`; do + for dir in `ls $trac_parent_dir`; do project="`basename $dir`" passwords="$trac_parent_dir/${dir}/conf/users.htdigest" auth_string="$auth_string --auth=${project},${passwords},${project}" @@ -33,11 +33,11 @@ case "$1" in ;; stop) - echo "Stopping tracd" + echo "Stopping tracd" kill `cat $trac_pidfile` >/dev/null 2>&1 rm -f $trac_pidfile ;; - + *) usage esac diff --git a/lib/deprec/templates/vnstat/config.php b/lib/deprec/templates/vnstat/config.php index 59868ad5..df66dde4 100644 --- a/lib/deprec/templates/vnstat/config.php +++ b/lib/deprec/templates/vnstat/config.php @@ -17,7 +17,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // - // see file COPYING or at http://www.gnu.org/licenses/gpl.html + // see file COPYING or at http://www.gnu.org/licenses/gpl.html // for more information. // @@ -34,7 +34,7 @@ // optional names for interfaces // if there's no name set for an interface then the interface identifier // will be displayed instead - // + // $iface_title['eth0'] = 'Internal'; $iface_title['eth1'] = 'Internet'; $iface_title['sixxs'] = 'SixXS IPv6'; @@ -42,7 +42,7 @@ // // There are two possible sources for vnstat data. If the $vnstat_bin // variable is set then vnstat is called directly from the PHP script - // to get the interface data. + // to get the interface data. // // The other option is to periodically dump the vnstat interface data to // a file (e.g. by a cronjob). In that case the $vnstat_bin variable @@ -51,7 +51,7 @@ // // You can generate vnstat dumps with the command: // vnstat --dumpdb -i $iface > /path/to/data_dir/vnstat_dump_$iface - // + // $vnstat_bin = '/usr/bin/vmstat'; $data_dir = './dumps'; ?> \ No newline at end of file diff --git a/lib/deprec/templates/xen/xen-tools.conf.erb b/lib/deprec/templates/xen/xen-tools.conf.erb index 659f922f..70dd212e 100644 --- a/lib/deprec/templates/xen/xen-tools.conf.erb +++ b/lib/deprec/templates/xen/xen-tools.conf.erb @@ -22,7 +22,7 @@ # # New instances will be stored in subdirectories named after their # hostnames. -# +# ## # dir = /home/xen # dir = /var/vm @@ -31,7 +31,7 @@ # ## # -# If you don't wish to use loopback images then you may specify an +# If you don't wish to use loopback images then you may specify an # LVM volume group here instead # ## @@ -59,7 +59,7 @@ lvm = vm_local # ## # -# +# # install-method = [ debootstrap | rpmstrap | copy | tar ] # # diff --git a/lib/deprec/templates/xen/xend-config.sxp.erb b/lib/deprec/templates/xen/xend-config.sxp.erb index d734aa81..231ce583 100644 --- a/lib/deprec/templates/xen/xend-config.sxp.erb +++ b/lib/deprec/templates/xen/xend-config.sxp.erb @@ -4,9 +4,9 @@ # Xend configuration file. # -# This example configuration is appropriate for an installation that +# This example configuration is appropriate for an installation that # utilizes a bridged network configuration. Access to xend via http -# is disabled. +# is disabled. # Commented out entries show the default for that entry, unless otherwise # specified. @@ -65,7 +65,7 @@ #(xend-unix-path /var/lib/xend/xend-socket) -# Address and port xend should use for the legacy TCP XMLRPC interface, +# Address and port xend should use for the legacy TCP XMLRPC interface, # if xen-tcp-xmlrpc-server is set. #(xen-tcp-xmlrpc-server-address 'localhost') #(xen-tcp-xmlrpc-server-port 8006) @@ -126,7 +126,7 @@ # (network-script network-bridge-wrapper) # -# Your default ethernet device is used as the outgoing interface, by default. +# Your default ethernet device is used as the outgoing interface, by default. # To use a different one (e.g. eth1) use # # (network-script 'network-bridge netdev=eth1') diff --git a/lib/deprec/templates/xen/xendomains.erb b/lib/deprec/templates/xen/xendomains.erb index 0263cd7a..c93d08b6 100644 --- a/lib/deprec/templates/xen/xendomains.erb +++ b/lib/deprec/templates/xen/xendomains.erb @@ -1,7 +1,7 @@ ## Path: System/xen ## Description: xen domain start/stop on boot ## Type: string -## Default: +## Default: # # The xendomains script can send SysRq requests to domains on shutdown. # If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility @@ -10,7 +10,7 @@ # XENDOMAINS_SYSRQ="" -## Type: integer +## Type: integer ## Default: 100000 # # If XENDOMAINS_SYSRQ is set, this variable determines how long to wait @@ -49,7 +49,7 @@ XENDOMAINS_MIGRATE="" # # Directory to save running domains to when the system (dom0) is # shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE -# is set (see below). Leave empty to disable domain saving on shutdown +# is set (see below). Leave empty to disable domain saving on shutdown # (e.g. because you rather shut domains down). # If domain saving does succeed, SHUTDOWN will not be executed. # @@ -77,14 +77,14 @@ XENDOMAINS_SHUTDOWN="--halt --wait" # Leave it empty not to do anything special here. # (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY # is set.) -# +# XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait" ## Type: boolean ## Default: true # # This variable determines whether saved domains from XENDOMAINS_SAVE -# will be restored on system startup. +# will be restored on system startup. # XENDOMAINS_RESTORE=true @@ -95,22 +95,22 @@ XENDOMAINS_RESTORE=true # are stored that should be started on system startup automatically. # Leave empty if you don't want to start domains automatically # (or just don't place any xen domain config files in that dir). -# Note that the script tries to be clever if both RESTORE and AUTO are +# Note that the script tries to be clever if both RESTORE and AUTO are # set: It will first restore saved domains and then only start domains -# in AUTO which are not running yet. +# in AUTO which are not running yet. # Note that the name matching is somewhat fuzzy. # XENDOMAINS_AUTO=/etc/xen/auto ## Type: boolean ## Default: false -# -# If this variable is set to "true", only the domains started via config +# +# If this variable is set to "true", only the domains started via config # files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ, # XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise -# all running domains will be. +# all running domains will be. # Note that the name matching is somewhat fuzzy. -# +# XENDOMAINS_AUTO_ONLY=false ## Type: integer diff --git a/lib/deprec/templates/xen/xm.tmpl.erb b/lib/deprec/templates/xen/xm.tmpl.erb index 16648a30..6863b552 100644 --- a/lib/deprec/templates/xen/xm.tmpl.erb +++ b/lib/deprec/templates/xen/xm.tmpl.erb @@ -22,7 +22,7 @@ memory = '{$memory}' # Disk device(s). # root = '/dev/{$device}1 ro' -{ if ( $noswap ) +{ if ( $noswap ) { $OUT .= "disk = [ '$image_vbd,$device" . "1,w' ]"; } @@ -47,12 +47,12 @@ name = '{$hostname}' # Setup the mac address, if present. my $m = ''; if ( $mac ) - { + { $m = "mac=$mac" } $OUT .= "vif = [ '$m' ]"; - } + } else { # @@ -60,11 +60,11 @@ name = '{$hostname}' # my $m = ''; if ( $mac ) - { + { $m = ",mac=$mac" } - $OUT .= "vif = [ 'ip=$ip1"; + $OUT .= "vif = [ 'ip=$ip1"; $OUT .= "$m' ]"; } } diff --git a/lib/deprec_cmd_completion.sh b/lib/deprec_cmd_completion.sh index 700591e9..7fdd285d 100755 --- a/lib/deprec_cmd_completion.sh +++ b/lib/deprec_cmd_completion.sh @@ -1,5 +1,5 @@ export CAP_TASKS=$( cap -T | grep '^cap' | cut -d' ' -f 2 ) -_cap() +_cap() { local cur tasks colonprefixes COMPREPLY=() diff --git a/lib/vmbuilder_plugins/apt.rb b/lib/vmbuilder_plugins/apt.rb index 79c27d81..9980ad91 100644 --- a/lib/vmbuilder_plugins/apt.rb +++ b/lib/vmbuilder_plugins/apt.rb @@ -15,17 +15,17 @@ # Installs within Capistrano as the plugin _apt_. # # =Usage -# +# # require 'vmbuilder_plugins/apt' # # Prefix all calls to the library with apt. # -module Apt +module Apt # Default apt-get command - reduces any interactivity to the minimum. - APT_GET="DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get" + APT_GET="DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get" - # Run the apt install program across the package list in 'packages'. + # Run the apt install program across the package list in 'packages'. # Select those packages referenced by :base and the +version+ # of the distribution you want to use. def install(packages, version, options={}) diff --git a/lib/vmbuilder_plugins/emerge.rb b/lib/vmbuilder_plugins/emerge.rb index 83129d21..1058b1fc 100644 --- a/lib/vmbuilder_plugins/emerge.rb +++ b/lib/vmbuilder_plugins/emerge.rb @@ -24,7 +24,7 @@ module Emerge # Default emerge command - reduce interactivity to the minimum EMERGE="emerge -q" - + # Emerge a new package or packages def install(packages, options={}) cmd = <<-CMD @@ -32,7 +32,7 @@ def install(packages, options={}) CMD sudo(cmd, options) end - + # Run clean old/unused packages def clean(options={}) cmd = <<-CMD @@ -40,7 +40,7 @@ def clean(options={}) CMD sudo(cmd, options) end - + # Upgrade installed package list def upgrade(options={}) cmd = <<-CMD @@ -48,7 +48,7 @@ def upgrade(options={}) CMD sudo(cmd, options) end - + # Update portage def update_system(options={}) cmd = <<-CMD @@ -56,7 +56,7 @@ def update_system(options={}) CMD sudo(cmd, options) end - + # Update all installed packages def update(options={}) cmd = <<-CMD @@ -64,7 +64,7 @@ def update(options={}) CMD sudo(cmd, options) end - + # Boot script manipulation command def rc_update(packages, setting) packages.each do |service| diff --git a/lib/vmbuilder_plugins/gem.rb b/lib/vmbuilder_plugins/gem.rb index dc161fe3..cc7060a7 100644 --- a/lib/vmbuilder_plugins/gem.rb +++ b/lib/vmbuilder_plugins/gem.rb @@ -1,6 +1,6 @@ # =gem.rb: Gem Installer library # Capistrano library to install and manage Ruby Gems. -# +# # ---- # Copyright (c) 2007 Neil Wilson, Aldur Systems Ltd # @@ -15,7 +15,7 @@ # Installs within Capistrano as the plugin _gem_. # # =Usage -# +# # require 'vmbuilder_plugins/gem' # # Prefix all calls to the library with gem. @@ -50,7 +50,7 @@ def cleanup # specified. # # +packages+ can be a single string or an array of strings. - # + # def install(packages, version=nil) send(run_method,"#{GEM_INSTALL} #{if version then '-v '+version.to_s end} #{packages.to_a.join(' ')}") end diff --git a/lib/vmbuilder_plugins/std.rb b/lib/vmbuilder_plugins/std.rb index 61e0cb9f..1bc6ead3 100644 --- a/lib/vmbuilder_plugins/std.rb +++ b/lib/vmbuilder_plugins/std.rb @@ -1,6 +1,6 @@ # =std.rb: Capistrano Standard Methods # Standard library of procedures and functions that you can use with Capistrano. -# +# # ---- # Copyright (c) 2007 Neil Wilson, Aldur Systems Ltd # @@ -23,7 +23,7 @@ module Std begin # Use the Mmap class if it is available - # http://moulon.inra.fr/ruby/mmap.html + # http://moulon.inra.fr/ruby/mmap.html require 'mmap' MMAP=true #:nodoc: rescue LoadError @@ -60,14 +60,14 @@ def fput(file_pattern, destination, options={}) # +options+ are as for *put* # def su_put(data, destination, temporary_area='/tmp', options={}) - temporary_area = File.join(temporary_area,"#{File.basename(destination)}-$CAPISTRANO:HOST$") + temporary_area = File.join(temporary_area,"#{File.basename(destination)}-$CAPISTRANO:HOST$") put(data, temporary_area, options) send run_method, <<-CMD sh -c "install -m#{sprintf("%3o",options[:mode]||0755)} #{temporary_area} #{destination} && rm -f #{temporary_area}" CMD end - + # Copies the +file_pattern+, which is assumed to be a tar # file of some description (gzipped or plain), and unpacks it into # +destination+. @@ -90,14 +90,14 @@ def unzip(file_pattern, destination, options={}) end end end - + # Wrap this around your task calls to catch the no servers error and # ignore it - # + # # std.ignore_no_servers_error do # activate_mysql # end - # + # def ignore_no_servers_error (&block) begin yield @@ -141,12 +141,12 @@ def random_string(size=10) # Return a relative path from the destination directory +from_str+ # to the target file/directory +to_str+. Used to create relative # symbolic link paths. - def relative_path (from_str, to_str) + def relative_path (from_str, to_str) require 'pathname' Pathname.new(to_str).relative_path_from(Pathname.new(from_str)).to_s end - # Run a ruby command file on the servers + # Run a ruby command file on the servers # def ruby(cmd, options={}, &block) temp_name = random_string + ".rb" @@ -185,7 +185,7 @@ def su_delete(path, options={}) end # Render a template file and upload it to the servers - # + # def put_template(template, destination, options={}) if MMAP logger.debug "Using Memory Mapped File Upload"