heroku_error_pages 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d0d64ddb46d74b54d79d049e8f2dd750716764bac20ccae63f2f862cff2bca3
4
- data.tar.gz: 8e38951b360be3e1410c18510688b94e68d621d6b3271b2feb868ffa5acdbc23
3
+ metadata.gz: 1b985d20291623223aec9fe97d81b3171aa432257116cd01c841383a03a3bf11
4
+ data.tar.gz: b61f8ef5c37a87f836d9aa338cdb167d1e1066dd476446ee4578189071e5fad9
5
5
  SHA512:
6
- metadata.gz: a2acff799e9ee551dabe2eebca7487525e93536529ca800c135c4b3e228a366db0f07cb7567f29f7e72b86fd77e193374edef8db5529c5d669b718be2fbd730a
7
- data.tar.gz: a687320e52b1f8fed12b233f16afbfefbfdd1365e0d7bba79d59441ca538ec91057da45e39b54de8626e1cc7c79e4f43d67db777028a9c418aba852e375a9dd1
6
+ metadata.gz: 95ceb34bb2908d5a5e65cc0b386de1531ca92c9f59e4cf6c400443e68315bf9b1fe351ff3e0abf97ecad35fd004156e1d71f9d0f8d94f5b628f0c0d338e82146
7
+ data.tar.gz: 8570c4cf61a9820ce034df71ab183e760f8910a8cdf640342f0169bd3f238aadd956276026a8d40262b7ea829b3614ca28b7063e793a3f53ca258a1f7b308ef8
data/.rubocop.yml CHANGED
@@ -22,3 +22,6 @@ Metrics/AbcSize:
22
22
 
23
23
  Metrics/MethodLength:
24
24
  Enabled: false
25
+
26
+ Metrics/BlockLength:
27
+ Enabled: false
data/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # HerokuErrorPages
2
2
 
3
- Heroku allows you to configure custom error pages for application/launch errors and maintenance mode. https://devcenter.heroku.com/articles/error-pages#customize-pages
3
+ Heroku allows you to configure [custom error pages](https://devcenter.heroku.com/articles/error-pages#customize-pages) for application errors and maintenance mode.
4
4
 
5
- This gem allows you to easily generate one or both of these pages during your Heroku deployment and store the static HTML on Amazon S3. This means your custom error pages are always using your latest stylesheets. You simply supply the template and S3 configuration variables.
5
+ This gem allows you to developer the pages in your Rails application, generate the pages during Heroku deployments, and store the static HTML on Amazon S3. This means your custom error pages are always kept up-to-date.
6
6
 
7
- ## Installation
7
+ There are 3 areas of configuration:
8
+ - Gem Installation and Configuration
9
+ - AWS Configuration
10
+ - Heroku Configuration
11
+
12
+ ## Gem Installation
8
13
 
9
14
  Install the gem and add to the application's Gemfile by executing:
10
15
 
@@ -14,9 +19,9 @@ If bundler is not being used to manage dependencies, install the gem by executin
14
19
 
15
20
  $ gem install heroku_error_pages
16
21
 
17
- ## Usage
22
+ ## Gem Configuration
18
23
 
19
- Configure the error and/or maintenance pages. For a rails application, create a file like `config/initializers/heroku_error_pages.rb`.
24
+ Configure the error and/or maintenance pages via an initializer in `config/initializers/heroku_error_pages.rb`.
20
25
 
21
26
  Sample configuration:
22
27
 
@@ -45,20 +50,55 @@ HerokuErrorPages.configure do |config|
45
50
  end
46
51
  ```
47
52
 
48
- Add this to your `Procfile` to configure Heroku to deploy your custom pages as part of deployments:
53
+ ## AWS Configuration
54
+
55
+ The AWS user specified in the configuration must have `s3:PutObject` permissions for the specified AWS S3 bucket. The gem does not specify any ACLs for the uploaded files, so the bucket policy must allow public access to the files.
56
+
57
+ The gem prefixes all files with `heroku_error_pages/` to avoid conflicts with other files in the bucket. You can therefore apply a single bucket policy to allow public access to only the files with this prefix.
58
+
59
+ This example policy will allow public access to all files with the prefix `heroku_error_pages/` (make sure you replace `YOUR_BUCKET_NAME_HERE` with your actual bucket name):
60
+
61
+ ```
62
+ {
63
+ "Version": "2012-10-17",
64
+ "Statement": [
65
+ {
66
+ "Sid": "AllowPublicReadForHerokuErrorPages",
67
+ "Effect": "Allow",
68
+ "Principal": "*",
69
+ "Action": "s3:GetObject",
70
+ "Resource": "arn:aws:s3:::YOUR_BUCKET_NAME_HERE/heroku_error_pages/*"
71
+ }
72
+ ]
73
+ ```
74
+
75
+ In order to use a policy for allowing public access, configure your bucket like this:
76
+
77
+ - ☑️ Block public access to buckets and objects granted through new access control lists (ACLs)
78
+ - ☑️ Block public access to buckets and objects granted through any access control lists (ACLs)
79
+ - ⬜ Block public access to buckets and objects granted through new public bucket or access point policies
80
+ - ⬜ Block public and cross-account access to buckets and objects through any public bucket or access point policies
81
+
82
+ ## Heroku Configuration
83
+
84
+ Configure the Heroku `Procfile` to deploy your custom pages as part of deployments:
49
85
 
50
86
  ```
51
87
  release: bundle exec rake heroku_error_pages:deploy
52
88
  ```
53
89
 
54
- You can verify that your error pages are being served correctly out of S3 by navigating there in your browser, eg. `https://your-s3-bucket.s3.amazonaws.com/application_error.html`. Once you are satisfied you can configure Heroku to use your custom error pages:
90
+ This rake task will generate `error_page.html` and/or `maintenance_page.html` and upload all the relevant assets (CSS, JS, images) to the S3 bucket in the `heroku_error_pages/` folder/prefix. This should ensure that the custom error pages have all assets referenced correctly via relative paths.
91
+
92
+ You can verify that your error pages have the necessary permissions and are being served correctly out of S3 by navigating there in your browser, i.e. `https://your-s3-bucket.s3.amazonaws.com/heroku_error_pages/error_page.html` or `https://your-s3-bucket.s3.amazonaws.com/heroku_error_pages/maintenance_page.html`. Once you are satisfied you can configure Heroku to use your custom error pages:
55
93
 
56
94
  ```
57
95
  heroku config:set \
58
- ERROR_PAGE_URL=//your-s3-bucket.s3.amazonaws.com/application_error.html \
59
- MAINTENANCE_PAGE_URL=//your-s3-bucket.s3.amazonaws.com/your_maintenance_page.html
96
+ ERROR_PAGE_URL=//your-s3-bucket.s3.amazonaws.com/heroku_error_pages/error_page.html \
97
+ MAINTENANCE_PAGE_URL=//your-s3-bucket.s3.amazonaws.com/heroku_error_pages/maintenance_page.html
60
98
  ```
61
99
 
100
+ The pages will be refreshed automatically as part of every deployment, which ensures that any style changes are automatically applied.
101
+
62
102
  ## Development
63
103
 
64
104
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HerokuErrorPages
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_error_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaco Pretorius