govuk_app_config 6.0.1 → 7.1.0

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
  SHA256:
3
- metadata.gz: 59fb9ea4411ba3ec2be3af84e9888920a6ca07547bfcd199d00b9c921a461639
4
- data.tar.gz: aeaea12af9e8ca7612d39c002bd5d5658e5683477f667b5a9419bd1f9529feb2
3
+ metadata.gz: 55aadf4fdd96125cdacca3f50768c74005433fecadc2271248ec9d59973b5f80
4
+ data.tar.gz: 577a4e8061b5458e912d1ab16236c7011f8695c53fd8427a3378529c482466cc
5
5
  SHA512:
6
- metadata.gz: c46413f09bb129baefa17951e539b8304faaa85c6eae9c7be8fd410677f322c67b65b091b01918555d450518692dd12348b8212cb039dbae6cd429959f8b818b
7
- data.tar.gz: 5bafc15ab122c9088039093ed786420dc080bd7f20265157e536e0388133d44707c4146bd8d619a0926f13883ce8c314371f0985e4ce7087d1998e8d413dc59a
6
+ metadata.gz: 5736f71ea147e470900633ea0a46625b316703a38d636b18b30b5ad616af62b715f4c990953cc97c7950fdee3f5226629938d1e5f84c06a6373a36a194cda8ff
7
+ data.tar.gz: af25d35eb1873b93b7848a12f406a4c83dcde832b9af598d2263815bc4be071bf6c20ca5300f23a86102e4afe99cd226687dc3673341960a91059ff75c400111
data/CHANGELOG.md CHANGED
@@ -1,8 +1,17 @@
1
- ## 6.0.1
1
+ # 7.1.0
2
+
3
+ * `GovukError` now allows specifying any name for the Sentry environment tag via the `SENTRY_CURRENT_ENV` environment variable. The environment name no longer has to match one of a fixed set of strings in order for `GovukError` to log events to Sentry.
4
+
5
+ # 7.0.0
6
+
7
+ * BREAKING: Remove [unicorn](https://rubygems.org/gems/unicorn/) and `GovukUnicorn`. All production GOV.UK apps are now using [Puma](https://rubygems.org/gems/puma/) instead.
8
+ * `GovukStatsd` is deprecated and will be removed in a future major release.
9
+
10
+ # 6.0.1
2
11
 
3
12
  * Add support for configuring timeouts for puma-based applications
4
13
 
5
- ## 6.0.0
14
+ # 6.0.0
6
15
 
7
16
  * BREAKING: Drop support for Ruby 2.7
8
17
  * Register the Prometheus exporter in Sinatra middleware
data/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Adds the basics of a GOV.UK application:
4
4
 
5
- - Unicorn as a web server
5
+ - Puma as a web server
6
6
  - Error reporting with Sentry
7
- - Statsd client for reporting stats
7
+ - Prometheus monitoring for EKS
8
+ - Statsd client for reporting stats (deprecated; use Prometheus instead)
8
9
  - Rails logging
9
10
  - Content Security Policy generation for frontend apps
10
- - Prometheus monitoring for EKS
11
11
 
12
12
  ## Installation
13
13
 
@@ -17,43 +17,34 @@ Add this line to your application's Gemfile:
17
17
  gem "govuk_app_config"
18
18
  ```
19
19
 
20
- And then execute:
20
+ Then run `bundle`.
21
21
 
22
- $ bundle
23
22
 
24
-
25
- ## Unicorn
23
+ ## Puma
26
24
 
27
25
  ### Configuration
28
26
 
29
- Find or create a `config/unicorn.rb` in the app
30
-
31
- At the start of the file insert:
27
+ Create a file `config/puma.rb` in the app, containing:
32
28
 
33
29
  ```rb
34
- require "govuk_app_config/govuk_unicorn"
35
- GovukUnicorn.configure(self)
30
+ require "govuk_app_config/govuk_puma"
31
+ GovukPuma.configure_rails(self)
36
32
  ```
37
33
 
38
34
  ### Usage
39
35
 
40
- To serve an app with unicorn run:
36
+ To run an app locally with Puma, run: `bundle exec puma` or `bundle exec rails s`.
41
37
 
42
- ```sh
43
- $ bundle exec unicorn -c config/unicorn.rb
44
- ```
45
38
 
46
39
  ## Error reporting
47
40
 
48
41
  ### Automatic error reporting
49
42
 
50
- If you include `govuk_app_config` in your `Gemfile`, Rails' autoloading mechanism will make sure that your application is configured to send errors to Sentry.
51
-
52
- Your app will have to have the following environment variables set:
43
+ If you include `govuk_app_config` in your `Gemfile` and set the following environment variables, your application will automatically log errors to Sentry.
53
44
 
54
45
  - `SENTRY_DSN` - the [Data Source Name (DSN)][dsn] for Sentry
55
- - `SENTRY_CURRENT_ENV` - e.g. "production". Make sure it is [configured to be active](#active-sentry-environments).
56
- - `GOVUK_STATSD_PREFIX` - a Statsd prefix like `govuk.apps.application-name.hostname`
46
+ - `SENTRY_CURRENT_ENV` - the `environment` tag to pass to Sentry, for example `production`
47
+ - `GOVUK_STATSD_PREFIX` - a Statsd prefix like `govuk.apps.application-name.hostname` (deprecated; statsd functionality will be removed in a future release)
57
48
 
58
49
  [dsn]: https://docs.sentry.io/quickstart/#about-the-dsn
59
50
 
@@ -80,18 +71,6 @@ GovukError.notify(
80
71
  )
81
72
  ```
82
73
 
83
- ### Active Sentry environments
84
-
85
- GovukError will only send errors to Sentry if your `SENTRY_CURRENT_ENV` matches one of the 'active environments' in the [default configuration](https://github.com/alphagov/govuk_app_config/blob/master/lib/govuk_app_config/govuk_error/configure.rb). This is to prevent temporary test environments from flooding our Sentry account with errors.
86
-
87
- You can add your environment to the list of active Sentry environments like so:
88
-
89
- ```ruby
90
- GovukError.configure do |config|
91
- config.enabled_environments << "my-test-environment"
92
- end
93
- ```
94
-
95
74
  ### Error configuration
96
75
 
97
76
  You can exclude certain errors from being reported using this:
@@ -125,7 +104,19 @@ end
125
104
 
126
105
  `GovukError.configure` has the same options as the Sentry client, Raven. See [the Raven docs for all configuration options](https://docs.sentry.io/clients/ruby/config).
127
106
 
128
- ## Statsd
107
+
108
+ ## Prometheus monitoring
109
+
110
+ Create a `/config/initializers/prometheus.rb` file in the app and add the following
111
+
112
+ ```ruby
113
+ require "govuk_app_config/govuk_prometheus_exporter"
114
+ GovukPrometheusExporter.configure
115
+ ```
116
+
117
+ ## Statsd (deprecated)
118
+
119
+ ⚠️ Statsd support is deprecated and will be removed in a future major release of govuk_app_config.
129
120
 
130
121
  Use `GovukStatsd` to send stats to graphite. It has the same interface as [the Ruby Statsd client](https://github.com/reinh/statsd).
131
122
 
@@ -145,10 +136,12 @@ GovukStatsd.time("account.activate") { @account.activate! }
145
136
  This Gem provides a common "health check" framework for apps. See [the health
146
137
  check docs](docs/healthchecks.md) for more information on how to use it.
147
138
 
139
+
148
140
  ## Rails logging
149
141
 
150
142
  In Rails applications, the application will be configured to send JSON-formatted
151
- logs to `STDOUT` and unstructed logs to `STDERR`.
143
+ logs to `STDOUT` and unstructured logs to `STDERR`.
144
+
152
145
 
153
146
  ## Content Security Policy generation
154
147
 
@@ -163,18 +156,10 @@ app with the following content:
163
156
  GovukContentSecurityPolicy.configure
164
157
  ```
165
158
 
166
- ## i18n rules
159
+ ## Internationalisation rules
167
160
 
168
161
  Some frontend apps support languages that are not defined in the i18n gem. This provides them with our own custom rules for these languages.
169
162
 
170
- ## Prometheus monitoring for EKS
171
-
172
- Create a `/config/initializers/prometheus.rb` file in the app and add the following
173
-
174
- ```ruby
175
- require "govuk_app_config/govuk_prometheus_exporter"
176
- GovukPrometheusExporter.configure
177
- ```
178
163
 
179
164
  ## License
180
165
 
@@ -28,7 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "sentry-rails", "~> 5.3"
29
29
  spec.add_dependency "sentry-ruby", "~> 5.3"
30
30
  spec.add_dependency "statsd-ruby", "~> 1.5"
31
- spec.add_dependency "unicorn", "~> 6.1"
32
31
 
33
32
  spec.add_development_dependency "byebug"
34
33
  spec.add_development_dependency "climate_control"
@@ -13,19 +13,6 @@ module GovukError
13
13
  end
14
14
 
15
15
  def set_up_defaults
16
- # These are the environments (described by the `SENTRY_CURRENT_ENV`
17
- # ENV variable) where we want to capture Sentry errors. If
18
- # `SENTRY_CURRENT_ENV` isn't in this list, or isn't defined, then
19
- # don't capture the error.
20
- self.enabled_environments = %w[
21
- integration-blue-aws
22
- integration-eks
23
- staging
24
- staging-eks
25
- production
26
- production-eks
27
- ]
28
-
29
16
  self.excluded_exceptions = [
30
17
  # Default ActionDispatch rescue responses
31
18
  "ActionController::RoutingError",
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "6.0.1".freeze
2
+ VERSION = "7.1.0".freeze
3
3
  end
@@ -3,9 +3,6 @@ require "govuk_app_config/govuk_statsd"
3
3
  require "govuk_app_config/govuk_error"
4
4
  require "govuk_app_config/govuk_proxy/static_proxy"
5
5
  require "govuk_app_config/govuk_healthcheck"
6
- # This require is deprecated and should be removed on next major version bump
7
- # and should be required by applications directly.
8
- require "govuk_app_config/govuk_unicorn"
9
6
  require "govuk_app_config/govuk_prometheus_exporter"
10
7
 
11
8
  if defined?(Rails)
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: 6.0.1
4
+ version: 7.1.0
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: 2023-04-05 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -134,20 +134,6 @@ dependencies:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: '1.5'
137
- - !ruby/object:Gem::Dependency
138
- name: unicorn
139
- requirement: !ruby/object:Gem::Requirement
140
- requirements:
141
- - - "~>"
142
- - !ruby/object:Gem::Version
143
- version: '6.1'
144
- type: :runtime
145
- prerelease: false
146
- version_requirements: !ruby/object:Gem::Requirement
147
- requirements:
148
- - - "~>"
149
- - !ruby/object:Gem::Version
150
- version: '6.1'
151
137
  - !ruby/object:Gem::Dependency
152
138
  name: byebug
153
139
  requirement: !ruby/object:Gem::Requirement
@@ -313,7 +299,6 @@ files:
313
299
  - lib/govuk_app_config/govuk_proxy/static_proxy.rb
314
300
  - lib/govuk_app_config/govuk_puma.rb
315
301
  - lib/govuk_app_config/govuk_statsd.rb
316
- - lib/govuk_app_config/govuk_unicorn.rb
317
302
  - lib/govuk_app_config/rails_ext/action_dispatch/debug_exceptions.rb
318
303
  - lib/govuk_app_config/railtie.rb
319
304
  - lib/govuk_app_config/version.rb
@@ -336,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
336
321
  - !ruby/object:Gem::Version
337
322
  version: '0'
338
323
  requirements: []
339
- rubygems_version: 3.4.10
324
+ rubygems_version: 3.4.12
340
325
  signing_key:
341
326
  specification_version: 4
342
327
  summary: Base configuration for GOV.UK applications
@@ -1,20 +0,0 @@
1
- module GovukUnicorn
2
- def self.configure(config)
3
- config.worker_processes Integer(ENV.fetch("UNICORN_WORKER_PROCESSES", 2))
4
-
5
- config.timeout Integer(ENV.fetch("UNICORN_TIMEOUT", 60))
6
-
7
- if ENV["GOVUK_APP_LOGROOT"]
8
- config.stdout_path "#{ENV['GOVUK_APP_LOGROOT']}/app.out.log"
9
- config.stderr_path "#{ENV['GOVUK_APP_LOGROOT']}/app.err.log"
10
- end
11
-
12
- config.before_exec do |_server|
13
- next unless ENV["GOVUK_APP_ROOT"]
14
-
15
- ENV["BUNDLE_GEMFILE"] = "#{ENV['GOVUK_APP_ROOT']}/Gemfile"
16
- end
17
-
18
- config.check_client_connection true
19
- end
20
- end