govuk_app_config 4.6.0 → 4.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/docs/healthchecks.md +36 -108
- data/lib/govuk_app_config/govuk_content_security_policy.rb +3 -1
- data/lib/govuk_app_config/govuk_error.rb +1 -1
- data/lib/govuk_app_config/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cff338c8b3be717888644d1bd0b93df938c222250f13d25977c119fb567ef7fa
|
4
|
+
data.tar.gz: 69141cb68b950829dc7f7c714e426cf1d49ddb9cf679f4d839bb09ffe5283f95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b816ba7e9b980a4473f67f4ef5ecd59b61c26658ccef8bc6daab2d938fac015ea96e1f2edeee101246db31aedd7359ff1c4e5ff7fa533a16e3cbe5783ffc0466
|
7
|
+
data.tar.gz: 8bad47cadbba6ad9a5aa1622a30ccdc13d98ae9588605d18a919ce7f15a439eb541f21550f9d0462a276486f167d138a95abf6f73bb3564a2cc868677f99813c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# 4.6.3
|
2
|
+
|
3
|
+
- Adds `region1.google-analytics.com` to the security policy for GA ([#250](https://github.com/alphagov/govuk_app_config/pull/250))
|
4
|
+
|
5
|
+
# 4.6.2
|
6
|
+
|
7
|
+
- Adds a new domain to the security policy for GA ([#248](https://https://github.com/alphagov/govuk_app_config/pull/248))
|
8
|
+
|
9
|
+
# 4.6.1
|
10
|
+
|
11
|
+
- Fixes warning message to refer to correct Sidekiq gem dependency name ([#243](https://github.com/alphagov/govuk_app_config/pull/243)).
|
12
|
+
|
1
13
|
# 4.6.0
|
2
14
|
|
3
15
|
- Add a warning for apps using GovukError with Sidekiq that don't have sentry-sidekiq installed ([#241](https://github.com/alphagov/govuk_app_config/pull/241)).
|
data/docs/healthchecks.md
CHANGED
@@ -1,47 +1,6 @@
|
|
1
1
|
# Health Checks
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
A check is expected to be a class with the following methods:
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
class CustomCheck
|
9
|
-
def name
|
10
|
-
:the_name_of_the_check
|
11
|
-
end
|
12
|
-
|
13
|
-
def status
|
14
|
-
if critical_condition?
|
15
|
-
:critical
|
16
|
-
elsif warning_condition?
|
17
|
-
:warning
|
18
|
-
else
|
19
|
-
:ok
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Optional
|
24
|
-
def message
|
25
|
-
"This is an optional custom message that will show up in the alert in Icinga"
|
26
|
-
end
|
27
|
-
|
28
|
-
# Optional
|
29
|
-
def details
|
30
|
-
{
|
31
|
-
extra: "This is an optional details hash",
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
# Optional
|
36
|
-
def enabled?
|
37
|
-
true # false if the check is not relevant at this time
|
38
|
-
end
|
39
|
-
end
|
40
|
-
```
|
41
|
-
|
42
|
-
It is expected that these methods may cache their results for performance
|
43
|
-
reasons, if a user wants to ensure they have the latest value they should
|
44
|
-
create a new instance of the check first.
|
3
|
+
GOV.UK apps often have special `/healthcheck` routes, which give an indication of whether the app is running and able to respond to requests. [Read about how health checks are used](https://docs.publishing.service.gov.uk/manual/alerts/app-healthcheck-not-ok.html).
|
45
4
|
|
46
5
|
## Including checks in your app
|
47
6
|
|
@@ -51,7 +10,7 @@ or custom checks you wish to perform.
|
|
51
10
|
For Rails apps:
|
52
11
|
|
53
12
|
```ruby
|
54
|
-
get "/healthcheck", to: GovukHealthcheck.rack_response(
|
13
|
+
get "/healthcheck/ready", to: GovukHealthcheck.rack_response(
|
55
14
|
GovukHealthcheck::SidekiqRedis,
|
56
15
|
GovukHealthcheck::ActiveRecord,
|
57
16
|
CustomCheck,
|
@@ -61,95 +20,64 @@ get "/healthcheck", to: GovukHealthcheck.rack_response(
|
|
61
20
|
It also accepts objects, so classes can be initialized:
|
62
21
|
|
63
22
|
```ruby
|
64
|
-
get "/healthcheck", to: GovukHealthcheck.rack_response(
|
23
|
+
get "/healthcheck/ready", to: GovukHealthcheck.rack_response(
|
65
24
|
InitializedCheck.new(:param),
|
66
25
|
)
|
67
26
|
```
|
68
27
|
|
69
|
-
|
70
|
-
|
71
|
-
A convention used when naming these classes is that it should end with `Check`
|
72
|
-
if it must be subclassed to work, but a concrete class which works on its own
|
73
|
-
doesn't need that suffix. You should aim to follow this convention in your own
|
74
|
-
apps, ideally putting custom health checks into a `Healthcheck` module.
|
75
|
-
|
76
|
-
### `RailsCache`
|
28
|
+
Built-in checks you can use include:
|
77
29
|
|
78
|
-
|
79
|
-
writing and reading back a cache entry called "healthcheck-cache".
|
30
|
+
- `GovukHealthcheck::RailsCache` - checks that the Rails cache store, such as Memcached, is acessible by writing and reading back a cache entry called "healthcheck-cache".
|
80
31
|
|
81
|
-
|
32
|
+
- `GovukHealthcheck::Redis` - checks that the app can connect to Redis by writing and reading back a cache entry called "healthcheck-cache".
|
82
33
|
|
83
|
-
|
34
|
+
- `GovukHealthcheck::Mongoid` - checks that the app has a connection to its Mongo database via Mongoid.
|
84
35
|
|
85
|
-
|
36
|
+
- `GovukHealthcheck::SidekiqRedis` - checks that the app has a connection to Redis via Sidekiq.
|
86
37
|
|
87
|
-
|
38
|
+
- `GovukHealthcheck::ActiveRecord` - checks that the app has a connection to the database via ActiveRecord.
|
88
39
|
|
89
|
-
|
40
|
+
## Writing a custom healthcheck
|
90
41
|
|
91
|
-
|
92
|
-
|
93
|
-
### `ThresholdCheck`
|
94
|
-
|
95
|
-
This class is the basis for a check which compares a value with a warning or a
|
96
|
-
critical threshold.
|
42
|
+
A check is expected to be a class with the following methods:
|
97
43
|
|
98
44
|
```ruby
|
99
|
-
class
|
45
|
+
class CustomCheck
|
100
46
|
def name
|
101
|
-
:
|
102
|
-
end
|
103
|
-
|
104
|
-
def value
|
105
|
-
# get the value to be checked
|
106
|
-
end
|
107
|
-
|
108
|
-
def total
|
109
|
-
# (optional) get the total value to be included in the details as extra
|
110
|
-
# information
|
47
|
+
:the_name_of_the_check
|
111
48
|
end
|
112
49
|
|
113
|
-
def
|
114
|
-
|
50
|
+
def status
|
51
|
+
if critical_condition?
|
52
|
+
:critical
|
53
|
+
elsif warning_condition?
|
54
|
+
:warning
|
55
|
+
else
|
56
|
+
:ok
|
57
|
+
end
|
115
58
|
end
|
116
59
|
|
117
|
-
|
118
|
-
|
60
|
+
# Optional
|
61
|
+
def message
|
62
|
+
"This is an optional custom message that will show up in the alert in Icinga"
|
119
63
|
end
|
120
|
-
end
|
121
|
-
```
|
122
64
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
```ruby
|
129
|
-
class MySidekiqQueueLatencyCheck < GovukHealthcheck::SidekiqQueueLatencyCheck
|
130
|
-
def warning_threshold(queue:)
|
131
|
-
# the warning threshold for a particular queue
|
65
|
+
# Optional
|
66
|
+
def details
|
67
|
+
{
|
68
|
+
extra: "This is an optional details hash",
|
69
|
+
}
|
132
70
|
end
|
133
71
|
|
134
|
-
|
135
|
-
|
72
|
+
# Optional
|
73
|
+
def enabled?
|
74
|
+
true # false if the check is not relevant at this time
|
136
75
|
end
|
137
76
|
end
|
138
77
|
```
|
139
78
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
compares the Sidekiq retry set size with a warning and critical threshold.
|
144
|
-
|
145
|
-
```ruby
|
146
|
-
class MySidekiqRetrySizeCheck < GovukHealthcheck::SidekiqRetrySizeCheck
|
147
|
-
def warning_threshold
|
148
|
-
# the warning threshold for the retry set
|
149
|
-
end
|
79
|
+
It is expected that these methods may cache their results for performance
|
80
|
+
reasons, if a user wants to ensure they have the latest value they should
|
81
|
+
create a new instance of the check first.
|
150
82
|
|
151
|
-
|
152
|
-
# the critical threshold for the retry set
|
153
|
-
end
|
154
|
-
end
|
155
|
-
```
|
83
|
+
Put custom health checks for your app into a `Healtcheck` module. Each custom check class should end with `Check`.
|
@@ -18,7 +18,9 @@ module GovukContentSecurityPolicy
|
|
18
18
|
GOOGLE_ANALYTICS_DOMAINS = %w[www.google-analytics.com
|
19
19
|
ssl.google-analytics.com
|
20
20
|
stats.g.doubleclick.net
|
21
|
-
www.googletagmanager.com
|
21
|
+
www.googletagmanager.com
|
22
|
+
www.region1.google-analytics.com
|
23
|
+
region1.google-analytics.com].freeze
|
22
24
|
|
23
25
|
GOOGLE_STATIC_DOMAINS = %w[www.gstatic.com].freeze
|
24
26
|
|
@@ -35,7 +35,7 @@ module GovukError
|
|
35
35
|
raise GovukError::AlreadyInitialised if is_configured?
|
36
36
|
|
37
37
|
if defined?(Sidekiq) && !defined?(Sentry::Sidekiq)
|
38
|
-
warn "Warning: GovukError is not configured to track Sidekiq errors, install the sidekiq
|
38
|
+
warn "Warning: GovukError is not configured to track Sidekiq errors, install the sentry-sidekiq gem to track them."
|
39
39
|
end
|
40
40
|
|
41
41
|
Sentry.init do |sentry_config|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_app_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstasher
|
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
296
|
- !ruby/object:Gem::Version
|
297
297
|
version: '0'
|
298
298
|
requirements: []
|
299
|
-
rubygems_version: 3.3.
|
299
|
+
rubygems_version: 3.3.16
|
300
300
|
signing_key:
|
301
301
|
specification_version: 4
|
302
302
|
summary: Base configuration for GOV.UK applications
|