govuk_app_config 6.0.0 → 7.0.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: ee3c6597f85f20d601fea02cc8412c6d8440866e0b151d186e10c7d0d7eb52fa
4
- data.tar.gz: c1b783944841d1b4a9d6dd4941cb3dbfc68d361215927c78c0931d73a1d851e7
3
+ metadata.gz: 76fa770ac62a07fcd63f201603abd10f76cd092f5b8ea632ae85115e63d644f7
4
+ data.tar.gz: 8344992578b29ccca21e15079d5f4ecf07c28efbe416dea31afbb972032c4caa
5
5
  SHA512:
6
- metadata.gz: 98aa6b485b645c630e0b6d25474096e73be88817aef0e65b7767e3740c2da4feb95d69cd4491fb7762949f232a3f73f7105bfd4b05a2cc73c8cd14076851259d
7
- data.tar.gz: db5e291133010b1ddb6c5041a4eaa68fb24bc76920a6f821b1710a66a4e285b97e199cde1371c2d91bdc411708c0a0d0d40d0559e4413c16afa34db4cd4d1af1
6
+ metadata.gz: 936ed693e0d29e65e844bc30d7108553690939a442c9f80c66f924239ec9c5c852733f6f351ad7925ed372fc0d1d12ab0c591af44448fe5d7429df252dc038e6
7
+ data.tar.gz: 3e5ab1885b814cf722e1c856b9778c9360f8afd617e437a713a100f959bcfbe47059c1cac358f9edc3c13cc5747135cc5f8c5755564fc908194afa27ddc669bb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 7.0.0
2
+
3
+ * 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.
4
+ * `GovukStatsd` is deprecated and will be removed in a future major release.
5
+
6
+ ## 6.0.1
7
+
8
+ * Add support for configuring timeouts for puma-based applications
9
+
1
10
  ## 6.0.0
2
11
 
3
12
  * BREAKING: Drop support for Ruby 2.7
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,31 +17,24 @@ Add this line to your application's Gemfile:
17
17
  gem "govuk_app_config"
18
18
  ```
19
19
 
20
- And then execute:
21
-
22
- $ bundle
20
+ Then run `bundle`.
23
21
 
24
22
 
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
 
@@ -53,7 +46,7 @@ Your app will have to have the following environment variables set:
53
46
 
54
47
  - `SENTRY_DSN` - the [Data Source Name (DSN)][dsn] for Sentry
55
48
  - `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`
49
+ - `GOVUK_STATSD_PREFIX` - a Statsd prefix like `govuk.apps.application-name.hostname` (deprecated; use Prometheus instead).
57
50
 
58
51
  [dsn]: https://docs.sentry.io/quickstart/#about-the-dsn
59
52
 
@@ -125,7 +118,19 @@ end
125
118
 
126
119
  `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
120
 
128
- ## Statsd
121
+
122
+ ## Prometheus monitoring
123
+
124
+ Create a `/config/initializers/prometheus.rb` file in the app and add the following
125
+
126
+ ```ruby
127
+ require "govuk_app_config/govuk_prometheus_exporter"
128
+ GovukPrometheusExporter.configure
129
+ ```
130
+
131
+ ## Statsd (deprecated)
132
+
133
+ ⚠️ Statsd support is deprecated and will be removed in a future major release of govuk_app_config.
129
134
 
130
135
  Use `GovukStatsd` to send stats to graphite. It has the same interface as [the Ruby Statsd client](https://github.com/reinh/statsd).
131
136
 
@@ -145,10 +150,12 @@ GovukStatsd.time("account.activate") { @account.activate! }
145
150
  This Gem provides a common "health check" framework for apps. See [the health
146
151
  check docs](docs/healthchecks.md) for more information on how to use it.
147
152
 
153
+
148
154
  ## Rails logging
149
155
 
150
156
  In Rails applications, the application will be configured to send JSON-formatted
151
- logs to `STDOUT` and unstructed logs to `STDERR`.
157
+ logs to `STDOUT` and unstructured logs to `STDERR`.
158
+
152
159
 
153
160
  ## Content Security Policy generation
154
161
 
@@ -163,18 +170,10 @@ app with the following content:
163
170
  GovukContentSecurityPolicy.configure
164
171
  ```
165
172
 
166
- ## i18n rules
173
+ ## Internationalisation rules
167
174
 
168
175
  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
176
 
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
177
 
179
178
  ## License
180
179
 
@@ -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"
@@ -9,7 +9,11 @@ module GovukPuma
9
9
  end
10
10
 
11
11
  # `worker_timeout` specifies how many seconds Puma will wait before terminating a worker.
12
- timeout = ENV.fetch("RAILS_ENV", "development") == "development" ? 3600 : 15
12
+ timeout = if ENV.fetch("RAILS_ENV", "development") == "development"
13
+ 3600
14
+ else
15
+ Integer(ENV.fetch("PUMA_TIMEOUT", 15))
16
+ end
13
17
  config.worker_timeout timeout
14
18
 
15
19
  # When changing the min/max threads for Puma, also consider changing ActiveRecord to match.
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "6.0.0".freeze
2
+ VERSION = "7.0.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.0
4
+ version: 7.0.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-03-29 00:00:00.000000000 Z
11
+ date: 2023-04-11 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.11
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