minestrone 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/LICENSE.txt +2 -1
- data/README.md +11 -1
- data/bin/capify +12 -9
- data/lib/minestrone/configuration/actions/file_transfer.rb +2 -0
- data/lib/minestrone/configuration/variables.rb +12 -0
- data/lib/minestrone/recipes/deploy/assets.rb +11 -14
- data/lib/minestrone/recipes/deploy/bundler.rb +6 -6
- data/lib/minestrone/recipes/deploy.rb +44 -170
- data/lib/minestrone/version.rb +1 -1
- metadata +3 -3
- data/lib/minestrone/recipes/templates/maintenance.rhtml +0 -53
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b1c0aa45e3a7ce26a5241ab6656d206d0b2db2c38687384f0cbba242bd67537
|
|
4
|
+
data.tar.gz: 5cef64bc80b01887fe19456cd67c8734cb9123af190bca72a3f3c9f45b63aa27
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e1a874230014eb04210586cbfbecb5ec23bea4fcb2038db1b8a442966210d12c714e9024907d9f4364686d7c076fe64589adb6a253c1789524dc7ec52be499d
|
|
7
|
+
data.tar.gz: 17bf22d3069227d7e8f84bb268d21deddae4d3970563810bfe58fa7605425b118bd931a7198eca519a18db941276a5faaf277b935fc4628a2d0e2880b264cb52
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
## [0.0.2] - 2026-07-26
|
|
2
|
+
|
|
3
|
+
- added `upload_file` as an alias for `upload` (which in deploy tasks is shadowed by the `deploy:upload` task)
|
|
4
|
+
- added `append` & `remove` for adding/removing to array variables (from Capistrano 3)
|
|
5
|
+
- renamed `_cset` to `set_if_empty` and make it a public API (also from Capistrano 3)
|
|
6
|
+
- in migration and assets tasks, use `RACK_ENV` instead of `RAILS_ENV`, unless `rails_env` is explicitly defined (Rails also accepts `RACK_ENV`, but Sinatra/Rack doesn't accept `RAILS_ENV`)
|
|
7
|
+
- `:use_sudo` is now disabled by default
|
|
8
|
+
- renamed `version_dir` to `releases_dir` for consistency
|
|
9
|
+
- removed `:maintenance_basename`, `:maintenance_template_path` and the maintenance page tasks `deploy:web:disable` / `deploy:web:enable`
|
|
10
|
+
- removed `deploy:cold`, `deploy:start` and `deploy:stop` tasks
|
|
11
|
+
- removed `:normalize_asset_timestamps` and `:public_children`
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Minestrone 0.0.1 - 2026-05-25
|
|
15
|
+
|
|
16
|
+
Changes from Capistrano 2.15.11:
|
|
17
|
+
|
|
18
|
+
Removed:
|
|
19
|
+
|
|
20
|
+
* server roles, multiple servers and "primary" server designation – you only define a single server hostname and everything happens there (`server` method in the DSL only accepts a single string + options, `role` is gone)
|
|
21
|
+
* support for any parallel execution
|
|
22
|
+
* multiple stages
|
|
23
|
+
* SCM handlers other than `:git` and `:none`
|
|
24
|
+
* most deploy strategies – only `:remote_cache` and `:copy` are left
|
|
25
|
+
* support for SSH gateways
|
|
26
|
+
* password authentication for SSH and Git
|
|
27
|
+
* REPL shell
|
|
28
|
+
* code supporting ancient versions of Ruby, Rails or Rake, or very old Capistrano API
|
|
29
|
+
* Windows support code
|
|
30
|
+
|
|
31
|
+
Changed:
|
|
32
|
+
|
|
33
|
+
* project name
|
|
34
|
+
* default deploy path is `/var/www/#{application}`
|
|
35
|
+
* `deploy:cleanup` now runs automatically, with 5 last releases
|
|
36
|
+
* bumped up minimum Ruby version to 3.0
|
|
37
|
+
* various refactoring and formatting changes
|
|
38
|
+
|
|
39
|
+
Added:
|
|
40
|
+
|
|
41
|
+
* `ENV['SERVER']` for overriding the host the tasks run on (`HOSTS` still works, but only accepts one hostname)
|
|
42
|
+
* set up CI on GitHub
|
|
43
|
+
* added `frozen_string_literal` directives everywhere
|
|
44
|
+
* added `benchmark` and `logger` to dependencies in gemspec
|
|
45
|
+
* added `deploy/bundler` recipe for Bundler integration
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Capistrano 2.15.11 - 2023-06-17
|
|
49
|
+
|
|
50
|
+
Previous changelog available [here](https://github.com/capistrano/capistrano/blob/v2.15.11/CHANGELOG).
|
data/LICENSE.txt
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2012-2020 Tom Clements, Lee Hambley
|
|
4
3
|
Copyright (c) 2005-2007 Jamis Buck <jamis@37signals.com>
|
|
4
|
+
Copyright (c) 2012-2020 Tom Clements, Lee Hambley
|
|
5
|
+
Copyright (c) 2026 Jakub Suder
|
|
5
6
|
|
|
6
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
8
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -19,13 +19,23 @@ Minestrone is a tool for deploying Ruby applications to a server, based on the c
|
|
|
19
19
|
* REPL shell
|
|
20
20
|
* legacy SCMs – only `:git` and `:none` are left
|
|
21
21
|
* most deploy strategies – only `:remote_cache` and `:copy` are left
|
|
22
|
-
*
|
|
22
|
+
* maintenance page tasks
|
|
23
|
+
* normalizing asset timestamps
|
|
24
|
+
* `deploy:cold`, `deploy:start` and `deploy:stop` tasks
|
|
25
|
+
* any legacy/deprecated code from Capistrano 1.x era or for ancient versions of Ruby or Rails
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
### Other API changes
|
|
26
29
|
|
|
27
30
|
* default deploy path is `/var/www/#{application}`
|
|
28
31
|
* `server` method in the DSL only accepts a single string + options
|
|
32
|
+
* `:use_sudo` is false by default
|
|
33
|
+
* `deploy:cleanup` runs automatically, with 5 last releases
|
|
34
|
+
* `deploy/bundler` recipe handles Bundler integration
|
|
35
|
+
* migration & asset tasks set a `RACK_ENV` instead of `RAILS_ENV` (which Rails also accepts), unless `:rails_env` is explicitly defined
|
|
36
|
+
* added `upload_file` as alias for `upload`
|
|
37
|
+
* added `append` and `remove` for adding/removing items from array variables
|
|
38
|
+
* renamed `_cset` to `set_if_empty`
|
|
29
39
|
* Ruby 3.0+ is required
|
|
30
40
|
|
|
31
41
|
|
data/bin/capify
CHANGED
|
@@ -39,38 +39,42 @@ files = {
|
|
|
39
39
|
"Capfile" => unindent(<<-FILE),
|
|
40
40
|
|
|
41
41
|
load 'deploy'
|
|
42
|
-
load 'deploy/bundler'
|
|
43
42
|
|
|
44
43
|
# Uncomment if you are using Rails' asset pipeline
|
|
45
44
|
# load 'deploy/assets'
|
|
46
45
|
|
|
47
|
-
load 'config/deploy'
|
|
46
|
+
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
|
48
47
|
FILE
|
|
49
48
|
|
|
50
49
|
"config/deploy.rb" => 'set :application, "set your application name here"
|
|
51
50
|
set :repository, "set your repository location here"
|
|
52
51
|
|
|
53
|
-
# set :scm, :git #
|
|
52
|
+
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
|
|
53
|
+
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
|
|
54
54
|
|
|
55
|
-
server "
|
|
55
|
+
role :web, "your web-server here" # Your HTTP server, Apache/etc
|
|
56
|
+
role :app, "your app-server here" # This may be the same as your `Web` server
|
|
57
|
+
role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
|
|
58
|
+
role :db, "your slave db-server here"
|
|
56
59
|
|
|
57
60
|
# if you want to clean up old releases on each deploy uncomment this:
|
|
58
61
|
# after "deploy:restart", "deploy:cleanup"
|
|
59
62
|
|
|
60
|
-
#
|
|
63
|
+
# if you\'re still using the script/reaper helper you will need
|
|
64
|
+
# these http://github.com/rails/irs_process_scripts
|
|
65
|
+
|
|
66
|
+
# If you are using Passenger mod_rails uncomment this:
|
|
61
67
|
# namespace :deploy do
|
|
62
68
|
# task :start do ; end
|
|
63
69
|
# task :stop do ; end
|
|
64
|
-
# task :restart do
|
|
70
|
+
# task :restart, :roles => :app, :except => { :no_release => true } do
|
|
65
71
|
# run "#{try_sudo} touch #{File.join(current_path,\'tmp\',\'restart.txt\')}"
|
|
66
72
|
# end
|
|
67
73
|
# end'}
|
|
68
74
|
|
|
69
75
|
base = ARGV.shift
|
|
70
|
-
|
|
71
76
|
files.each do |file, content|
|
|
72
77
|
file = File.join(base, file)
|
|
73
|
-
|
|
74
78
|
if File.exist?(file)
|
|
75
79
|
warn "[skip] '#{file}' already exists"
|
|
76
80
|
elsif File.exist?(file.downcase)
|
|
@@ -80,7 +84,6 @@ files.each do |file, content|
|
|
|
80
84
|
puts "[add] making directory '#{File.dirname(file)}'"
|
|
81
85
|
FileUtils.mkdir(File.dirname(file))
|
|
82
86
|
end
|
|
83
|
-
|
|
84
87
|
puts "[add] writing '#{file}'"
|
|
85
88
|
File.open(file, "w") { |f| f.write(content) }
|
|
86
89
|
end
|
|
@@ -36,6 +36,10 @@ module Minestrone
|
|
|
36
36
|
|
|
37
37
|
alias :[]= :set
|
|
38
38
|
|
|
39
|
+
def set_if_empty(variable, *args, &block)
|
|
40
|
+
set(variable, *args, &block) unless exists?(variable)
|
|
41
|
+
end
|
|
42
|
+
|
|
39
43
|
# Removes any trace of the given variable.
|
|
40
44
|
def unset(variable)
|
|
41
45
|
sym = variable.to_sym
|
|
@@ -43,6 +47,14 @@ module Minestrone
|
|
|
43
47
|
@variables.delete(sym)
|
|
44
48
|
end
|
|
45
49
|
|
|
50
|
+
def append(variable, *values)
|
|
51
|
+
set(variable, Array(fetch(variable, [])).concat(values))
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def remove(variable, *values)
|
|
55
|
+
set(variable, Array(fetch(variable, [])) - values)
|
|
56
|
+
end
|
|
57
|
+
|
|
46
58
|
# Returns true if the variable has been defined, and false otherwise.
|
|
47
59
|
def exists?(variable)
|
|
48
60
|
@variables.key?(variable.to_sym)
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
4
|
|
|
5
|
-
load 'deploy' unless defined?(
|
|
5
|
+
load 'deploy' unless defined?(try_sudo)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
_cset :normalize_asset_timestamps, false
|
|
7
|
+
set_if_empty :asset_env, "RAILS_GROUPS=assets"
|
|
8
|
+
set_if_empty :assets_prefix, "assets"
|
|
9
|
+
set_if_empty :shared_assets_prefix, "assets"
|
|
10
|
+
set_if_empty :expire_assets_after, (3600 * 24 * 7)
|
|
11
|
+
set_if_empty(:asset_manifest_prefix) { (`sprockets -v`.chomp < "3.0" ? "manifest" : ".sprockets-manifest") rescue "manifest" }
|
|
14
12
|
|
|
15
13
|
before 'deploy:finalize_update', 'deploy:assets:symlink'
|
|
16
14
|
after 'deploy:update_code', 'deploy:assets:precompile'
|
|
@@ -57,13 +55,12 @@ namespace :deploy do
|
|
|
57
55
|
asset_env variable. The defaults are:
|
|
58
56
|
|
|
59
57
|
set :rake, "rake"
|
|
60
|
-
set :
|
|
58
|
+
set :rack_env, "production"
|
|
61
59
|
set :asset_env, "RAILS_GROUPS=assets"
|
|
62
60
|
DESC
|
|
63
61
|
task :precompile do
|
|
64
62
|
run <<-CMD.compact
|
|
65
|
-
cd -- #{latest_release} &&
|
|
66
|
-
RAILS_ENV=#{rails_env.to_s.shellescape} #{asset_env} #{rake} assets:precompile
|
|
63
|
+
cd -- #{latest_release} && #{r_env} #{asset_env} #{rake} assets:precompile
|
|
67
64
|
CMD
|
|
68
65
|
|
|
69
66
|
if capture("ls -1 #{shared_path.shellescape}/#{shared_assets_prefix}/#{asset_manifest_prefix}* | wc -l").to_i > 1
|
|
@@ -112,11 +109,11 @@ namespace :deploy do
|
|
|
112
109
|
asset_env variable. The defaults are:
|
|
113
110
|
|
|
114
111
|
set :rake, "rake"
|
|
115
|
-
set :
|
|
112
|
+
set :rack_env, "production"
|
|
116
113
|
set :asset_env, "RAILS_GROUPS=assets"
|
|
117
114
|
DESC
|
|
118
115
|
task :clean do
|
|
119
|
-
run "cd #{latest_release} && #{rake}
|
|
116
|
+
run "cd #{latest_release} && #{rake} #{r_env} #{asset_env} assets:clean"
|
|
120
117
|
end
|
|
121
118
|
|
|
122
119
|
desc <<-DESC
|
|
@@ -186,7 +183,7 @@ namespace :deploy do
|
|
|
186
183
|
run <<-CMD.compact
|
|
187
184
|
cd -- #{previous_release.shellescape} &&
|
|
188
185
|
cp -f -- #{previous_manifest.shellescape} #{restored_manifest_path.shellescape} &&
|
|
189
|
-
[ -z "$(#{rake} -P | grep assets:precompile:nondigest)" ] || #{rake}
|
|
186
|
+
[ -z "$(#{rake} -P | grep assets:precompile:nondigest)" ] || #{rake} #{r_env} #{asset_env} assets:precompile:nondigest
|
|
190
187
|
CMD
|
|
191
188
|
end
|
|
192
189
|
end
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
# https://github.com/ruby/rubygems/blob/master/bundler/lib/bundler/minestrone.rb
|
|
5
5
|
# and https://github.com/minestrone/bundler
|
|
6
6
|
|
|
7
|
-
load 'deploy' unless defined?(
|
|
7
|
+
load 'deploy' unless defined?(try_sudo)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
set_if_empty :bundle_env, ''
|
|
10
|
+
set_if_empty :bundle_cmd, 'bundle'
|
|
11
|
+
set_if_empty(:bundle_path) { "#{shared_path}/bundle" }
|
|
12
|
+
set_if_empty :bundle_without, [:development, :test]
|
|
13
|
+
set_if_empty :bundle_flags, '--quiet'
|
|
14
14
|
|
|
15
15
|
set(:rake) { "#{bundle_cmd} exec rake" }
|
|
16
16
|
|
|
@@ -7,35 +7,29 @@ require "yaml"
|
|
|
7
7
|
require "minestrone/recipes/deploy/scm"
|
|
8
8
|
require "minestrone/recipes/deploy/strategy"
|
|
9
9
|
|
|
10
|
-
def _cset(name, *args, &block)
|
|
11
|
-
unless exists?(name)
|
|
12
|
-
set(name, *args, &block)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
10
|
# =========================================================================
|
|
17
11
|
# These variables MUST be set in the client capfiles. If they are not set,
|
|
18
12
|
# the deploy will fail with an error.
|
|
19
13
|
# =========================================================================
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
set_if_empty(:application) { abort "Please specify the name of your application, set :application, 'foo'" }
|
|
16
|
+
set_if_empty(:repository) { abort "Please specify the repository that houses your application's code, set :repository, 'foo'" }
|
|
23
17
|
|
|
24
18
|
# =========================================================================
|
|
25
19
|
# These variables may be set in the client capfile if their default values
|
|
26
20
|
# are not sufficient.
|
|
27
21
|
# =========================================================================
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
set_if_empty(:scm) { scm_default }
|
|
24
|
+
set_if_empty :deploy_via, :remote_cache
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
set_if_empty(:deploy_to) { "/var/www/#{application}" }
|
|
27
|
+
set_if_empty(:revision) { source.head }
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
set_if_empty :rack_env, "production"
|
|
30
|
+
set_if_empty :rake, "rake"
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
set_if_empty :keep_releases, 5
|
|
39
33
|
|
|
40
34
|
# =========================================================================
|
|
41
35
|
# These variables should NOT be changed unless you are very confident in
|
|
@@ -43,43 +37,40 @@ _cset :keep_releases, 5
|
|
|
43
37
|
# changes if you do decide to muck with these!
|
|
44
38
|
# =========================================================================
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
set_if_empty(:source) { Minestrone::Deploy::SCM.new(scm, self) }
|
|
41
|
+
set_if_empty(:real_revision) { source.local.query_revision(revision) { |cmd| with_env("LC_ALL", "C") { run_locally(cmd) } } }
|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
set_if_empty(:strategy) { Minestrone::Deploy::Strategy.new(deploy_via, self) }
|
|
50
44
|
|
|
51
45
|
# If overriding release name, please also select an appropriate setting for :releases below.
|
|
52
|
-
|
|
46
|
+
set_if_empty(:release_name) { set :deploy_timestamped, true; Time.now.utc.strftime("%Y%m%d%H%M%S") }
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
set_if_empty :releases_dir, "releases"
|
|
49
|
+
set_if_empty :shared_dir, "shared"
|
|
50
|
+
set_if_empty :shared_children, %w(public/system log tmp/pids)
|
|
51
|
+
set_if_empty :current_dir, "current"
|
|
58
52
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
set_if_empty(:releases_path) { File.join(deploy_to, releases_dir) }
|
|
54
|
+
set_if_empty(:shared_path) { File.join(deploy_to, shared_dir) }
|
|
55
|
+
set_if_empty(:current_path) { File.join(deploy_to, current_dir) }
|
|
56
|
+
set_if_empty(:release_path) { File.join(releases_path, release_name) }
|
|
63
57
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
set_if_empty(:releases) { capture("#{try_sudo} ls -x #{releases_path}").split.sort }
|
|
59
|
+
set_if_empty(:current_release) { releases.length > 0 ? File.join(releases_path, releases.last) : nil }
|
|
60
|
+
set_if_empty(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
|
|
67
61
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
set_if_empty(:current_revision) { capture("#{try_sudo} cat #{current_path}/REVISION").chomp }
|
|
63
|
+
set_if_empty(:latest_revision) { capture("#{try_sudo} cat #{current_release}/REVISION").chomp }
|
|
64
|
+
set_if_empty(:previous_revision) { capture("#{try_sudo} cat #{previous_release}/REVISION").chomp if previous_release }
|
|
71
65
|
|
|
72
|
-
|
|
66
|
+
set_if_empty(:run_method) { fetch(:use_sudo, false) ? :sudo : :run }
|
|
73
67
|
|
|
74
68
|
# some tasks, like symlink, need to always point at the latest release, but
|
|
75
69
|
# they can also (occassionally) be called standalone. In the standalone case,
|
|
76
70
|
# the timestamped release_path will be inaccurate, since the directory won't
|
|
77
71
|
# actually exist. This variable lets tasks like symlink work either in the
|
|
78
72
|
# standalone case, or during deployment.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
_cset :maintenance_basename, "maintenance"
|
|
82
|
-
_cset(:maintenance_template_path) { File.join(__dir__, "templates", "maintenance.rhtml") }
|
|
73
|
+
set_if_empty(:latest_release) { exists?(:deploy_timestamped) ? release_path : current_release }
|
|
83
74
|
|
|
84
75
|
# =========================================================================
|
|
85
76
|
# These are helper methods that will be available to your recipes.
|
|
@@ -109,6 +100,15 @@ ensure
|
|
|
109
100
|
ENV[name] = saved
|
|
110
101
|
end
|
|
111
102
|
|
|
103
|
+
def r_env
|
|
104
|
+
if rails_env = fetch(:rails_env, nil)
|
|
105
|
+
"RAILS_ENV=#{rails_env.to_s.shellescape}"
|
|
106
|
+
else
|
|
107
|
+
rack_env = fetch(:rack_env, "production")
|
|
108
|
+
"RACK_ENV=#{rack_env.to_s.shellescape}"
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
112
|
# Logs the command then executes it locally. Returns the command output as a string.
|
|
113
113
|
def run_locally(cmd)
|
|
114
114
|
if dry_run
|
|
@@ -179,10 +179,7 @@ end
|
|
|
179
179
|
|
|
180
180
|
namespace :deploy do
|
|
181
181
|
desc <<-DESC
|
|
182
|
-
Deploys your project. This calls both `update' and `restart'.
|
|
183
|
-
this will generally only work for applications that have already been deployed \
|
|
184
|
-
once. For a "cold" deploy, you'll want to take a look at the `deploy:cold' \
|
|
185
|
-
task, which handles the cold start specifically.
|
|
182
|
+
Deploys your project. This calls both `update' and `restart'.
|
|
186
183
|
DESC
|
|
187
184
|
|
|
188
185
|
task :default do
|
|
@@ -253,14 +250,9 @@ namespace :deploy do
|
|
|
253
250
|
task with your own environment's requirements.
|
|
254
251
|
|
|
255
252
|
This task will make the release group-writable (if the :group_writable \
|
|
256
|
-
variable is set to true, which is the default)
|
|
253
|
+
variable is set to true, which is the default) and will set up \
|
|
257
254
|
symlinks to the shared directory for the log, system, and tmp/pids \
|
|
258
|
-
directories
|
|
259
|
-
public/stylesheets, and public/javascripts so that the times are \
|
|
260
|
-
consistent (so that asset timestamping works). This touch process \
|
|
261
|
-
is only carried out if the :normalize_asset_timestamps variable is \
|
|
262
|
-
set to true, which is the default. The asset directories can be overridden \
|
|
263
|
-
using the :public_children variable.
|
|
255
|
+
directories.
|
|
264
256
|
DESC
|
|
265
257
|
|
|
266
258
|
task :finalize_update do
|
|
@@ -286,18 +278,6 @@ namespace :deploy do
|
|
|
286
278
|
end
|
|
287
279
|
|
|
288
280
|
run commands.join(' && ') if commands.any?
|
|
289
|
-
|
|
290
|
-
if fetch(:normalize_asset_timestamps, true)
|
|
291
|
-
stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S")
|
|
292
|
-
|
|
293
|
-
asset_paths = fetch(:public_children, %w(images stylesheets javascripts)).
|
|
294
|
-
map { |p| "#{latest_release}/public/#{p}" }.
|
|
295
|
-
map { |p| p.shellescape }
|
|
296
|
-
|
|
297
|
-
if asset_paths.any?
|
|
298
|
-
run("find #{asset_paths.join(" ")} -exec touch -t #{stamp} -- {} ';'; true", :env => { "TZ" => "UTC" })
|
|
299
|
-
end
|
|
300
|
-
end
|
|
301
281
|
end
|
|
302
282
|
|
|
303
283
|
desc <<-DESC
|
|
@@ -418,14 +398,13 @@ namespace :deploy do
|
|
|
418
398
|
rake executable by setting the rake variable. The defaults are:
|
|
419
399
|
|
|
420
400
|
set :rake, "rake"
|
|
421
|
-
set :
|
|
401
|
+
set :rack_env, "production"
|
|
422
402
|
set :migrate_env, ""
|
|
423
403
|
set :migrate_target, :latest
|
|
424
404
|
DESC
|
|
425
405
|
|
|
426
406
|
task :migrate do
|
|
427
407
|
rake = fetch(:rake, "rake")
|
|
428
|
-
rails_env = fetch(:rails_env, "production")
|
|
429
408
|
migrate_env = fetch(:migrate_env, "")
|
|
430
409
|
migrate_target = fetch(:migrate_target, :latest)
|
|
431
410
|
|
|
@@ -435,7 +414,7 @@ namespace :deploy do
|
|
|
435
414
|
else raise ArgumentError, "unknown migration target #{migrate_target.inspect}"
|
|
436
415
|
end
|
|
437
416
|
|
|
438
|
-
run "cd #{directory} && #{
|
|
417
|
+
run "cd #{directory} && #{r_env} #{migrate_env} #{rake} db:migrate"
|
|
439
418
|
end
|
|
440
419
|
|
|
441
420
|
desc <<-DESC
|
|
@@ -458,9 +437,7 @@ namespace :deploy do
|
|
|
458
437
|
desc <<-DESC
|
|
459
438
|
Clean up old releases. By default, the last 5 releases are kept on each \
|
|
460
439
|
server (though you can change this with the keep_releases variable). All \
|
|
461
|
-
other deployed revisions are removed from the server.
|
|
462
|
-
will use sudo to clean up the old releases, but if sudo is not available \
|
|
463
|
-
for your environment, set the :use_sudo variable to false instead.
|
|
440
|
+
other deployed revisions are removed from the server.
|
|
464
441
|
DESC
|
|
465
442
|
|
|
466
443
|
task :cleanup do
|
|
@@ -511,38 +488,6 @@ namespace :deploy do
|
|
|
511
488
|
end
|
|
512
489
|
end
|
|
513
490
|
|
|
514
|
-
desc <<-DESC
|
|
515
|
-
Deploys and starts a `cold' application. This is useful if you have not \
|
|
516
|
-
deployed your application before, or if your application is (for some \
|
|
517
|
-
other reason) not currently running. It will deploy the code, run any \
|
|
518
|
-
pending migrations, and then instead of invoking `deploy:restart', it will \
|
|
519
|
-
invoke `deploy:start' to fire up the application servers.
|
|
520
|
-
DESC
|
|
521
|
-
|
|
522
|
-
task :cold do
|
|
523
|
-
update
|
|
524
|
-
migrate
|
|
525
|
-
start
|
|
526
|
-
end
|
|
527
|
-
|
|
528
|
-
desc <<-DESC
|
|
529
|
-
Blank task exists as a hook into which to install your own environment \
|
|
530
|
-
specific behaviour.
|
|
531
|
-
DESC
|
|
532
|
-
|
|
533
|
-
task :start do
|
|
534
|
-
# Empty Task to overload with your platform specifics
|
|
535
|
-
end
|
|
536
|
-
|
|
537
|
-
desc <<-DESC
|
|
538
|
-
Blank task exists as a hook into which to install your own environment \
|
|
539
|
-
specific behaviour.
|
|
540
|
-
DESC
|
|
541
|
-
|
|
542
|
-
task :stop do
|
|
543
|
-
# Empty Task to overload with your platform specifics
|
|
544
|
-
end
|
|
545
|
-
|
|
546
491
|
namespace :pending do
|
|
547
492
|
desc <<-DESC
|
|
548
493
|
Displays the `diff' since your last deploy. This is useful if you want \
|
|
@@ -565,75 +510,4 @@ namespace :deploy do
|
|
|
565
510
|
system(source.local.log(from))
|
|
566
511
|
end
|
|
567
512
|
end
|
|
568
|
-
|
|
569
|
-
namespace :web do
|
|
570
|
-
desc <<-DESC
|
|
571
|
-
Present a maintenance page to visitors. Disables your application's web \
|
|
572
|
-
interface by writing a "#{maintenance_basename}.html" file to the web server. The \
|
|
573
|
-
server must be configured to detect the presence of this file, and if \
|
|
574
|
-
it is present, always display it instead of performing the request.
|
|
575
|
-
|
|
576
|
-
By default, the maintenance page will just say the site is down for \
|
|
577
|
-
"maintenance", and will be back "shortly", but you can customize the \
|
|
578
|
-
page by specifying the REASON and UNTIL environment variables:
|
|
579
|
-
|
|
580
|
-
$ min deploy:web:disable \\
|
|
581
|
-
REASON="hardware upgrade" \\
|
|
582
|
-
UNTIL="12pm Central Time"
|
|
583
|
-
|
|
584
|
-
You can use a different template for the maintenance page by setting the \
|
|
585
|
-
:maintenance_template_path variable in your deploy.rb file. The template file \
|
|
586
|
-
should either be a plaintext or an erb file.
|
|
587
|
-
|
|
588
|
-
Further customization will require that you write your own task.
|
|
589
|
-
DESC
|
|
590
|
-
|
|
591
|
-
task :disable do
|
|
592
|
-
require 'erb'
|
|
593
|
-
on_rollback { run "rm -f #{shared_path}/system/#{maintenance_basename}.html" }
|
|
594
|
-
|
|
595
|
-
warn <<-EOHTACCESS
|
|
596
|
-
|
|
597
|
-
# Please add something like this to your site's Apache htaccess to redirect users to the maintenance page.
|
|
598
|
-
# More Info: http://www.shiftcommathree.com/articles/make-your-rails-maintenance-page-respond-with-a-503
|
|
599
|
-
|
|
600
|
-
ErrorDocument 503 /system/#{maintenance_basename}.html
|
|
601
|
-
RewriteEngine On
|
|
602
|
-
RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
|
|
603
|
-
RewriteCond %{DOCUMENT_ROOT}/system/#{maintenance_basename}.html -f
|
|
604
|
-
RewriteCond %{SCRIPT_FILENAME} !#{maintenance_basename}.html
|
|
605
|
-
RewriteRule ^.*$ - [redirect=503,last]
|
|
606
|
-
|
|
607
|
-
# Or if you are using Nginx add this to your server config:
|
|
608
|
-
|
|
609
|
-
if (-f $document_root/system/maintenance.html) {
|
|
610
|
-
return 503;
|
|
611
|
-
}
|
|
612
|
-
error_page 503 @maintenance;
|
|
613
|
-
location @maintenance {
|
|
614
|
-
rewrite ^(.*)$ /system/maintenance.html break;
|
|
615
|
-
break;
|
|
616
|
-
}
|
|
617
|
-
EOHTACCESS
|
|
618
|
-
|
|
619
|
-
reason = ENV['REASON']
|
|
620
|
-
deadline = ENV['UNTIL']
|
|
621
|
-
|
|
622
|
-
template = File.read(maintenance_template_path)
|
|
623
|
-
result = ERB.new(template).result(binding)
|
|
624
|
-
|
|
625
|
-
put result, "#{shared_path}/system/#{maintenance_basename}.html", :mode => 0644
|
|
626
|
-
end
|
|
627
|
-
|
|
628
|
-
desc <<-DESC
|
|
629
|
-
Makes the application web-accessible again. Removes the \
|
|
630
|
-
"#{maintenance_basename}.html" page generated by deploy:web:disable, which (if your \
|
|
631
|
-
web server is configured correctly) will make your application \
|
|
632
|
-
web-accessible again.
|
|
633
|
-
DESC
|
|
634
|
-
|
|
635
|
-
task :enable do
|
|
636
|
-
run "rm -f #{shared_path}/system/#{maintenance_basename}.html"
|
|
637
|
-
end
|
|
638
|
-
end
|
|
639
513
|
end
|
data/lib/minestrone/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minestrone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamis Buck
|
|
@@ -106,6 +106,7 @@ extra_rdoc_files:
|
|
|
106
106
|
files:
|
|
107
107
|
- ".github/workflows/main.yml"
|
|
108
108
|
- ".gitignore"
|
|
109
|
+
- CHANGELOG.md
|
|
109
110
|
- Gemfile
|
|
110
111
|
- LICENSE.txt
|
|
111
112
|
- README.md
|
|
@@ -154,7 +155,6 @@ files:
|
|
|
154
155
|
- lib/minestrone/recipes/deploy/strategy/copy.rb
|
|
155
156
|
- lib/minestrone/recipes/deploy/strategy/remote_cache.rb
|
|
156
157
|
- lib/minestrone/recipes/standard.rb
|
|
157
|
-
- lib/minestrone/recipes/templates/maintenance.rhtml
|
|
158
158
|
- lib/minestrone/server_definition.rb
|
|
159
159
|
- lib/minestrone/ssh.rb
|
|
160
160
|
- lib/minestrone/task_definition.rb
|
|
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
215
215
|
- !ruby/object:Gem::Version
|
|
216
216
|
version: '0'
|
|
217
217
|
requirements: []
|
|
218
|
-
rubygems_version: 4.0.
|
|
218
|
+
rubygems_version: 4.0.15
|
|
219
219
|
specification_version: 4
|
|
220
220
|
summary: Minestrone - Welcome to easy deployment with Ruby over SSH
|
|
221
221
|
test_files:
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
4
|
-
|
|
5
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
6
|
-
|
|
7
|
-
<head>
|
|
8
|
-
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
|
9
|
-
<title>System down for maintenance</title>
|
|
10
|
-
|
|
11
|
-
<style type="text/css">
|
|
12
|
-
div.outer {
|
|
13
|
-
position: absolute;
|
|
14
|
-
left: 50%;
|
|
15
|
-
top: 50%;
|
|
16
|
-
width: 500px;
|
|
17
|
-
height: 300px;
|
|
18
|
-
margin-left: -260px;
|
|
19
|
-
margin-top: -150px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.DialogBody {
|
|
23
|
-
margin: 0;
|
|
24
|
-
padding: 10px;
|
|
25
|
-
text-align: left;
|
|
26
|
-
border: 1px solid #ccc;
|
|
27
|
-
border-right: 1px solid #999;
|
|
28
|
-
border-bottom: 1px solid #999;
|
|
29
|
-
background-color: #fff;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
body { background-color: #fff; }
|
|
33
|
-
</style>
|
|
34
|
-
</head>
|
|
35
|
-
|
|
36
|
-
<body>
|
|
37
|
-
|
|
38
|
-
<div class="outer">
|
|
39
|
-
<div class="DialogBody" style="text-align: center;">
|
|
40
|
-
<div style="text-align: center; width: 200px; margin: 0 auto;">
|
|
41
|
-
<p style="color: red; font-size: 16px; line-height: 20px;">
|
|
42
|
-
The system is down for <%= reason ? reason : "maintenance" %>
|
|
43
|
-
as of <%= Time.now.strftime("%H:%M %Z") %>.
|
|
44
|
-
</p>
|
|
45
|
-
<p style="color: #666;">
|
|
46
|
-
It'll be back <%= deadline ? deadline : "shortly" %>.
|
|
47
|
-
</p>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
</body>
|
|
53
|
-
</html>
|