| 1 |
------------------------------------------ |
|---|
| 2 |
deprec - Deployment Recipes for Capistrano |
|---|
| 3 |
------------------------------------------ |
|---|
| 4 |
|
|---|
| 5 |
== Introduction |
|---|
| 6 |
|
|---|
| 7 |
The deprec [1] gem is a set of tasks for Capistrano [2]. These tasks provide |
|---|
| 8 |
for the installation, configuration and control of system services. Deprec |
|---|
| 9 |
was created in 2006 by Mike Bailey to setup an environment for running Ruby |
|---|
| 10 |
on Rails web applications on Ubuntu dapper servers. Since then its uses have |
|---|
| 11 |
grown to installing mail, monitoring, high availability IP failover and other |
|---|
| 12 |
services. |
|---|
| 13 |
|
|---|
| 14 |
The tasks are run at the command line on your workstation and connect to |
|---|
| 15 |
remote servers via ssh to run commands and copy out files. |
|---|
| 16 |
|
|---|
| 17 |
Deprec-2.x is a complete rewrite of the project that achieves the following: |
|---|
| 18 |
|
|---|
| 19 |
- support for Capistrano 2 |
|---|
| 20 |
- support for more services (heartbeat, nagios, nginx, ntp, postfix, etc) |
|---|
| 21 |
- creation of a standard base set of task names |
|---|
| 22 |
- tasks are cleanly separated into namespaced units (one file per service) |
|---|
| 23 |
- service config files are stored locally to enable edits and version control |
|---|
| 24 |
- interactive prompting for missing config values |
|---|
| 25 |
|
|---|
| 26 |
One idea that is in the trash can is supporting other distros/OS's. While I got |
|---|
| 27 |
caught up in the excitement of The Big Rewrite I've decided I don't need it. If |
|---|
| 28 |
you want to deploy to something other than Ubuntu I suggest you look for other |
|---|
| 29 |
alternatives. |
|---|
| 30 |
|
|---|
| 31 |
Deprec and Capistrano are written in the Ruby programming language [3] however |
|---|
| 32 |
no knowledge of Ruby is required to use it. Users should be able to write |
|---|
| 33 |
new tasks and modify existing options without prior knowledge of Ruby. |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
== Installation |
|---|
| 37 |
|
|---|
| 38 |
Deprec can be obtained from rubyforge[4] and installed using rubygems[5]. |
|---|
| 39 |
|
|---|
| 40 |
sudo gem install deprec # installs deprec and dependancies |
|---|
| 41 |
cap depify . # creates ~/.caprc which you may edit |
|---|
| 42 |
cap -T # should list lots of deprec tasks |
|---|
| 43 |
|
|---|
| 44 |
The .caprc file is loaded every time you use Capistrano. It in turn loads |
|---|
| 45 |
the deprec tasks so you always have them available. Editing the .caprc file |
|---|
| 46 |
in your home directory allows you to specify the location of your ssh key |
|---|
| 47 |
and enable some other useful options (documented in the comments). You can |
|---|
| 48 |
also put tasks here that you want to always have access to. |
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
== Getting a Ruby on Rails app running on a fresh Ubuntu server |
|---|
| 52 |
|
|---|
| 53 |
This is still what brings people to deprec. You can install a full Rails stack |
|---|
| 54 |
and get multiple apps running on it in much less time than it would take to |
|---|
| 55 |
do it manually. Think an hour vs. a weekend. (The irony is I'm up writing this |
|---|
| 56 |
on a Saturday night.) |
|---|
| 57 |
|
|---|
| 58 |
export HOSTS=<target.host.name> |
|---|
| 59 |
|
|---|
| 60 |
# Install Rails stack |
|---|
| 61 |
cap deprec:rails:install_rails_stack |
|---|
| 62 |
|
|---|
| 63 |
# Install mysql (if it's running on the same box) |
|---|
| 64 |
cap deprec:mysql:install |
|---|
| 65 |
cap deprec:mysql:config_gen |
|---|
| 66 |
cap deprec:mysql:config |
|---|
| 67 |
|
|---|
| 68 |
# Install your Rails app |
|---|
| 69 |
cap deploy:setup |
|---|
| 70 |
cap deploy |
|---|
| 71 |
cap deprec:db:create |
|---|
| 72 |
cap deprec:db:migrate |
|---|
| 73 |
cap deprec:nginx:restart |
|---|
| 74 |
cap deprec:mongrel:restart |
|---|
| 75 |
|
|---|
| 76 |
You can find documentation on the deprec site. http://www.deprec.org/ |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
== Installing other things |
|---|
| 80 |
|
|---|
| 81 |
I plan to document other things I use deprec for on http://www.deprec.org/. |
|---|
| 82 |
Feel free to poke around and see what's there. I use deprec to provision and |
|---|
| 83 |
manage servers so you might find some things in there I haven't documented. Lucky you. |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
== Disclaimer |
|---|
| 87 |
|
|---|
| 88 |
The tasks run commands that may make changes to your workstation and remote server. |
|---|
| 89 |
You are advised to read the source and use at your own risk. |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
== Credits |
|---|
| 93 |
|
|---|
| 94 |
Deprec is written and maintained by Mike Bailey <mike@bailey.net.au>. |
|---|
| 95 |
More about me here: [http://mike.bailey.net.au/] |
|---|
| 96 |
|
|---|
| 97 |
Deprec was inspired and uses the brilliantly executed Capistrano. Thanks Jamis! |
|---|
| 98 |
This gem includes a modified copy of Neil Wilson's very useful vmbuilder_plugins gem. |
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
== Thanks |
|---|
| 102 |
|
|---|
| 103 |
Eric Harris-Braun: great testing, bug reports and suggestions |
|---|
| 104 |
Gus Gollings: helped restore www.deprec.org |
|---|
| 105 |
Craig Ambrose: testing, documentation and beer |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
== License |
|---|
| 109 |
|
|---|
| 110 |
Deprec is licenced under the GPL. This means that you can use it in commercial |
|---|
| 111 |
or open source applications. More details found here: |
|---|
| 112 |
http://www.gnu.org/licenses/gpl.html |
|---|
| 113 |
|
|---|
| 114 |
deprec - deployment recipes for capistrano |
|---|
| 115 |
Copyright (C) 2006-2008 Mike Bailey |
|---|
| 116 |
|
|---|
| 117 |
This program is free software; you can redistribute it and/or |
|---|
| 118 |
modify it under the terms of the GNU General Public License |
|---|
| 119 |
as published by the Free Software Foundation; either version 2 |
|---|
| 120 |
of the License, or (at your option) any later version. |
|---|
| 121 |
|
|---|
| 122 |
This program is distributed in the hope that it will be useful, |
|---|
| 123 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 124 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 125 |
GNU General Public License for more details. |
|---|
| 126 |
|
|---|
| 127 |
You should have received a copy of the GNU General Public License |
|---|
| 128 |
along with this program; if not, write to the Free Software |
|---|
| 129 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
[1] http://www.deprec.org |
|---|
| 133 |
[2] http://www.capify.org |
|---|
| 134 |
[3] http://www.ruby-lang.org/en/ |
|---|
| 135 |
[4] http://rubyforge.org/ |
|---|
| 136 |
[5] http://rubygems.org/ |
|---|