newrelic-eycap 0.5.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ pkg
@@ -0,0 +1,193 @@
1
+ == 0.5.6 / 2009-6-17
2
+ * updated bundler task so it won't install test or development gems
3
+ * updated database tasks - based on Tyler Poland's update
4
+
5
+ == 0.5.5 / 2009-3-16
6
+ * fixed 2 bugs that are in 0.5.4 with the SSL and bundler recipes
7
+ * use this version with bundler version 0.9.2
8
+
9
+ == 0.5.4 / 2009-3-16
10
+ * fixed gem bundler issue
11
+
12
+ == 0.5.3 / 2009-1-27
13
+ * created task cap ssl:create
14
+ * use this version with bundler version 0.8
15
+
16
+ == 0.5.2 / 2009-12-17
17
+ * renamed task cap slice:tail_production_logs to cap slice:tail_environment_logs
18
+
19
+ == 0.5.1 / 2009-11-12
20
+ * using bundler's cache instead of symlinking on each deploy.
21
+
22
+ == 0.5.0 / 2009-10-07
23
+ * moved from github to gemcutter for hosting.
24
+
25
+ == 0.4.16 / 2009-09-30
26
+ * apps ping weather app before and after each deploy
27
+
28
+ == 0.4.15 / 2009-09-02
29
+ * added include in gemspec for bundler file
30
+
31
+ == 0.4.14 / 2009-08-31
32
+ * restored functionality to remove temporary compressed sql file after db:clone_prod_to_staging
33
+ * renamed gz extension files to bz2 in db:clone_to_local
34
+ * memcached: fix netcat not hanging up on a flush
35
+
36
+ == 0.4.13 / 2009-07-30
37
+ * changed Gemfile to absolute path
38
+ * merged changes from square/master for unshared_remote_cache cached deploy strategy
39
+
40
+ == 0.4.12 / 2009-06-26
41
+ * removed condition for dbhost that was useless and tested db:clone_prod_to_staging
42
+
43
+ == 0.4.11 / 2009-06-25
44
+ * changed nginx start and restart to give output to cap
45
+ * fixed db:clone_to_local task
46
+
47
+ == 0.4.10 / 2009-06-24
48
+ * using nohup on nginx start and restart
49
+
50
+ == 0.4.9 / 2009-06-22
51
+ * added nginx reload, upgrade and configtest - thanks Randy (ydnar)
52
+
53
+ == 0.4.8 / there is no 0.4.8, just like there is no spoon.
54
+
55
+ == 0.4.7 / 2009-05-12
56
+ * fixed bug in clone_prod_to_staging and clone_to_local db tasks for postgres
57
+ where the regex matching the password prompt for the restore was wrong
58
+
59
+ == 0.4.6 / 2009-03-24
60
+ * fixed bug to restore clone_prod_to_staging using the compressed file
61
+
62
+ == 0.4.5 / 2009-03-03
63
+ * happy square root day!
64
+ * added the staging restore to db:clone_prod_to_staging
65
+
66
+ == 0.4.4 / 2009-03-03
67
+ * happy square root day!
68
+ * fixed the *correct* database.rb file for the db:clone_prod_to_staging
69
+
70
+ == 0.4.3 / 2009-02-11
71
+ * updated db:dump command for Engine Yard Solo offering, fixing a bug where
72
+ the dbname wasn't included.
73
+
74
+ == 0.4.2 / 2009-02-11
75
+ * added condition to determine if the db:dump command is run against our
76
+ traditional offering or the new cloud offering
77
+ * fixed bug where if a production db host name doesn't have a -master at the
78
+ end it won't run the db:clone_prod_to_staging correctly
79
+
80
+ == 0.4.1 / 2009-01-09
81
+ * fixed bug for passenger:restart
82
+
83
+ == 0.4.0 / 2009-01-09
84
+ * add passenger:restart task
85
+ * add apache stop, start, restart and reload tasks
86
+ * Don't display database passwords in the logs, output, etc. use stdin instead
87
+
88
+ == 0.3.11 / 2008-11-09
89
+ * filtered_remote_cache uses svn switch
90
+
91
+ == 0.3.9 / 2008-09-29
92
+ * add reindex task for /engineyard/bin/acts_as_sphinx_searchd
93
+ * add reindex and configure task for /engineyard/bin/ultrasphinx_searchd
94
+ * add reindex and configure task for /engineyard/bin/thinking_sphinx_searchd
95
+
96
+ == 0.3.8 / 2008-09-22
97
+ * add PostgreSQL support to the database.rb recipe.
98
+
99
+ == 0.3.7 / 2008-08-23
100
+ * fix from customer for filtered_remote_cache to just use plain grep.
101
+
102
+ == 0.3.6 / 2008-07-17
103
+ * features updated VERSION
104
+
105
+ == 0.3.5 / 2008-07-17
106
+ * filtered_remote_cache uses cached checkout's repository root for comparison for speedier tagged/branched deploys
107
+
108
+ == 0.3.4 / 2008-06-17
109
+ * rake install_gem_no_doc for faster install
110
+ * set role to db for backup_name task
111
+ * add migration support for merb
112
+
113
+ == 0.3.3 / 2008-05-07
114
+ * add ey_logger to log deploys to server
115
+
116
+ == 0.3.2 / 2008-04-29
117
+ * adding db:clone_to_local task to take a dump on the slice, fetch it, and load it into your dev db on your workstation
118
+ * only clone from replica database
119
+ * remove call to variable in task desc
120
+ * fix ferret symlinking
121
+ * gemspec for github
122
+
123
+ == 0.3.1 / 2008-03-17
124
+ * Make the custom maintenance pages actually work!
125
+
126
+ == 0.3.0 / 2008-03-05
127
+ * Adding custom maintenance pages is now as easy as copying a custom html file to #{shared_path}/system/maintenance.html.custom
128
+
129
+ == 0.2.10 / 2008-03-02
130
+ * Symlink memcached.yml only on :memcached => true, except :no_release => true
131
+
132
+ == 0.2.9 / 2008-02-27
133
+ * Fix a bug with ultrasphinx:configure running on multiple hosts
134
+
135
+ == 0.2.8 / 2008-02-20
136
+ * Add tasks for solr starting,stopping, and log tailing.
137
+ * Add monit namespace and make appservers php/merb compatible
138
+ * Make ultrasphinx symlinking a little smarter
139
+ * Add tomcat tasks for spongecell
140
+
141
+ == 0.2.6 / 2008-02-14
142
+ * Make mongrel restarts only apply to mongrel slices
143
+
144
+ == 0.2.5 / 2008-02-11
145
+ * Added db cloning task
146
+
147
+ == 0.2.4 / 2008-02-06
148
+ * Symlink memcached.yml in on deploy if you enable the callback
149
+
150
+ == 0.2.3 / 2008-02-01
151
+ * Make log tailing environmentally aware. Also add tasks to tail mongrel logs
152
+
153
+ == 0.2.2 / 2008-01-25
154
+ * sphinx:configure ultrasphinx configuration task
155
+
156
+ == 0.2.1 / 2008-01-25
157
+ * override default deploy recipe start/stop tasks
158
+
159
+ == 0.2.0 / 2008-01-23
160
+ * sphinx:symlink ultrasphinx configuration directory
161
+
162
+ == 0.1.9 / 2008-01-21
163
+ * Correct memcached tasks.
164
+
165
+ == 0.1.8 / 2008-01-20
166
+ * Add memcached tasks
167
+
168
+ == 0.1.7 / 2008-01-19
169
+ * fix symlink_configs task
170
+
171
+ == 0.1.6 / 2008-01-19
172
+ * add restart tasks for backgroundrb
173
+
174
+ == 0.1.5 / 2008-01-18
175
+ * fixed bug in filtered_remote_cache that prevented a changed checkout URL from taking over the cache
176
+
177
+ == 0.1.4 / 2008-01-17
178
+ * added sphinx:[reindex|start|stop|restart] matches only app servers with :sphinx => true
179
+
180
+ == 0.1.3 / 2008-01-17
181
+ * filtered_remote_cache to removes the cached copy of the source URL changed
182
+
183
+ == 0.1.2 / 2008-01-15
184
+ * added filtered_remote_cache capistrano deployment strategy
185
+
186
+ == 0.1.1 / 2008-01-15
187
+ * removed database tasks until problem with 'defer' is solved
188
+
189
+ == 0.1.0 / 2008-01-14
190
+ * Bugfix for empty :application variable
191
+
192
+ == 0.0.1 / 2008-01-14
193
+ * Initial release
@@ -0,0 +1,30 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb
6
+ lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb
7
+ lib/eycap.rb
8
+ lib/eycap/lib/ey_logger.rb
9
+ lib/eycap/lib/ey_logger_hooks.rb
10
+ lib/eycap/recipes.rb
11
+ lib/eycap/recipes/backgroundrb.rb
12
+ lib/eycap/recipes/database.rb
13
+ lib/eycap/recipes/bundler.rb
14
+ lib/eycap/recipes/deploy.rb
15
+ lib/eycap/recipes/ferret.rb
16
+ lib/eycap/recipes/juggernaut.rb
17
+ lib/eycap/recipes/memcached.rb
18
+ lib/eycap/recipes/mongrel.rb
19
+ lib/eycap/recipes/monit.rb
20
+ lib/eycap/recipes/nginx.rb
21
+ lib/eycap/recipes/slice.rb
22
+ lib/eycap/recipes/solr.rb
23
+ lib/eycap/recipes/sphinx.rb
24
+ lib/eycap/recipes/templates/maintenance.rhtml
25
+ lib/eycap/recipes/tomcat.rb
26
+ lib/eycap/recipes/passenger.rb
27
+ lib/eycap/recipes/apache.rb
28
+ lib/eycap/recipes/ssl.rb
29
+ test/test_eycap.rb
30
+ test/test_helper.rb
@@ -0,0 +1,66 @@
1
+ = eycap
2
+
3
+ == DESCRIPTION:
4
+
5
+ Engine Yard capistrano tasks for use specifically with Engine Yard private cloud slices. They include convenience methods for managed a database, mongrel, nginx or other services.
6
+
7
+ Also included is a deployment strategy, :filtered_remote_cache, which speeds up deployment like :remote_cache, but filters out .svn directory which are a security risk and write slowly to shared disks.
8
+
9
+ == REQUIREMENTS:
10
+
11
+ * capistrano (http://capify.org) > 2.0.0, but recommended with > 2.2.0
12
+
13
+ * NOTE: If you're using a git repository we recommend capistrano 2.5.3 and greater.
14
+
15
+ == INSTALL:
16
+
17
+ $ gem install gemcutter # installs the gemcutter gem
18
+ $ gem tumble # puts gemcutter as your top source
19
+ $ gem install eycap # installs the latest eycap version
20
+
21
+ == SOURCE:
22
+
23
+ eycap's git repo is available on GitHub, which can be browsed at:
24
+
25
+ http://github.com/engineyard/eycap
26
+
27
+ and cloned from:
28
+
29
+ git://github.com/engineyard/eycap.git
30
+
31
+ == USAGE:
32
+
33
+ === Include in capistrano
34
+
35
+ In your deploy.rb, simply include this line at the top:
36
+
37
+ require 'eycap/recipes'
38
+
39
+ === Filtered remote cache
40
+
41
+ To use filtered_remote_cache, simply:
42
+
43
+ set :deploy_via, :filtered_remote_cache
44
+
45
+ == LICENSE:
46
+
47
+ Copyright (c) 2008-2009 Engine Yard
48
+
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of this software and associated documentation files (the
51
+ "Software"), to deal in the Software without restriction, including
52
+ without limitation the rights to use, copy, modify, merge, publish,
53
+ distribute, sublicense, and/or sell copies of the Software, and to
54
+ permit persons to whom the Software is furnished to do so, subject to
55
+ the following conditions:
56
+
57
+ The above copyright notice and this permission notice shall be
58
+ included in all copies or substantial portions of the Software.
59
+
60
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
61
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
62
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
63
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
64
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
65
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
66
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
1
+ require 'rubygems'
2
+ require './lib/eycap'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do | p |
7
+ p.name = 'newrelic-eycap'
8
+ p.version = Eycap::VERSION
9
+ p.author = 'Engine Yard (New Relic)'
10
+ p.email = 'support@newrelic.com'
11
+ p.summary = 'New Relic fork of the Engineyard Capistrano tasks'
12
+ p.description = 'A bunch of useful recipes to help deployment of New Relic applications.'
13
+ p.homepage = 'http://github.com/newrelic/eycap'
14
+ p.add_dependency 'capistrano', '>= 2.15.16'
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{eycap}
3
+ s.version = "0.5.6"
4
+
5
+ s.specification_version = 2 if s.respond_to? :specification_version=
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Engine Yard"]
9
+ s.date = %q{2009-10-07}
10
+ s.description = %q{A bunch of useful recipes to help deployment to the Engine Yard private cloud.}
11
+ s.email = %q{appsupport@engineyard.com}
12
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
13
+ s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb", "lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb", "lib/eycap.rb", "lib/eycap/lib/ey_logger.rb", "lib/eycap/lib/ey_logger_hooks.rb", "lib/eycap/recipes.rb", "lib/eycap/recipes/backgroundrb.rb", "lib/eycap/recipes/database.rb", "lib/eycap/recipes/deploy.rb", "lib/eycap/recipes/ferret.rb", "lib/eycap/recipes/juggernaut.rb", "lib/eycap/recipes/memcached.rb", "lib/eycap/recipes/mongrel.rb", "lib/eycap/recipes/monit.rb", "lib/eycap/recipes/nginx.rb", "lib/eycap/recipes/passenger.rb", "lib/eycap/recipes/slice.rb", "lib/eycap/recipes/solr.rb", "lib/eycap/recipes/sphinx.rb", "lib/eycap/recipes/ssl.rb", "lib/eycap/recipes/templates/maintenance.rhtml", "lib/eycap/recipes/tomcat.rb", "lib/eycap/recipes/apache.rb", "lib/eycap/recipes/bundler.rb", "test/test_eycap.rb", "test/test_helper.rb"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/engineyard/eycap}
16
+ s.rdoc_options = ["--main", "README.txt"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{eycap}
19
+ s.rubygems_version = %q{1.0.1}
20
+ s.summary = %q{Capistrano tasks for Engine Yard private cloud.}
21
+ s.test_files = ["test/test_eycap.rb", "test/test_helper.rb"]
22
+
23
+ s.add_dependency(%q<capistrano>, [">= 2.2.0"])
24
+ s.add_dependency(%q<hoe>, [">= 1.5.1"])
25
+ end
@@ -0,0 +1,57 @@
1
+ require 'capistrano/recipes/deploy/scm/base'
2
+ require 'capistrano/recipes/deploy/strategy/remote'
3
+
4
+ module Capistrano
5
+ module Deploy
6
+ module SCM
7
+ class Subversion < Base
8
+ def switch(revision, checkout)
9
+ "cd #{checkout} && #{scm :switch, verbose, authentication, "-r#{revision}", repository}"
10
+ end
11
+ end
12
+ end
13
+
14
+ module Strategy
15
+
16
+ # Implements the deployment strategy that keeps a cached checkout of
17
+ # the source code on each remote server. Each deploy simply updates the
18
+ # cached checkout, and then filters a copy through tar to remove unwanted .svn directories,
19
+ # finally leaving a pristeen, export-like copy at the destination.
20
+ class FilteredRemoteCache < Remote
21
+ # Executes the SCM command for this strategy and writes the REVISION
22
+ # mark file to each host.
23
+ def deploy!
24
+ update_repository_cache
25
+ tar_copy_repository_cache
26
+ end
27
+
28
+ def check!
29
+ super.check do |d|
30
+ d.remote.writable(shared_path)
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def repository_cache
37
+ configuration[:repository_cache] || "/var/cache/engineyard/#{configuration[:application]}"
38
+ end
39
+
40
+ def update_repository_cache
41
+ logger.trace "checking if the cached copy repository root matches this deploy, then updating it"
42
+ command = "if [ -d #{repository_cache} ] && ! echo '#{configuration[:repository]}' | grep -q `svn info #{repository_cache} | grep 'Repository Root' | awk '{print $3}'`; then " +
43
+ "rm -rf #{repository_cache} && #{source.checkout(revision, repository_cache)}; " +
44
+ "elif [ -d #{repository_cache} ]; then #{source.switch(revision, repository_cache)}; " +
45
+ "else #{source.checkout(revision, repository_cache)}; fi"
46
+ scm_run(command)
47
+ end
48
+
49
+ def tar_copy_repository_cache
50
+ logger.trace "copying and filtering .svn via tar from cached version to #{configuration[:release_path]}"
51
+ run "mkdir #{configuration[:release_path]} && tar c --exclude=#{configuration[:filter_spec] || ".svn"} -C #{repository_cache} . | tar xC #{configuration[:release_path]} && #{mark}"
52
+ end
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,21 @@
1
+ require 'capistrano/recipes/deploy/strategy/remote_cache'
2
+
3
+ module Capistrano
4
+ module Deploy
5
+ module Strategy
6
+ class UnsharedRemoteCache < RemoteCache
7
+ def check!
8
+ super.check do |d|
9
+ d.remote.writable(repository_cache)
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def repository_cache
16
+ configuration[:repository_cache]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module Eycap
2
+ VERSION = '0.5.6.0'
3
+ end
@@ -0,0 +1,125 @@
1
+ require 'tmpdir'
2
+ require 'fileutils'
3
+ module Capistrano
4
+
5
+ class Logger
6
+
7
+ def ey_log(level, message, line_prefix = nil)
8
+ EYLogger.log(level, message, line_prefix) if EYLogger.setup?
9
+ log_without_ey_logging(level, message, line_prefix)
10
+ end
11
+
12
+ unless method_defined?(:log_without_ey_logging)
13
+ alias_method :log_without_ey_logging, :log
14
+ alias_method :log, :ey_log
15
+ end
16
+
17
+ def close
18
+ device.close if @needs_close
19
+ EYLogger.close if EYLogger.setup?
20
+ end
21
+ end
22
+
23
+ class EYLogger
24
+
25
+ # Sets up the EYLogger to beging capturing capistrano's logging. You should pass the capistrno configuration
26
+ # and the deploy type as a string. The deploy type is for reporting purposes only but must be included.
27
+ def self.setup(configuration, deploy_type, options = {})
28
+ @_configuration = configuration
29
+ @_deploy_type = deploy_type.gsub(/:/, "_")
30
+ @_log_path = options[:deploy_log_path] || Dir.tmpdir
31
+ @_log_path << "/" unless @_log_path =~ /\/$/
32
+ FileUtils.mkdir_p(@_log_path)
33
+ @_setup = true
34
+ @_success = true
35
+ end
36
+
37
+ def self.log(level, message, line_prefix=nil)
38
+ return nil unless setup?
39
+ @release_name = @_configuration[:release_name] if @release_name.nil?
40
+ @_log_file_path = @_log_path + @release_name + ".log" unless @_log_file_path
41
+ @_deploy_log_file = File.open(@_log_file_path, "w") if @_deploy_log_file.nil?
42
+
43
+ indent = "%*s" % [Logger::MAX_LEVEL, "*" * (Logger::MAX_LEVEL - level)]
44
+ message.each do |line|
45
+ if line_prefix
46
+ @_deploy_log_file << "#{indent} [#{line_prefix}] #{line.strip}\n"
47
+ else
48
+ @_deploy_log_file << "#{indent} #{line.strip}\n"
49
+ end
50
+ end
51
+ end
52
+
53
+ def self.post_process
54
+ unless ::Interrupt === $!
55
+ puts "\n\nPlease wait while the log file is processed\n"
56
+ # Should dump the stack trace of an exception if there is one
57
+ error = $!
58
+ unless error.nil?
59
+ @_deploy_log_file << error.message << "\n"
60
+ @_deploy_log_file << error.backtrace.join("\n")
61
+ @_success = false
62
+ end
63
+ self.close
64
+
65
+ hooks = [:any]
66
+ hooks << (self.successful? ? :success : :failure)
67
+ puts "Executing Post Processing Hooks"
68
+ hooks.each do |h|
69
+ @_post_process_hooks[h].each do |key|
70
+ @_configuration.parent.find_and_execute_task(key)
71
+ end
72
+ end
73
+ puts "Finished Post Processing Hooks"
74
+ end
75
+ end
76
+
77
+ # Adds a post processing hook.
78
+ #
79
+ # Provide a task name to execute. These tasks are executed after capistrano has actually run its course.
80
+ #
81
+ # Takes a key to control when the hook is executed.'
82
+ # :any - always executed
83
+ # :success - only execute on success
84
+ # :failure - only execute on failure
85
+ #
86
+ # ==== Example
87
+ # Capistrano::EYLogger.post_process_hook( "ey_logger:upload_log_to_slice", :any)
88
+ #
89
+ def self.post_process_hook(task, key = :any)
90
+ @_post_process_hooks ||= Hash.new{|h,k| h[k] = []}
91
+ @_post_process_hooks[key] << task
92
+ end
93
+
94
+ def self.setup?
95
+ !!@_setup
96
+ end
97
+
98
+ def self.deploy_type
99
+ @_deploy_type
100
+ end
101
+
102
+ def self.successful?
103
+ !!@_success
104
+ end
105
+
106
+ def self.failure?
107
+ !@_success
108
+ end
109
+
110
+ def self.log_file_path
111
+ @_log_file_path
112
+ end
113
+
114
+ def self.remote_log_file_name
115
+ @_log_file_name ||= "#{@_configuration[:release_name]}-#{@_deploy_type}-#{self.successful? ? "SUCCESS" : "FAILURE"}.log"
116
+ end
117
+
118
+ def self.close
119
+ @_deploy_log_file.flush unless @_deploy_log_file.nil?
120
+ @_deploy_log_file.close unless @_deploy_log_file.nil?
121
+ @_setup = false
122
+ end
123
+
124
+ end
125
+ end