deprec 1.7.1 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,8 +61,13 @@ Capistrano.configuration(:must_exist).load do
61
61
  send(run_method, "#{apache_ctl} start")
62
62
  end
63
63
 
64
+
64
65
  desc "Restart Apache "
65
- task :restart_apache, :roles => :web do
66
+ task :apache_restart, :roles => :web do
67
+ restart_apache
68
+ end
69
+
70
+ task :restart_apache, :roles => :web do # deprecated
66
71
  send(run_method, "#{apache_ctl} restart")
67
72
  end
68
73
 
@@ -5,7 +5,8 @@ require 'capistrano/cli'
5
5
  module MySQLMethods
6
6
 
7
7
  def execute(sql, user)
8
- run "mysql --user=root -p --execute=\"#{sql}\"" do |channel, stream, data|
8
+ user = 'root'
9
+ run "mysql --user=#{user} -p --execute=\"#{sql}\"" do |channel, stream, data|
9
10
  handle_mysql_password(user, channel, stream, data)
10
11
  end
11
12
  end
@@ -45,10 +46,15 @@ Capistrano.configuration(:must_exist).load do
45
46
  task :setup_mysql, :roles => :db, :only => { :primary => true } do
46
47
  # on_rollback {}
47
48
 
49
+ # rails puts "socket: /tmp/mysql.sock" into config/database.yml
50
+ # this is not the location for our ubuntu's mysql socket file
51
+ # so we create this link to make depployment using rails defaults simpler
52
+ sudo "sudo ln -sf /var/run/mysqld/mysqld.sock /tmp/mysql.sock"
53
+
48
54
  set_mysql_admin
49
55
  read_config
50
56
 
51
- sql = "CREATE DATABASE #{db_name};"
57
+ sql = "CREATE DATABASE IF NOT EXISTS #{db_name};"
52
58
  sql += "GRANT ALL PRIVILEGES ON #{db_name}.* TO #{db_user}@localhost IDENTIFIED BY '#{db_password}';"
53
59
  mysql.execute sql, mysql_admin
54
60
  end
@@ -46,7 +46,7 @@ RequestHeader set X-Forwarded-Proto "https"
46
46
  RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L]
47
47
 
48
48
  # Deflate
49
- AddOutputFilterByType DEFLATE text/html text/plain text/xml
49
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
50
50
  BrowserMatch ^Mozilla/4 gzip-only-text/html
51
51
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
52
52
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
@@ -47,7 +47,7 @@
47
47
  RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L]
48
48
 
49
49
  # Deflate
50
- AddOutputFilterByType DEFLATE text/html text/plain text/xml
50
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
51
51
  BrowserMatch ^Mozilla/4 gzip-only-text/html
52
52
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
53
53
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: deprec
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.7.1
7
- date: 2007-05-23 00:00:00 -07:00
6
+ version: 1.8.0
7
+ date: 2007-06-22 00:00:00 +10:00
8
8
  summary: deployment recipes for capistrano
9
9
  require_paths:
10
10
  - lib
@@ -31,15 +31,18 @@ authors: []
31
31
  files:
32
32
  - bin/deprec
33
33
  - docs/building_edge_capistrano.txt
34
- - docs/old_homepage.txt
34
+ - docs/README.quickstart
35
35
  - docs/README.slicehost
36
+ - docs/README.svn_trac
36
37
  - lib/deprec
37
38
  - lib/deprec/capistrano_extensions
38
39
  - lib/deprec/generators
39
40
  - lib/deprec/recipes
40
41
  - lib/deprec/recipes.rb
42
+ - lib/deprec/templates
41
43
  - lib/deprec/third_party
42
44
  - lib/deprec/capistrano_extensions/actor_extensions.rb
45
+ - lib/deprec/capistrano_extensions/cli_extensions.rb
43
46
  - lib/deprec/capistrano_extensions/deprec_extensions.rb
44
47
  - lib/deprec/generators/deprec
45
48
  - lib/deprec/generators/loader.rb
@@ -47,17 +50,16 @@ files:
47
50
  - lib/deprec/generators/deprec/templates
48
51
  - lib/deprec/generators/deprec/USAGE
49
52
  - lib/deprec/generators/deprec/templates/deploy.rb
53
+ - lib/deprec/recipes/apache.rb
50
54
  - lib/deprec/recipes/cache_svn.rb
55
+ - lib/deprec/recipes/memcache.rb
51
56
  - lib/deprec/recipes/ssh.rb
52
57
  - lib/deprec/recipes/svn.rb
53
- - lib/deprec/recipes/templates
54
58
  - lib/deprec/recipes/trac.rb
55
59
  - lib/deprec/recipes/ubuntu.rb
56
60
  - lib/deprec/recipes/vmware.rb
57
- - lib/deprec/recipes/wordpress.rb
58
- - lib/deprec/recipes/templates/interfaces.rhtml
59
- - lib/deprec/recipes/templates/postfix_main.conf
60
- - lib/deprec/recipes/templates/test_template.rhtml
61
+ - lib/deprec/templates/postfix_main.conf
62
+ - lib/deprec/templates/trac.ini.erb
61
63
  - lib/deprec/third_party/mongrel_cluster
62
64
  - lib/deprec/third_party/railsmachine
63
65
  - lib/deprec/third_party/THIRD_PARTY_README
@@ -70,7 +72,6 @@ files:
70
72
  - lib/deprec/third_party/railsmachine/recipes
71
73
  - lib/deprec/third_party/railsmachine/recipes/apache.rb
72
74
  - lib/deprec/third_party/railsmachine/recipes/mysql.rb
73
- - lib/deprec/third_party/railsmachine/recipes/svn.rb
74
75
  - lib/deprec/third_party/railsmachine/recipes/templates
75
76
  - lib/deprec/third_party/railsmachine/recipes/templates/httpd-ssl.conf
76
77
  - lib/deprec/third_party/railsmachine/recipes/templates/httpd.conf
@@ -1,172 +0,0 @@
1
- <pre>
2
- ---------------------------
3
- deprec - Deployment Recipes
4
- ---------------------------
5
-
6
- QUICKSTART
7
-
8
- To get your rails app running on a stock standard Ubuntu 6.06 server:
9
-
10
- cd /path/to/railsapp
11
- deprec --apply-to . --name projectname --domain www.projectname.com
12
- # edit config/deploy.rb to put in details of your subversion repository
13
- cap install_rails_stack
14
- cap setup
15
- cap deploy_with_migrations
16
- cap restart_apache
17
-
18
- Read on for installation and usage instructions.
19
-
20
-
21
- WHAT DEPREC IS
22
-
23
- Deprec is a collection of automated recipes, written in ruby, for setting
24
- up production ready rails servers. The idea is, even if it takes longer to
25
- write a general recipe for your situation, rather than just doing it by hand,
26
- it's well worth the effort because you get a reliable and reproducible
27
- deployment that will work just as well even if it's 3am and a human would be
28
- liable to make mistakes with live webservers.
29
-
30
- You also get the advantage of a further set of conventions, which means that
31
- other tools that you write can build on these conventions, in the same way
32
- that the conventions that we already have amongst rails and capistrano users
33
- benefit us when writing plugins and gems.
34
-
35
- Deprec is designed to take a raw server, and set it up with current best
36
- practices for a production web server. This currently means Apache 2.2 for
37
- load balancing and static content, and Mongrel for serving rails. Other
38
- alternatives can be added later, providing a convention over configuration
39
- approach is followed. Version 1.0 of deprec contains recipes specifically
40
- for default installations of Ubuntu 6.06 (server), although it also contains
41
- tasks which will allow it to be used on slightly non-standard ubuntu
42
- installations, such as those provided by slicehost.com.
43
-
44
- Deprec has been tested on live VPS hosts with real production sites. It works
45
- for me, if it doesn't work for you, then it's easy to extend.
46
-
47
-
48
- WHAT DEPREC ISN'T
49
-
50
- Deprec isn't an attempt to solve all problems on all servers. I am solving
51
- my own deployment problems, and providing a general framework to help you
52
- solve yours. Submissions of recipes for other linux distributions, and maybe
53
- even other operating systems, will be accepted and included. If this is
54
- popular, some work may be done to allow your own recipes to be managed as individual gems, dependent on the deprec gem.
55
-
56
-
57
- CREDITS
58
-
59
- Deprec is written and maintained by Mike Bailey <mike@bailey.net.au>.
60
- More about me here: http://codemode.blogspot.com/
61
-
62
- Deprec was inspired and uses the brilliantly executed Capistrano. Thanks Jamis!
63
-
64
- After starting on this project I found myself reading and utilizing a lot of
65
- code by Bradley Taylor, in particular the RailsMachine and VMbuilder gems.
66
-
67
- Neil Wilson wrote three capistrano plugins that are used in this project.
68
-
69
- I'd like to say a huge thanks to these guys for helping make my work easier!
70
-
71
- For the first cut I have included all third party code in a directory within
72
- the deprec gem, rather than link to the gems themselves. I made this decision
73
- to prevent deprec from breaking due to a change in one of the other libraries.
74
-
75
- Thanks to Craig Ambrose for help with testing, documentation and beer.
76
-
77
-
78
- LICENCE
79
-
80
- Deprec is licenced under the LGPL. This means that you can use it in commercial
81
- or open source applications. More details found here:
82
- http://www.gnu.org/licenses/lgpl.html
83
-
84
- deprec - deployment recipes for capistrano
85
- Copyright (C) 2006 Mike Bailey
86
-
87
- This library is free software; you can redistribute it and/or
88
- modify it under the terms of the GNU Lesser General Public
89
- License as published by the Free Software Foundation; either
90
- version 2.1 of the License, or (at your option) any later version.
91
-
92
- This library is distributed in the hope that it will be useful,
93
- but WITHOUT ANY WARRANTY; without even the implied warranty of
94
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95
- Lesser General Public License for more details.
96
-
97
- You should have received a copy of the GNU Lesser General Public
98
- License along with this library; if not, write to the Free Software
99
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
100
-
101
-
102
- USAGE
103
-
104
- The following instructions describe how to use deprec. Please note that the
105
- initial step, installing deprec on your workstation, will patch your copy of
106
- capistrano to allow capistrano directives to be placed in a local configuration
107
- file ~/.caprc. This patch has been accepted into capistrano and will be
108
- available in a later release. The deprec_dotfiles command will not harm future
109
- versions of capistrano that already contain this functionality.
110
-
111
- Most of the magic of deprec occurs in the install_rails_stack section. This
112
- builds the server, which developers previously had to do by hand, or find a
113
- hosting company that did it for them. Once that is done, deprec also adds
114
- application specific helper tasks, which are shown below in the "deploy a
115
- rails app to hosts" section.
116
-
117
- Please note that the "deprec --apply-to" command is much like the
118
- "cap --apply-to" command, except that it creates a deploy.rb file in your
119
- application's config directory with more available settings than capistrano
120
- uses, because these settings can be used to configure the application specific
121
- aspects of apache and mongrel.
122
-
123
- Important Note:
124
- Running "deprec --apply-to" currently overwrites your existing deploy.rb file.
125
- If you have deployed the app elsewhere before, you may want to backup this file
126
- so that you can refer to it when setting up your deprec generated deploy.rb.
127
- Because deprec sets up the server, it can fill in more sensible defaults than
128
- capistrano normally does, but there are still a few settings that you need to
129
- set yourself. Future versions of deprec will not overwrite this file
130
- automatically, but will move it out of the way first.
131
-
132
- ## install deprec on workstation
133
- #
134
- sudo gem install deprec -y # installs what you need
135
- deprec_dotfiles # patches capistrano + creates your ~/.caprc
136
- cap show_tasks # now you have deprec tasks included
137
-
138
-
139
- ## install rails stack
140
- #
141
- # this currently only works with ubuntu 6.06.1 server installed
142
- # you need to have an account on this machine and sudo access
143
- #
144
- export HOSTS=r01,r02,r03 # define some hosts to mess with
145
- cap setup_ssh_keys # copy out your public keys
146
- cap install_rails_stack # install apache, rubygems, mongrel, rails, etc.
147
- unset HOSTS # stop overriding cap's hosts list
148
-
149
-
150
- ## deploy a rails app to hosts
151
- #
152
- # setup dns for your domain or put an entry in /etc/hosts
153
- cd /path/to/app
154
- deprec --apply-to . --name bailey --domain bailey.net.au
155
- cap setup
156
- # put svn details in config/deploy.rb
157
- # or run 'cap setup_scm' to import project
158
- cap deploy_with_migrations
159
- cap restart_apache
160
-
161
- # update rails app on hosts
162
- cap deploy
163
- cap deploy_with_migrations
164
-
165
-
166
- ## some handy tools
167
- #
168
- cap show_tasks
169
- cap disable_web, enable_web # puts up maintenance page
170
- cap restart_mongrel_cluster # does what it says
171
-
172
- </pre>
@@ -1,19 +0,0 @@
1
- # This file describes the network interfaces available on your system
2
- # and how to activate them. For more information, see interfaces(5).
3
-
4
- # The loopback network interface
5
- auto lo
6
- iface lo inet loopback
7
-
8
- # The primary network interface
9
- <% ethernet_interfaces.each do |eth| %>
10
- auto eth<%= eth[:num] %>
11
- iface eth0 inet <%= eth[:type] %>
12
- <% if eth[:type] == 'static' %>
13
- address <%= eth[:ipaddr] %>
14
- netmask <%= eth[:netmask] %>
15
- gateway <%= eth[:gateway] %>
16
- # dns-* options are implemented by the resolvconf package, if installed
17
- dns-nameservers <%= eth[:dns1] %><%= ",#{eth[:dns2]}" if defined?(eth[:dns2]) %>
18
- <% end %>
19
- <% end %>
@@ -1 +0,0 @@
1
- foo = <%= foo %> and bar = <%= bar %>
@@ -1,23 +0,0 @@
1
- Capistrano.configuration(:must_exist).load do
2
-
3
- set wordpress_db_name, 'wordpress'
4
- set wordpress_db_user, 'wordpress'
5
- set wordpress_db_pass, 'pressing'
6
-
7
-
8
- task :install_wordpress do
9
- version = 'wordpress-2.1.3'
10
- set :src_package, {
11
- :file => version + '.tar.gz',
12
- :md5sum => 'd480bcaff18c4751eda572be878ef7bc wordpress-2.1.3.tar.gz',
13
- :dir => 'wordpress',
14
- :url => "http://wordpress.org/#{version}.tar.gz",
15
- :unpack => "tar zxf #{version}.tar.gz;"
16
- }
17
- deprec.download_src(src_package, src_dir)
18
- deprec.unpack_src(src_package, src_dir)
19
- mysql.create_database(wordpress_db_name, wordpress_db_user, wordpress_db_pass )
20
- end
21
-
22
-
23
- end
@@ -1,45 +0,0 @@
1
- require 'fileutils'
2
- Capistrano.configuration(:must_exist).load do
3
-
4
- desc "create svn repository"
5
- task :svn_create_repos, :roles => :scm do
6
- svn_root ||= '/var/svn'
7
- scm_group ||= 'scm'
8
- deprec.groupadd('scm')
9
- deprec.add_user_to_group(user, scm_group)
10
- deprec.mkdir(svn_root, '2775', scm_group, user)
11
- sudo "svnadmin verify #{svn_root} || sudo svnadmin create #{svn_root}"
12
- end
13
-
14
- desc "Import code into svn repository."
15
- task :svn_import do
16
- new_path = "../#{application}"
17
- tags = repository.sub("trunk", "tags")
18
- branches = repository.sub("trunk", "branches")
19
- puts "Adding branches and tags"
20
- system "svn mkdir -m 'Adding tags and branches directories' #{tags} #{branches}"
21
- puts "Importing application."
22
- system "svn import #{repository} -m 'Import'"
23
- cwd = Dir.getwd
24
- puts "Moving application to new directory"
25
- Dir.chdir '../'
26
- system "mv #{cwd} #{cwd}.imported"
27
- puts "Checking out application."
28
- system "svn co #{repository} #{application}"
29
- Dir.chdir application
30
- puts "removing log directory contents from svn"
31
- system "svn remove log/*"
32
- puts "ignoring log directory"
33
- system "svn propset svn:ignore '*.log' log/"
34
- system "svn update log/"
35
- puts "removing tmp directory from svn"
36
- system "svn remove tmp/"
37
- puts "ignoring tmp directory"
38
- system "svn propset svn:ignore '*' tmp/"
39
- system "svn update tmp/"
40
- puts "committing changes"
41
- system "svn commit -m 'Removed and ignored log files and tmp'"
42
- puts "Your repository is: #{repository}"
43
- end
44
-
45
- end