mina_maintenance 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30b72d4034c4eb6f181fb96df08913523461fb66
4
- data.tar.gz: 23541e53f02dee948d4499e1537dbb00a4bf0dd3
3
+ metadata.gz: 5bcf6a54ab2e9163df6317274a20a65c34344a12
4
+ data.tar.gz: 6c39640c952523dd8cb3c40b7c29255e821d300e
5
5
  SHA512:
6
- metadata.gz: 4434bcf20eda27d1c33d56cf5df4a256f28836a7b7b8cf7e505eb50771e995ee0601eaab93e7e2d6b2f63abe3fd5d121ca8693abc401f0a751ce65d27d267be5
7
- data.tar.gz: 9e61d1b0168b8780eb09c1ae961ddd39a37b1d2eae592d276a104a855309aec4cf4517b5e44c1663c8f5bd95bfc0b0d646703171a1dc67a2aa959b559c705c25
6
+ metadata.gz: f919d4ea7dffc16c45b575735d57d6670d4273ed7f34d200487329fdab81b58fc32b635850fef9bed8fe34700237b41159ee75ac0a87f2446698991a705865fa
7
+ data.tar.gz: fd583317f8eb136f09b6fd9fb3dd38613573ea41afa47c324ef867492cdc03e28c9bbeee5f76f4785f9f6eacca961b3584d983962e894a0c8609b235f5fc337a
data/README.md CHANGED
@@ -6,10 +6,56 @@ Maintenance Page Support For [Mina](http://nadarei.co/mina). Heavily inspired by
6
6
  ## Installation
7
7
 
8
8
  gem install mina_maintenance
9
-
10
- ## Usage example
9
+
10
+ And require mina_maintenance tasks in your `deploy.rb` file:
11
11
 
12
12
  require 'mina_maintenance/tasks'
13
+
14
+ ## Usage
15
+
16
+ Before using the maintenance tasks, you need to configure your webserver. How you do this depends on how your server is configured, but the following examples should help you on your way.
17
+
18
+ Application servers such as [Passenger](https://www.phusionpassenger.com) and [unicorn](http://unicorn.bogomips.org) requires you to set your public web directory to `current/public`. Both examples below are compatible with this setup.
19
+
20
+ Here is an example config for **nginx**. Note that this is just a part of the complete config, and will probably require modifications.
21
+
22
+ ```
23
+ error_page 503 @503;
24
+
25
+ # Return a 503 error if the maintenance page exists.
26
+ if (-f /var/www/domain.com/shared/public/system/maintenance.html) {
27
+ return 503;
28
+ }
29
+
30
+ location @503 {
31
+ # Serve static assets if found.
32
+ if (-f $request_filename) {
33
+ break;
34
+ }
35
+
36
+ # Set root to the shared directory.
37
+ root /var/www/domain.com/shared/public;
38
+ rewrite ^(.*)$ /system/maintenance.html break;
39
+ }
40
+ ```
41
+
42
+ And here is an example config for **Apache**. This will also need to be modified.
43
+
44
+ ```
45
+ # Create an alias to the maintenance page used as error document.
46
+ Alias "/error" "/var/www/domain.com/shared/public/system/"
47
+ ErrorDocument 503 /error/maintenance.html
48
+
49
+ # Return 503 error if the maintenance page exists.
50
+ RewriteCond /var/www/domain.com/shared/public/system/maintenance.html -f
51
+ RewriteRule !^/error/maintenance.html - [L,R=503]
52
+
53
+ # Redirect all non-static requests to unicorn (or similar).
54
+ # Will not redirect any requests if the maintenance page exists.
55
+ RewriteCond /var/www/domain.com/shared/public/system/maintenance.html !-f
56
+ RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
57
+ RewriteRule ^/(.*)$ balancer://unicornserver%{REQUEST_URI} [P,QSA,L]
58
+ ```
13
59
 
14
60
  ## Available Tasks
15
61
 
@@ -11,9 +11,9 @@ set_default :maintenance_template, File.join(File.expand_path('../templates', __
11
11
  set_default :maintenance_basename, 'maintenance'
12
12
 
13
13
  # ### maintenance_path
14
- # Sets a path to the server's mainenance file on server.
15
- # Default: /public/system/
16
- set_default :maintenance_path, '/public/system/'
14
+ # Sets a path to the server's maintenance file on server.
15
+ # Default: public/system
16
+ set_default :maintenance_path, 'public/system'
17
17
 
18
18
  # ## Control Tasks
19
19
  namespace :maintenance do
@@ -24,7 +24,7 @@ namespace :maintenance do
24
24
  template = settings.maintenance_template
25
25
  result = File.open(template).read
26
26
 
27
- rendered_path = "#{deploy_to}/#{shared_path}/#{settings.maintenance_path}"
27
+ rendered_path = "#{deploy_to}/#{shared_path}/#{settings.maintenance_path}/"
28
28
  rendered_name = "#{settings.maintenance_basename}.html"
29
29
 
30
30
  queue %[
@@ -42,6 +42,6 @@ namespace :maintenance do
42
42
  task :off do
43
43
  queue %[echo "-----> Turning maintenance mode OFF"]
44
44
 
45
- queue! %[rm -f #{deploy_to}/#{shared_path}/public/system/#{settings.maintenance_basename}.html]
45
+ queue! %[rm -f #{deploy_to}/#{shared_path}/#{settings.maintenance_path}/#{settings.maintenance_basename}.html]
46
46
  end
47
- end
47
+ end
@@ -1,3 +1,3 @@
1
1
  module MinaMaintenance
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina_maintenance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Bajur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mina
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description: Maintenance Page Support For Mina
@@ -31,7 +31,7 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - .gitignore
34
+ - ".gitignore"
35
35
  - Gemfile
36
36
  - Gemfile.lock
37
37
  - LICENSE
@@ -52,17 +52,17 @@ require_paths:
52
52
  - lib
53
53
  required_ruby_version: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 2.0.14
65
+ rubygems_version: 2.4.2
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: Maintenance Page Support For Mina