capistrano-maintenance 1.0.0 → 1.1.0
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 +19 -0
- data/README.md +73 -15
- data/lib/capistrano-maintenance/version.rb +1 -1
- data/lib/capistrano/tasks/maintenance.rake +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25477cc88ca901a2e817c8af7a006b16a1f33b3d
|
4
|
+
data.tar.gz: bbd59d8cfb1b4e27ca887ee44b3cb5bf6df3a16a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aa9f2219c5bedad52d41a5f89809335e4da43037cc2a14113a92d1588c390dca0fab6915b8ec33b8caaa5062cc3a9e0ef980d37a2261489522235f015882111
|
7
|
+
data.tar.gz: 608e2fcb177320e6bf7be54a8e8307afc26fac11e6d14f48fd4328b7ef35228fe09002c75c0e66a2d89f8063375e7f34c0908914538a243b36b7d68b7ebd4116
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# capistrano-maintenance changelog
|
2
|
+
|
3
|
+
Reverse chronological order:
|
4
|
+
|
5
|
+
## master
|
6
|
+
|
7
|
+
https://github.com/capistrano/capistrano-maintenance/compare/v1.1.0...HEAD
|
8
|
+
|
9
|
+
* Your contribution here!
|
10
|
+
|
11
|
+
## `1.1.0` (2017-01-26)
|
12
|
+
|
13
|
+
https://github.com/capistrano/capistrano-maintenance/compare/v1.0.0...v1.1.0
|
14
|
+
|
15
|
+
* [#37](https://github.com/capistrano/maintenance/pull/37): Allow configuration of which roles show maintenance pages - [@lazyatom](https://github.com/lazyatom)
|
16
|
+
|
17
|
+
## `1.0.0` (2015-05-06)
|
18
|
+
|
19
|
+
* First stable release
|
data/README.md
CHANGED
@@ -4,17 +4,22 @@
|
|
4
4
|
|
5
5
|
Add this line to your application's Gemfile:
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
``` ruby
|
8
|
+
gem 'capistrano', '~> 3.0'
|
9
|
+
gem 'capistrano-maintenance', '~> 1.0', require: false
|
10
|
+
```
|
10
11
|
|
11
12
|
And then execute:
|
12
13
|
|
13
|
-
|
14
|
+
``` bash
|
15
|
+
$ bundle
|
16
|
+
```
|
14
17
|
|
15
18
|
Or install it yourself:
|
16
19
|
|
17
|
-
|
20
|
+
``` bash
|
21
|
+
$ gem install capistrano-maintenance
|
22
|
+
```
|
18
23
|
|
19
24
|
## Usage
|
20
25
|
|
@@ -24,7 +29,7 @@ Application servers such as [Passenger](https://www.phusionpassenger.com) and [u
|
|
24
29
|
|
25
30
|
Here is an example config for **nginx**. Note that this is just a part of the complete config, and will probably require modifications.
|
26
31
|
|
27
|
-
```
|
32
|
+
``` nginx
|
28
33
|
error_page 503 @503;
|
29
34
|
|
30
35
|
# Return a 503 error if the maintenance page exists.
|
@@ -46,7 +51,7 @@ location @503 {
|
|
46
51
|
|
47
52
|
And here is an example config for **Apache**. This will also need to be modified.
|
48
53
|
|
49
|
-
```
|
54
|
+
``` apache
|
50
55
|
# Create an alias to the maintenance page used as error document.
|
51
56
|
Alias "/error" "/var/www/domain.com/shared/public/system/"
|
52
57
|
ErrorDocument 503 /error/maintenance.html
|
@@ -64,12 +69,14 @@ RewriteRule ^/(.*)$ balancer://unicornserver%{REQUEST_URI} [P,QSA,L]
|
|
64
69
|
|
65
70
|
You can now require the gem in your `Capfile`:
|
66
71
|
|
67
|
-
|
72
|
+
```
|
73
|
+
require 'capistrano/maintenance'
|
74
|
+
```
|
68
75
|
|
69
76
|
### Enable task
|
70
77
|
|
71
|
-
Present a maintenance page to visitors. Disables your application's web
|
72
|
-
|
78
|
+
Present a maintenance page to visitors. Disables your application's web interface
|
79
|
+
by writing a `"#{maintenance_basename}.html"` file to each web server. The
|
73
80
|
servers must be configured to detect the presence of this file, and if
|
74
81
|
it is present, always display it instead of performing the request.
|
75
82
|
|
@@ -77,20 +84,65 @@ By default, the maintenance page will just say the site is down for
|
|
77
84
|
"maintenance", and will be back "shortly", but you can customize the
|
78
85
|
page by specifying the REASON and UNTIL environment variables:
|
79
86
|
|
80
|
-
|
87
|
+
```
|
88
|
+
cap maintenance:enable REASON="hardware upgrade" UNTIL="12pm Central Time"
|
89
|
+
```
|
81
90
|
|
82
91
|
You can use a different template for the maintenance page by setting the
|
83
|
-
`:maintenance_template_path` variable in your deploy.rb file
|
84
|
-
|
92
|
+
`:maintenance_template_path` variable in your deploy.rb file with an absolute path.
|
93
|
+
|
94
|
+
```
|
95
|
+
set :maintenance_template_path, File.expand_path("../../app/path/to/maintenance.erb.html", __FILE__)
|
96
|
+
```
|
97
|
+
|
98
|
+
The template file should either be a plaintext or an erb file. For example:
|
99
|
+
|
100
|
+
``` html
|
101
|
+
<!DOCTYPE html>
|
102
|
+
<html>
|
103
|
+
<head>
|
104
|
+
<title>Maintenance</title>
|
105
|
+
<style type="text/css">
|
106
|
+
body {
|
107
|
+
width: 400px;
|
108
|
+
margin: 100px auto;
|
109
|
+
font: 300 120% "OpenSans", "Helvetica Neue", "Helvetica", Arial, Verdana, sans-serif;
|
110
|
+
}
|
111
|
+
|
112
|
+
h1 {
|
113
|
+
font-weight: 300;
|
114
|
+
}
|
115
|
+
</style>
|
116
|
+
</head>
|
117
|
+
<body>
|
118
|
+
<h1>Maintenance</h1>
|
119
|
+
|
120
|
+
<p>The system is down for <%= reason ? reason : "maintenance" %><br>
|
121
|
+
as of <%= Time.now.strftime("%F %H:%M %Z") %>.</p>
|
122
|
+
|
123
|
+
<p>It'll be back <%= deadline ? deadline : "shortly" %>.</p>
|
124
|
+
</body>
|
125
|
+
</html>
|
126
|
+
```
|
127
|
+
|
128
|
+
By default, the maintenance page will be uploaded to all servers with the `web` role,
|
129
|
+
but if your application has different needs, you can customize this using the
|
130
|
+
`maintenance_roles` variable:
|
131
|
+
|
132
|
+
```
|
133
|
+
set :maintenance_roles, -> { roles([:web, :other_role]) }
|
134
|
+
```
|
85
135
|
|
86
136
|
Further customization will require that you write your own task.
|
87
137
|
|
88
138
|
### Disable task
|
89
139
|
|
90
|
-
|
140
|
+
``` bash
|
141
|
+
cap maintenance:disable
|
142
|
+
```
|
91
143
|
|
92
144
|
Makes the application web-accessible again. Removes the
|
93
|
-
"#{maintenance_basename}.html" page generated by maintenance:disable, which (if your
|
145
|
+
`"#{maintenance_basename}.html"` page generated by maintenance:disable, which (if your
|
94
146
|
web servers are configured correctly) will make your application web-accessible again.
|
95
147
|
|
96
148
|
## Contributing
|
@@ -100,3 +152,9 @@ web servers are configured correctly) will make your application web-accessible
|
|
100
152
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
101
153
|
4. Push to the branch (`git push origin my-new-feature`)
|
102
154
|
5. Create new Pull Request
|
155
|
+
|
156
|
+
## Authors
|
157
|
+
|
158
|
+
The original `capistrano-maintenance` gem was created by [Thomas von Deyen](https://github.com/tvdeyen) and the implementation for Capistrano 3 in this repo was written by [Kir Shatrov](https://github.com/kirs).
|
159
|
+
|
160
|
+
As a Capistrano team, we thank Thomas for collaboration and providing the push access to the `capistrano-maintenance` gem.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
namespace :maintenance do
|
2
2
|
desc "Turn on maintenance mode"
|
3
3
|
task :enable do
|
4
|
-
on roles(:web) do
|
4
|
+
on fetch(:maintenance_roles, roles(:web)) do
|
5
5
|
require 'erb'
|
6
6
|
|
7
7
|
reason = ENV['REASON']
|
@@ -26,7 +26,7 @@ namespace :maintenance do
|
|
26
26
|
|
27
27
|
desc "Turn off maintenance mode"
|
28
28
|
task :disable do
|
29
|
-
on roles(:web) do
|
29
|
+
on fetch(:maintenance_roles, roles(:web)) do
|
30
30
|
execute "rm -f #{shared_path}/public/system/#{fetch(:maintenance_basename, 'maintenance')}.html"
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-maintenance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kir Shatrov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
90
|
version: '0'
|
90
91
|
requirements: []
|
91
92
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.6.8
|
93
94
|
signing_key:
|
94
95
|
specification_version: 4
|
95
96
|
summary: Enable and disabled tasks to show when your project is on maintenance
|