centostrano 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +215 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +166 -0
- data/THANKS +5 -0
- data/bin/centify +137 -0
- data/docs/ANNOUNCE.deprec2 +47 -0
- data/docs/README.install +88 -0
- data/docs/README.nagios +28 -0
- data/docs/README.rails +20 -0
- data/docs/README.svn +31 -0
- data/docs/ROADMAP.txt +74 -0
- data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
- data/docs/deprec-1.x/notes.txt +12 -0
- data/docs/deprec_banner.gif +0 -0
- data/lib/centostrano.rb +9 -0
- data/lib/deprec/capistrano_extensions.rb +391 -0
- data/lib/deprec/centostrano.rb +46 -0
- data/lib/deprec/recipes/apache.rb +188 -0
- data/lib/deprec/recipes/canonical.rb +57 -0
- data/lib/deprec/recipes/deprec.rb +188 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +106 -0
- data/lib/deprec/recipes/gitosis.rb +134 -0
- data/lib/deprec/recipes/logrotate.rb +54 -0
- data/lib/deprec/recipes/memcache.rb +53 -0
- data/lib/deprec/recipes/merb.rb +57 -0
- data/lib/deprec/recipes/mongrel.rb +220 -0
- data/lib/deprec/recipes/monit.rb +139 -0
- data/lib/deprec/recipes/mysql.rb +147 -0
- data/lib/deprec/recipes/nginx.rb +172 -0
- data/lib/deprec/recipes/postgresql.rb +132 -0
- data/lib/deprec/recipes/rails.rb +297 -0
- data/lib/deprec/recipes/ruby.rb +71 -0
- data/lib/deprec/recipes/sphinx.rb +89 -0
- data/lib/deprec/recipes/ssh.rb +93 -0
- data/lib/deprec/recipes/svn.rb +167 -0
- data/lib/deprec/recipes/users.rb +90 -0
- data/lib/deprec/recipes.rb +33 -0
- data/lib/deprec/templates/aoe/aoe-init +55 -0
- data/lib/deprec/templates/aoe/fence_aoemask +351 -0
- data/lib/deprec/templates/apache/httpd-vhost-app.conf.erb +144 -0
- data/lib/deprec/templates/apache/httpd.conf +465 -0
- data/lib/deprec/templates/apache/index.html.erb +37 -0
- data/lib/deprec/templates/apache/master.css +72 -0
- data/lib/deprec/templates/centos/repository.erb +6 -0
- data/lib/deprec/templates/coraid/aoe-init +55 -0
- data/lib/deprec/templates/deprec/caprc.erb +14 -0
- data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
- data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
- data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
- data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/templates/mongrel/logrotate.erb +0 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster.logrotate.d +14 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
- data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
- data/lib/deprec/templates/monit/monit-init-script +104 -0
- data/lib/deprec/templates/monit/monitrc.erb +227 -0
- data/lib/deprec/templates/monit/nothing +0 -0
- data/lib/deprec/templates/mysql/create_databases.sql +20 -0
- data/lib/deprec/templates/mysql/database.yml.prod +6 -0
- data/lib/deprec/templates/mysql/database.yml.stage +6 -0
- data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
- data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
- data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
- data/lib/deprec/templates/nagios/cgi.cfg.erb +321 -0
- data/lib/deprec/templates/nagios/commands.cfg.erb +240 -0
- data/lib/deprec/templates/nagios/contacts.cfg.erb +57 -0
- data/lib/deprec/templates/nagios/hosts.cfg.erb +143 -0
- data/lib/deprec/templates/nagios/htpasswd.users +1 -0
- data/lib/deprec/templates/nagios/localhost.cfg.erb +157 -0
- data/lib/deprec/templates/nagios/nagios.cfg.erb +1274 -0
- data/lib/deprec/templates/nagios/nagios_apache_vhost.conf.erb +45 -0
- data/lib/deprec/templates/nagios/nrpe.cfg.erb +210 -0
- data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
- data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
- data/lib/deprec/templates/nagios/services.cfg.erb +79 -0
- data/lib/deprec/templates/nagios/templates.cfg.erb +9 -0
- data/lib/deprec/templates/nagios/timeperiods.cfg.erb +94 -0
- data/lib/deprec/templates/network/hostname.erb +1 -0
- data/lib/deprec/templates/network/hosts.erb +2 -0
- data/lib/deprec/templates/network/interfaces.erb +22 -0
- data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
- data/lib/deprec/templates/nginx/logrotate.erb +0 -0
- data/lib/deprec/templates/nginx/mime.types.erb +70 -0
- data/lib/deprec/templates/nginx/nginx-init-script +109 -0
- data/lib/deprec/templates/nginx/nginx.conf.erb +120 -0
- data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
- data/lib/deprec/templates/nginx/nothing.conf +1 -0
- data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
- data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
- data/lib/deprec/templates/postfix/aliases.erb +3 -0
- data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
- data/lib/deprec/templates/postfix/main.cf.erb +41 -0
- data/lib/deprec/templates/postfix/master.cf.erb +77 -0
- data/lib/deprec/templates/postgresql/pg_hba.conf.erb +76 -0
- data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
- data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
- data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
- data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
- data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
- data/lib/deprec/templates/trac/trac.ini.erb +106 -0
- data/lib/deprec/templates/trac/trac_deprec.png +0 -0
- data/lib/deprec/templates/trac/tracd-init.erb +43 -0
- data/lib/deprec/templates/xen/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
- data/lib/deprec/templates/xen/xen-tools.conf.erb +220 -0
- data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
- data/lib/deprec/templates/xen/xend-init.erb +69 -0
- data/lib/deprec/templates/xen/xendomains.erb +137 -0
- data/lib/deprec/templates/xen/xm.tmpl.erb +85 -0
- data/lib/deprec_cmd_completion.sh +26 -0
- data/lib/vmbuilder_plugins/all.rb +20 -0
- data/lib/vmbuilder_plugins/apt.rb +93 -0
- data/lib/vmbuilder_plugins/emerge.rb +76 -0
- data/lib/vmbuilder_plugins/gem.rb +90 -0
- data/lib/vmbuilder_plugins/std.rb +203 -0
- metadata +207 -0
data/README
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
------------------------------------------
|
|
2
|
+
Centostrano - port of deprec2 to CentOS
|
|
3
|
+
------------------------------------------
|
|
4
|
+
|
|
5
|
+
This project aims to port deprec 2 to CentOS. Intention is to keep Centostrano
|
|
6
|
+
as close to original deprec 2 as possible, but some changes are implemented,
|
|
7
|
+
because of conflicts between Centostrano and deprec 2. Instead of binary
|
|
8
|
+
'depify' one must use 'centify', instead of 'deprec' namespace of capistrano
|
|
9
|
+
tasks one must use 'centos', everything else should be the same as
|
|
10
|
+
original deprec, so original deprec info files are included too.
|
|
11
|
+
|
|
12
|
+
Currently Centostrano supports CentOS 5.1 and 5.2.
|
|
13
|
+
|
|
14
|
+
Gitosis and PostgreSQL installation and setup scripts are added
|
|
15
|
+
|
|
16
|
+
Any feedback is welcome!
|
|
17
|
+
|
|
18
|
+
== Credits
|
|
19
|
+
|
|
20
|
+
Saulius Grigaitis: porter and maintainer of Centostrano
|
|
21
|
+
Mike Bailey: Original creator of deprec 2
|
|
22
|
+
|
|
23
|
+
== Links
|
|
24
|
+
|
|
25
|
+
Centostrano homepage: http://rubyonrails.lt/redmine/projects/show/centostrano
|
|
26
|
+
Centostrano at github: http://www.rubyonrails.lt/centostrano
|
|
27
|
+
Centostrano at rubyforge: http://rubyforge.org/projects/centostrano/
|
|
28
|
+
|
|
29
|
+
== Original deprec 2 README
|
|
30
|
+
|
|
31
|
+
------------------------------------------
|
|
32
|
+
deprec - Deployment Recipes for Capistrano
|
|
33
|
+
------------------------------------------
|
|
34
|
+
|
|
35
|
+
== Introduction
|
|
36
|
+
|
|
37
|
+
The deprec [1] gem is a set of tasks for Capistrano [2]. These tasks provide
|
|
38
|
+
for the installation, configuration and control of system services. Deprec
|
|
39
|
+
was created in 2006 by Mike Bailey to setup an environment for running Ruby
|
|
40
|
+
on Rails web applications on Ubuntu dapper servers. Since then its uses have
|
|
41
|
+
grown to installing mail, monitoring, high availability IP failover and other
|
|
42
|
+
services.
|
|
43
|
+
|
|
44
|
+
The tasks are run at the command line on your workstation and connect to
|
|
45
|
+
remote servers via ssh to run commands and copy out files.
|
|
46
|
+
|
|
47
|
+
Deprec-2.x is a complete rewrite of the project that achieves the following:
|
|
48
|
+
|
|
49
|
+
- support for Capistrano 2
|
|
50
|
+
- support for more services (heartbeat, nagios, nginx, ntp, postfix, etc)
|
|
51
|
+
- creation of a standard base set of task names
|
|
52
|
+
- tasks are cleanly separated into namespaced units (one file per service)
|
|
53
|
+
- service config files are stored locally to enable edits and version control
|
|
54
|
+
- interactive prompting for missing config values
|
|
55
|
+
|
|
56
|
+
One idea that is in the trash can is supporting other distros/OS's. While I got
|
|
57
|
+
caught up in the excitement of The Big Rewrite I've decided I don't need it. If
|
|
58
|
+
you want to deploy to something other than Ubuntu I suggest you look for other
|
|
59
|
+
alternatives.
|
|
60
|
+
|
|
61
|
+
Deprec and Capistrano are written in the Ruby programming language [3] however
|
|
62
|
+
no knowledge of Ruby is required to use it. Users should be able to write
|
|
63
|
+
new tasks and modify existing options without prior knowledge of Ruby.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
== Installation
|
|
67
|
+
|
|
68
|
+
Deprec can be obtained from rubyforge[4] and installed using rubygems[5].
|
|
69
|
+
|
|
70
|
+
sudo gem install deprec # installs deprec and dependancies
|
|
71
|
+
cap depify . # creates ~/.caprc which you may edit
|
|
72
|
+
cap -T # should list lots of deprec tasks
|
|
73
|
+
|
|
74
|
+
The .caprc file is loaded every time you use Capistrano. It in turn loads
|
|
75
|
+
the deprec tasks so you always have them available. Editing the .caprc file
|
|
76
|
+
in your home directory allows you to specify the location of your ssh key
|
|
77
|
+
and enable some other useful options (documented in the comments). You can
|
|
78
|
+
also put tasks here that you want to always have access to.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
== Getting a Ruby on Rails app running on a fresh Ubuntu server
|
|
82
|
+
|
|
83
|
+
This is still what brings people to deprec. You can install a full Rails stack
|
|
84
|
+
and get multiple apps running on it in much less time than it would take to
|
|
85
|
+
do it manually. Think an hour vs. a weekend. (The irony is I'm up writing this
|
|
86
|
+
on a Saturday night.)
|
|
87
|
+
|
|
88
|
+
export HOSTS=<target.host.name>
|
|
89
|
+
|
|
90
|
+
# Install Rails stack
|
|
91
|
+
cap deprec:rails:install_rails_stack
|
|
92
|
+
|
|
93
|
+
# Install mysql (if it's running on the same box)
|
|
94
|
+
cap deprec:mysql:install
|
|
95
|
+
cap deprec:mysql:config_gen
|
|
96
|
+
cap deprec:mysql:config
|
|
97
|
+
|
|
98
|
+
# Install your Rails app
|
|
99
|
+
cap deploy:setup
|
|
100
|
+
cap deploy
|
|
101
|
+
cap deprec:db:create
|
|
102
|
+
cap deprec:db:migrate
|
|
103
|
+
cap deprec:nginx:restart
|
|
104
|
+
cap deprec:mongrel:restart
|
|
105
|
+
|
|
106
|
+
You can find documentation on the deprec site. http://www.deprec.org/
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
== Installing other things
|
|
110
|
+
|
|
111
|
+
I plan to document other things I use deprec for on http://www.deprec.org/.
|
|
112
|
+
Feel free to poke around and see what's there. I use deprec to provision and
|
|
113
|
+
manage servers so you might find some things in there I haven't documented. Lucky you.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
== Disclaimer
|
|
117
|
+
|
|
118
|
+
The tasks run commands that may make changes to your workstation and remote server.
|
|
119
|
+
You are advised to read the source and use at your own risk.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
== Credits
|
|
123
|
+
|
|
124
|
+
Deprec is written and maintained by Mike Bailey <mike@bailey.net.au>.
|
|
125
|
+
More about me here: [http://mike.bailey.net.au/]
|
|
126
|
+
|
|
127
|
+
Deprec was inspired and uses the brilliantly executed Capistrano. Thanks Jamis!
|
|
128
|
+
This gem includes a modified copy of Neil Wilson's very useful vmbuilder_plugins gem.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
== Thanks
|
|
132
|
+
|
|
133
|
+
Eric Harris-Braun: great testing, bug reports and suggestions
|
|
134
|
+
Gus Gollings: helped restore www.deprec.org
|
|
135
|
+
Craig Ambrose: testing, documentation and beer
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
== License
|
|
139
|
+
|
|
140
|
+
Deprec is licenced under the GPL. This means that you can use it in commercial
|
|
141
|
+
or open source applications. More details found here:
|
|
142
|
+
http://www.gnu.org/licenses/gpl.html
|
|
143
|
+
|
|
144
|
+
deprec - deployment recipes for capistrano
|
|
145
|
+
Copyright (C) 2006-2008 Mike Bailey
|
|
146
|
+
|
|
147
|
+
This program is free software; you can redistribute it and/or
|
|
148
|
+
modify it under the terms of the GNU General Public License
|
|
149
|
+
as published by the Free Software Foundation; either version 2
|
|
150
|
+
of the License, or (at your option) any later version.
|
|
151
|
+
|
|
152
|
+
This program is distributed in the hope that it will be useful,
|
|
153
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
154
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
155
|
+
GNU General Public License for more details.
|
|
156
|
+
|
|
157
|
+
You should have received a copy of the GNU General Public License
|
|
158
|
+
along with this program; if not, write to the Free Software
|
|
159
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
[1] http://www.deprec.org
|
|
163
|
+
[2] http://www.capify.org
|
|
164
|
+
[3] http://www.ruby-lang.org/en/
|
|
165
|
+
[4] http://rubyforge.org/
|
|
166
|
+
[5] http://rubygems.org/
|
data/THANKS
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Big thanks go to the following people. Apologies to any I have missed! - Mike
|
|
2
|
+
|
|
3
|
+
20080226 Chris Turner for an excellent HOWTO http://crackthenut.cracklabs.com/deprec2-your-slice-from-windows/
|
|
4
|
+
20080206 Eric Harris-Braun for some great testing, bug reports and suggestions.
|
|
5
|
+
20071004 Gus Gollings for helping restore www.deprec.org
|
data/bin/centify
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'optparse'
|
|
4
|
+
|
|
5
|
+
OptionParser.new do |opts|
|
|
6
|
+
opts.banner = "Usage: #{File.basename($0)} [path]"
|
|
7
|
+
|
|
8
|
+
opts.on("-h", "--help", "Displays this help info") do
|
|
9
|
+
puts opts
|
|
10
|
+
exit 0
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
begin
|
|
14
|
+
opts.parse!(ARGV)
|
|
15
|
+
rescue OptionParser::ParseError => e
|
|
16
|
+
warn e.message
|
|
17
|
+
puts opts
|
|
18
|
+
exit 1
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if ARGV.empty?
|
|
23
|
+
abort "Please specify the directory to centify, e.g. `#{File.basename($0)} .'"
|
|
24
|
+
elsif !File.exists?(ARGV.first)
|
|
25
|
+
abort "`#{ARGV.first}' does not exist."
|
|
26
|
+
elsif !File.directory?(ARGV.first)
|
|
27
|
+
abort "`#{ARGV.first}' is not a directory."
|
|
28
|
+
elsif ARGV.length > 1
|
|
29
|
+
abort "Too many arguments; please specify only the directory to centify."
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def unindent(string)
|
|
33
|
+
indentation = string[/\A\s*/]
|
|
34
|
+
string.strip.gsub(/^#{indentation}/, "")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
caprc = unindent(<<-FILE)
|
|
39
|
+
# .caprc - Capistrano configs (added by deprec gem [www.deprec.org])
|
|
40
|
+
#
|
|
41
|
+
# Include settings that you want active whenever you use Capistrano
|
|
42
|
+
# You can over ride these for particular projects by putting entries
|
|
43
|
+
# into Capfile or deploy.rb for those projects
|
|
44
|
+
#
|
|
45
|
+
# Uncomment any of the following entries to enable them.
|
|
46
|
+
#
|
|
47
|
+
# Include deprec - deployment recipes for Capistrano (www.deprec.org)
|
|
48
|
+
#
|
|
49
|
+
# require 'deprec'
|
|
50
|
+
#
|
|
51
|
+
require 'centostrano'
|
|
52
|
+
#
|
|
53
|
+
# SSH options
|
|
54
|
+
#
|
|
55
|
+
# Use ssh keys instead of typing password every time
|
|
56
|
+
# Replace with the path to your ssh public key
|
|
57
|
+
# ssh_options[:keys] = %w(/path/to/your_home_dir/.ssh/id_rsa)
|
|
58
|
+
#
|
|
59
|
+
# Allow ssh keys to be forwarded (to scm server, through :gateway, etc)
|
|
60
|
+
# ssh_options[:forward_agent] = true
|
|
61
|
+
#
|
|
62
|
+
# Stop some annoying warnings
|
|
63
|
+
# ssh_options[:paranoid] = false
|
|
64
|
+
FILE
|
|
65
|
+
|
|
66
|
+
files = {
|
|
67
|
+
"Capfile" => unindent(<<-FILE),
|
|
68
|
+
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
|
69
|
+
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
|
70
|
+
Dir['config/*/recipes.rb'].each { |plugin| load(plugin) }
|
|
71
|
+
load 'config/deploy'
|
|
72
|
+
FILE
|
|
73
|
+
|
|
74
|
+
"config/deploy.rb" => unindent(<<-FILE),
|
|
75
|
+
require 'centostrano'
|
|
76
|
+
|
|
77
|
+
set :application, "set your application name here"
|
|
78
|
+
set :domain, "set domain name project will be served on here"
|
|
79
|
+
set :repository, "git@\#{domain}:\#{application}.git"
|
|
80
|
+
# set :gems_for_project, %w(dr_nic_magic_models swiftiply) # list of gems to be installed
|
|
81
|
+
|
|
82
|
+
# Update these if you're not running everything on one host.
|
|
83
|
+
role :app, domain
|
|
84
|
+
role :web, domain
|
|
85
|
+
role :db, domain, :primary => true
|
|
86
|
+
role :scm, domain # used by deprec if you want to install subversion
|
|
87
|
+
|
|
88
|
+
default_run_options[:pty] = true
|
|
89
|
+
|
|
90
|
+
# If you aren't deploying to /var/www/apps/\#{application} on the target
|
|
91
|
+
# servers (which is the deprec default), you can specify the actual location
|
|
92
|
+
# via the :deploy_to variable:
|
|
93
|
+
# set :deploy_to, "/var/www/\#{application}"
|
|
94
|
+
|
|
95
|
+
# If you aren't using Subversion to manage your source code, specify
|
|
96
|
+
# your SCM below:
|
|
97
|
+
set :scm, :git
|
|
98
|
+
|
|
99
|
+
namespace :deploy do
|
|
100
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
|
101
|
+
top.centos.mongrel.restart
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
FILE
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
def create_file(file, content)
|
|
109
|
+
if !File.exists?(File.dirname(file))
|
|
110
|
+
puts "[add] creating directory `#{File.dirname(file)}'"
|
|
111
|
+
Dir.mkdir(File.dirname(file))
|
|
112
|
+
end
|
|
113
|
+
if File.exists?(file)
|
|
114
|
+
warn "[skip] `#{file}' already exists"
|
|
115
|
+
elsif File.exists?(file.downcase)
|
|
116
|
+
warn "[skip] `#{file.downcase}' exists, which could conflict with `#{file}'"
|
|
117
|
+
else
|
|
118
|
+
puts "[add] writing `#{file}'"
|
|
119
|
+
File.open(file, "w") { |f| f.write(content) }
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
create_file(File.join(ENV['HOME'], '.caprc'), caprc)
|
|
124
|
+
|
|
125
|
+
base = ARGV.shift
|
|
126
|
+
config_dir = File.join(base,'config')
|
|
127
|
+
if File.directory?(config_dir)
|
|
128
|
+
files.each do |file, content|
|
|
129
|
+
create_file(File.join(base, file), content)
|
|
130
|
+
end
|
|
131
|
+
else
|
|
132
|
+
warn "[warn] directory `#{config_dir}' does not exist"
|
|
133
|
+
warn "[skip] '#{base}/Capfile'"
|
|
134
|
+
warn "[skip] '#{base}/config/deploy.rb'"
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
puts "[done] centified!"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
== Configuration
|
|
2
|
+
|
|
3
|
+
deprec2 has a two stage process for generating/deploying configuration files.
|
|
4
|
+
Configuration files for web, app, db servers (and more) are generated from
|
|
5
|
+
templates and put under the config/ tree in your Rails apps source tree.
|
|
6
|
+
Alternatively you could create a non-rails-app tree to hold them. The second
|
|
7
|
+
stage is pushing the files out to the destination servers. This used to be a
|
|
8
|
+
one stage process in deprec1 however the change has been made so that:
|
|
9
|
+
|
|
10
|
+
- all config files for a project can be kept under source control
|
|
11
|
+
- you can make changes to config files that are not available through deprec
|
|
12
|
+
|
|
13
|
+
Many of the settings in these config files are based on values in the projects
|
|
14
|
+
deploy.rb file. Others reflect defaults in deprec that you can override by adding
|
|
15
|
+
fields to deploy.rb. This means you may never need to edit the generated config
|
|
16
|
+
files directly. You can generate a set of config files with the following:
|
|
17
|
+
|
|
18
|
+
cap deprec:nginx:config_gen # generates config files for trac from templates
|
|
19
|
+
|
|
20
|
+
config_gen is re-runnable and will prompt you before overwriting a file. It will
|
|
21
|
+
also show you what changes overwriting would make (in diff format) to help you
|
|
22
|
+
decide whether you want it to do so.
|
|
23
|
+
|
|
24
|
+
Changes to service configuration should never be made on the server. Deprec
|
|
25
|
+
acknowledges this by offering no assistance to people who want to copy config
|
|
26
|
+
files back from servers. But pushing the files out couldn't be simpler!
|
|
27
|
+
|
|
28
|
+
cap deprec:nginx:config # pushes out all config files for trac
|
|
29
|
+
|
|
30
|
+
deprec2 takes into consideration the fact that that some services are used to
|
|
31
|
+
host more than one application. For example, a webserver will often have one
|
|
32
|
+
main configuration and a number of virtual host configurations. Monit has a
|
|
33
|
+
single config file (/etc/monitrc) but will also load other configs it finds in
|
|
34
|
+
a certain directory (/etc/monit.d).
|
|
35
|
+
|
|
36
|
+
When you deploy a Ruby on Rails app with deprec it drops configs for your project
|
|
37
|
+
into the config/ directory for your project and symlinks them into a shared path
|
|
38
|
+
on the server. This means you can install multiple apps on a remote server and
|
|
39
|
+
they shouldn't stop on each other.
|
|
40
|
+
|
|
41
|
+
== Extra services
|
|
42
|
+
|
|
43
|
+
- nginx
|
|
44
|
+
- monit
|
|
45
|
+
- postfix
|
|
46
|
+
- nagios
|
|
47
|
+
- more...
|
data/docs/README.install
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
== Installation and initial setup for deprec2
|
|
2
|
+
|
|
3
|
+
Install deprec with the following command (requires ruby and rubygems installed)
|
|
4
|
+
|
|
5
|
+
sudo gem install deprec
|
|
6
|
+
|
|
7
|
+
Let's create a directory to manage all our host config details
|
|
8
|
+
This supports as many hosts as you need to manage and will be the dir
|
|
9
|
+
you run your deprec commands from when managing the servers. Note that
|
|
10
|
+
you don't need to do this if you just want to deploy a single Ruby on
|
|
11
|
+
Rails application. In this case the config/ dir in your project can
|
|
12
|
+
serve the same purpose. For those who aren't interested in Ruby on Rails
|
|
13
|
+
or want to use deprec for more than just deploying one rails app, the
|
|
14
|
+
following may come in handy.
|
|
15
|
+
|
|
16
|
+
mkdir -p sys/config # change 'sys' to whatever you want
|
|
17
|
+
cd sys #
|
|
18
|
+
depify . # create Capfile and config/deploy.rb
|
|
19
|
+
cap deprec:ssh:config_gen # generates ssh server configs
|
|
20
|
+
|
|
21
|
+
If you have an authorized_keys file, copy it to a location where deprec
|
|
22
|
+
can find it. Deprec will then offer to copy it out to remote hosts when
|
|
23
|
+
you setup new accounts for yourself. If you don't have authorized_keys,
|
|
24
|
+
copy out your id_rsa.pub or id_dsa.pub.
|
|
25
|
+
|
|
26
|
+
You can also put the authorized_keys of colleagues in this dir and deprec
|
|
27
|
+
will offer to copy them out when creating accounts for them too.
|
|
28
|
+
|
|
29
|
+
We name these files using the username of their owner.
|
|
30
|
+
|
|
31
|
+
cp ~/.ssh/authorized_keys config/ssh/authorized_keys/${USER}
|
|
32
|
+
|
|
33
|
+
Define an environment variable for the server we'll be working on
|
|
34
|
+
|
|
35
|
+
export HOSTS=<your.slice.address>
|
|
36
|
+
|
|
37
|
+
Change the root password you received for your new slice.
|
|
38
|
+
|
|
39
|
+
cap deprec:users:passwd USER=root
|
|
40
|
+
|
|
41
|
+
Enter user to change password for |root|
|
|
42
|
+
Password:
|
|
43
|
+
Enter new UNIX password:
|
|
44
|
+
Retype new UNIX password:
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
Create an account with sudo access for mysql^H^Hself
|
|
48
|
+
|
|
49
|
+
cap deprec:users:add USER=root
|
|
50
|
+
|
|
51
|
+
Enter userid for new user |root|
|
|
52
|
+
mbailey
|
|
53
|
+
Should this be an admin account? |no|
|
|
54
|
+
yes
|
|
55
|
+
I've found an authorized_keys file for mbailey. Should I copy it out? |yes|
|
|
56
|
+
Password:
|
|
57
|
+
Setting pasword for new account
|
|
58
|
+
Enter new UNIX password:
|
|
59
|
+
Retype new UNIX password:
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Create another account without sudo access for a colleague.
|
|
63
|
+
Notice how I longer need to specify USER=root? That's because I'm using the
|
|
64
|
+
account I just created.
|
|
65
|
+
|
|
66
|
+
cap deprec:users:add
|
|
67
|
+
|
|
68
|
+
Enter userid for new user |mbailey|
|
|
69
|
+
ben
|
|
70
|
+
Should this be an admin account? |no|
|
|
71
|
+
Password:
|
|
72
|
+
Setting pasword for new account
|
|
73
|
+
Enter new UNIX password:
|
|
74
|
+
Retype new UNIX password:
|
|
75
|
+
|
|
76
|
+
I prefer to disallow ssh password based login for security reasons. I also
|
|
77
|
+
turn off DNS lookups by sshd as they are often responsible for a 2 second
|
|
78
|
+
lag on login. Be warned that turning off ssh passwords will prevent someone
|
|
79
|
+
without an ssh key setup from logging in so use this with caution. Deprec
|
|
80
|
+
makes it painless to upload their key when you create their account though
|
|
81
|
+
so you've got no excuse to leave passwords turned on.
|
|
82
|
+
|
|
83
|
+
You can upload the ssh configs currently residing in config/ssh/etc/ssh by
|
|
84
|
+
running this:
|
|
85
|
+
|
|
86
|
+
cap deprec:ssh:config
|
|
87
|
+
|
|
88
|
+
You can now continue to the other READMEs
|