easy-deployment 0.5.0 → 0.5.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.md +16 -1
- data/easy-deployment.gemspec +2 -1
- data/lib/easy-deployment/version.rb +1 -1
- data/lib/easy/deployment/capistrano.rb +30 -3
- data/lib/easy/generators/backup_generator.rb +11 -9
- data/lib/easy/generators/deployment_generator.rb +14 -13
- data/lib/easy/generators/templates/Capfile +3 -0
- data/lib/easy/generators/templates/backup.rb.tt +2 -1
- data/lib/easy/generators/templates/stage/apache.conf.tt +13 -7
- metadata +5 -3
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
# Changelog for easy-deployment
|
2
2
|
|
3
|
-
## 0.5.
|
3
|
+
## 0.5.1 (2013-05-27)
|
4
|
+
|
5
|
+
Bugfixes:
|
6
|
+
|
7
|
+
* Backup gem requirements for rails 3.2.13 fixed: should be the same as the rails 4 ones, not earlier rails 3 releases
|
8
|
+
* Fixed `cap deploy:initial` for cases where the deploy stage name didn't match the rails_env name
|
9
|
+
* Fixed backup template not pulling the environment specific hash out of database config
|
10
|
+
|
11
|
+
New Features:
|
12
|
+
|
13
|
+
* Tail the rails log of your remote servers (either streaming live or the last N lines) `cap tail:live_logs` + `cap tail:recent logs`
|
14
|
+
* Load the capistrano rails assetpipeline support by default (can be skipped via generator option)
|
15
|
+
* Apache/passenger config template now sets `PassengerMinInstances` and provides some disabled example tuning options
|
16
|
+
* Specified license in the gemspec
|
17
|
+
|
18
|
+
## 0.5.0 - 2013-04-05
|
4
19
|
|
5
20
|
Large rewrite of both templates, and generator code.
|
6
21
|
|
data/easy-deployment.gemspec
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/easy-deployment/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Jeremy Olliver", "Nigel Ramsay", "Shevaun Coker", "Cameron Fowler"]
|
6
|
-
gem.email =
|
6
|
+
gem.email = ["jeremy.olliver@abletech.co.nz", "nigel.ramsay@abletech.co.nz", "shevaun.coker@abletech.co.nz", "cameron.fowler@abletech.co.nz"]
|
7
7
|
gem.description = %q{Easy deployment: includes a generator, and capistrano configuration}
|
8
8
|
gem.summary = %q{Gem for encapsulating Abletech's deployment practices}
|
9
9
|
gem.homepage = "https://github.com/AbleTech/easy-deployment"
|
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.name = "easy-deployment"
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Easy::Deployment::VERSION
|
17
|
+
gem.license = "GPLv3"
|
17
18
|
|
18
19
|
gem.add_runtime_dependency 'rails', '>= 3.0.0'
|
19
20
|
gem.add_runtime_dependency 'capistrano', '~> 2.13.5'
|
@@ -43,7 +43,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
43
43
|
when :latest then latest_release
|
44
44
|
else raise ArgumentError, "unknown migration target #{migrate_target.inspect}"
|
45
45
|
end
|
46
|
-
run "cd #{directory}; RAILS_ENV=#{stage} bundle exec rake db:create"
|
46
|
+
run "cd #{directory}; RAILS_ENV=#{rails_env || stage} bundle exec rake db:create"
|
47
47
|
end
|
48
48
|
|
49
49
|
# By default, we deploy using passenger as an app server
|
@@ -63,7 +63,20 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
namespace :tail do
|
67
|
+
desc "Stream live log output. USAGE tail:live_logs"
|
68
|
+
task :live_logs, :roles => :app do
|
69
|
+
stream_output_from_command("tail -f #{shared_path}/log/#{rails_env}.log", true)
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "Show recent log output. USAGE tail:recent_logs [lines=n] (defaults to 100)"
|
73
|
+
task :recent_logs, :roles => :app do
|
74
|
+
lines = ENV['lines'] || 100
|
75
|
+
stream_output_from_command("tail -n#{lines} #{shared_path}/log/#{rails_env}.log")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "[internal] Tag the release by creating or moving a remote branch named after the current environment"
|
67
80
|
task :tag_release do
|
68
81
|
if system("git branch -r | grep 'origin/releases/#{stage}'")
|
69
82
|
system "git push origin :releases/#{stage}"
|
@@ -71,7 +84,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
71
84
|
system "git push origin #{branch}:releases/#{stage}"
|
72
85
|
end
|
73
86
|
|
74
|
-
desc "Annotate release into version.txt"
|
87
|
+
desc "[internal] Annotate release into version.txt"
|
75
88
|
task :annotate_release do
|
76
89
|
git_revision = `git rev-parse #{branch} 2> /dev/null`.strip
|
77
90
|
version_info = "Branch/Tag: #{branch}\\nRevision: #{git_revision}\\nDeployed To: #{stage}\\n\\nDeployed At: #{Time.now}\\nBy: #{`whoami`.chomp}\\n"
|
@@ -81,4 +94,18 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
81
94
|
after "deploy:update", "tag_release"
|
82
95
|
after "deploy:update", "annotate_release"
|
83
96
|
|
97
|
+
|
98
|
+
# Helper function to stream output colorized by host
|
99
|
+
def stream_output_from_command(cmd, continuous = false)
|
100
|
+
trap("INT") { puts 'Output cancelled'; exit 0; }
|
101
|
+
Capistrano::CLI.ui.say("<%= color('Streaming output Ctrl+c to cancel', :blue) %>") if continuous
|
102
|
+
|
103
|
+
run(cmd) do |channel, stream, data|
|
104
|
+
puts # for an extra line break before the host name
|
105
|
+
Capistrano::CLI.ui.say("<%= color('#{channel[:host]}', :cyan) %>: #{data}")
|
106
|
+
# puts "#{channel[:host]}: #{data}"
|
107
|
+
break if stream == :err
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
84
111
|
end
|
@@ -11,18 +11,20 @@ module Easy
|
|
11
11
|
def create_backup_files
|
12
12
|
gem_group(:backup) do
|
13
13
|
gem "whenever", :require => false
|
14
|
-
|
15
|
-
|
14
|
+
# Rails 3.2.12 and lower of the Rails 3.2 release series requires mail ~> 2.4.X which neccesitates an older version of backup
|
15
|
+
# We'll handle two cases: one for Rails 3.2.(0-12) and one for Rails 3.2.13 + Rails 4
|
16
|
+
if "3.2" == "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}" && Rails::VERSION::STRING < "3.2.13"
|
16
17
|
gem "backup", "~> 3.0.27", :require => false
|
17
18
|
gem "fog", "~> 1.4.0", :require => false
|
18
19
|
gem "mail", "~> 2.4.0", :require => false
|
19
|
-
|
20
|
-
|
21
|
-
gem "
|
22
|
-
gem "
|
23
|
-
gem "net-
|
24
|
-
gem "
|
25
|
-
gem "
|
20
|
+
elsif Rails::VERSION::STRING >= "3.2.13" && [3,4].include?(Rails::VERSION::MAJOR)
|
21
|
+
# Rails 3.2.13+ and Rails 4 only
|
22
|
+
gem "backup", "~> 3.1.3", :require => false
|
23
|
+
gem "fog", "~> 1.9.0", :require => false
|
24
|
+
gem "net-ssh", ['>= 2.3.0', '<= 2.5.2'], :require => false
|
25
|
+
gem "net-scp", ['>= 1.0.0', '<= 1.0.4'], :require => false
|
26
|
+
gem "excon", "~> 0.17.0", :require => false
|
27
|
+
gem "mail", "~> 2.5.0", :require => false
|
26
28
|
else
|
27
29
|
warn "Unsupported rails release detected. You'll need to manage your own dependencies for the backup gem"
|
28
30
|
gem "backup", :require => false
|
@@ -6,23 +6,17 @@ module Easy
|
|
6
6
|
|
7
7
|
include GeneratorHelpers
|
8
8
|
|
9
|
-
INSTALL_MSG = %{
|
10
|
-
Easy Deployment Config now setup!
|
11
|
-
|
12
|
-
TODO:
|
13
|
-
* Set the correct git repository in config/deploy.rb
|
14
|
-
* Edit Capfile and enable asset pipeline compilation if you are using it (uncomment load 'deploy/assets')
|
15
|
-
}
|
16
|
-
|
17
9
|
desc %{Generates standard able technology deployment script using capistrano}
|
18
10
|
|
19
|
-
class_option :stages,
|
20
|
-
class_option :disable_backup,
|
21
|
-
class_option :disable_bugsnag,
|
22
|
-
class_option :disable_newrelic,
|
11
|
+
class_option :stages, :type => :array, :default => ['staging', 'production'], :aliases => :s
|
12
|
+
class_option :disable_backup, :type => :boolean, :default => false
|
13
|
+
class_option :disable_bugsnag, :type => :boolean, :default => false
|
14
|
+
class_option :disable_newrelic, :type => :boolean, :default => false
|
15
|
+
class_option :no_asset_pipeline, :type => :boolean, :default => false
|
23
16
|
|
24
17
|
def create_deployment_files
|
25
18
|
template("deploy.rb.tt", "config/deploy.rb") # Generate deploy.rb first to use ours not capistrano's deploy.rb
|
19
|
+
copy_file("Capfile") unless options[:no_asset_pipeline] # Do this first
|
26
20
|
capify!
|
27
21
|
|
28
22
|
# Generate all stages specified
|
@@ -30,7 +24,14 @@ TODO:
|
|
30
24
|
generate("easy:stage", stage)
|
31
25
|
end
|
32
26
|
|
33
|
-
|
27
|
+
install_message = %Q(
|
28
|
+
Easy Deployment Config now setup!
|
29
|
+
|
30
|
+
TODO:
|
31
|
+
* Set the correct git repository in config/deploy.rb
|
32
|
+
#{"* Edit Capfile and enable asset pipeline compilation if you are using it (uncomment load 'deploy/assets')\n" if options[:no_asset_pipeline]})
|
33
|
+
|
34
|
+
say(install_message, :green)
|
34
35
|
options[:stages].each do |stage|
|
35
36
|
say(" * Set the ip address for staging in config/deploy/#{stage}.rb && the apache config in config/deploy/#{stage}/apache.conf", :green)
|
36
37
|
end
|
@@ -13,7 +13,8 @@ Backup::Model.new("<%= application_name %>", "Remote Backup") do
|
|
13
13
|
database_config_filename = "mongo.yml"
|
14
14
|
end
|
15
15
|
%>
|
16
|
-
|
16
|
+
app_database_config = YAML.load_file(File.join(rails_root, "config/<%= database_config_filename %>"))
|
17
|
+
database_config = app_database_config[ENV['RAILS_ENV']]
|
17
18
|
|
18
19
|
database <%= database_engine %> do |db|
|
19
20
|
db.name = database_config["database"]
|
@@ -1,10 +1,16 @@
|
|
1
1
|
<VirtualHost *:80>
|
2
|
-
|
2
|
+
ServerName <%= name %>.<%= application_name %>.co.nz
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
DocumentRoot /var/apps/<%= application_name %>/current/public
|
5
|
+
RackEnv <%= name %>
|
6
|
+
|
7
|
+
# Passenger tuning
|
8
|
+
PassengerMinInstances 1 # Prevent passenger going to sleep after 15min inactivity
|
9
|
+
# PassengerPreStart http://<%= name %>.<%= application_name %>.co.nz # Pre-load app on deploy. This needs to match the ServerName above
|
10
|
+
# PassengerHighPerformance on # If you don't need any apache mods within this VirtualHost, you may turn this on
|
11
|
+
|
12
|
+
<Directory /var/apps/<%= application_name %>/current/public>
|
13
|
+
AllowOverride all
|
14
|
+
Options -MultiViews
|
15
|
+
</Directory>
|
10
16
|
</VirtualHost>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy-deployment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-
|
15
|
+
date: 2013-05-26 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/easy/generators/deployment_generator.rb
|
112
112
|
- lib/easy/generators/generator_helpers.rb
|
113
113
|
- lib/easy/generators/stage_generator.rb
|
114
|
+
- lib/easy/generators/templates/Capfile
|
114
115
|
- lib/easy/generators/templates/backup.rb.tt
|
115
116
|
- lib/easy/generators/templates/deploy.rb.tt
|
116
117
|
- lib/easy/generators/templates/s3.yml
|
@@ -121,7 +122,8 @@ files:
|
|
121
122
|
- spec/easy_deployment_spec.rb
|
122
123
|
- spec/spec_helper.rb
|
123
124
|
homepage: https://github.com/AbleTech/easy-deployment
|
124
|
-
licenses:
|
125
|
+
licenses:
|
126
|
+
- GPLv3
|
125
127
|
post_install_message:
|
126
128
|
rdoc_options: []
|
127
129
|
require_paths:
|