govuk_app_config 4.6.1 → 4.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/docs/healthchecks.md +36 -108
- data/lib/govuk_app_config/govuk_content_security_policy.rb +2 -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: 0f3849d5bf53877e6244bcda92162ec86e9a37c5788a491e1f436af79da3433e
|
4
|
+
data.tar.gz: 8d198f89774cf5962ae877e5437bff4025123c102645ac7d4a2b81b2525ef0c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5c4e6173b2c7b41ff37430b603bb1d04dcc108fd24c4b374f2d4731512ce780fb1dd43d7bdd13a0bdc4e0948be48f4a6a6913cabb337ff1afe5a3110213d650
|
7
|
+
data.tar.gz: 3a810d79466ce2780c3e19b77da1edaf3a98546cc0ddbb28f6e10deb20558bc8a2eac44e1777af90be739138059176401535d75ff1bb918362e855fccb7ce1ca
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 4.6.2
|
2
|
+
|
3
|
+
- Adds a new domain to the security policy for GA ([#248](https://https://github.com/alphagov/govuk_app_config/pull/248))
|
4
|
+
|
1
5
|
# 4.6.1
|
2
6
|
|
3
7
|
- Fixes warning message to refer to correct Sidekiq gem dependency name ([#243](https://github.com/alphagov/govuk_app_config/pull/243)).
|
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,8 @@ 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].freeze
|
22
23
|
|
23
24
|
GOOGLE_STATIC_DOMAINS = %w[www.gstatic.com].freeze
|
24
25
|
|
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.2
|
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-17 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
|