Skip to content

Commit

Permalink
Release v7.0.0: drop unicorn and deprecate statsd.
Browse files Browse the repository at this point in the history
- Remove GovukUnicorn and drop unicorn as a dependency. All our
  production apps are now using Puma.
- Announce the deprecation of GovukStatsd and support for statsd
  metrics. Most of our instrumentation is now Prometheus.
- Some documentation cleanup along the way.
  • Loading branch information
sengi committed Apr 11, 2023
1 parent 024e8f9 commit 71f4f2f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 53 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 7.0.0

* 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.
* `GovukStatsd` is deprecated and will be removed in a future major release.

## 6.0.1

* Add support for configuring timeouts for puma-based applications
Expand Down
55 changes: 27 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Adds the basics of a GOV.UK application:

- Unicorn as a web server
- Puma as a web server
- Error reporting with Sentry
- Statsd client for reporting stats
- Prometheus monitoring for EKS
- Statsd client for reporting stats (deprecated; use Prometheus instead)
- Rails logging
- Content Security Policy generation for frontend apps
- Prometheus monitoring for EKS

## Installation

Expand All @@ -17,31 +17,24 @@ Add this line to your application's Gemfile:
gem "govuk_app_config"
```

And then execute:

$ bundle
Then run `bundle`.


## Unicorn
## Puma

### Configuration

Find or create a `config/unicorn.rb` in the app

At the start of the file insert:
Create a file `config/puma.rb` in the app, containing:

```rb
require "govuk_app_config/govuk_unicorn"
GovukUnicorn.configure(self)
require "govuk_app_config/govuk_puma"
GovukPuma.configure_rails(self)
```

### Usage

To serve an app with unicorn run:
To run an app locally with Puma, run: `bundle exec puma` or `bundle exec rails s`.

```sh
$ bundle exec unicorn -c config/unicorn.rb
```

## Error reporting

Expand All @@ -53,7 +46,7 @@ Your app will have to have the following environment variables set:

- `SENTRY_DSN` - the [Data Source Name (DSN)][dsn] for Sentry
- `SENTRY_CURRENT_ENV` - e.g. "production". Make sure it is [configured to be active](#active-sentry-environments).
- `GOVUK_STATSD_PREFIX` - a Statsd prefix like `govuk.apps.application-name.hostname`
- `GOVUK_STATSD_PREFIX` - a Statsd prefix like `govuk.apps.application-name.hostname` (deprecated; use Prometheus instead).

[dsn]: https://docs.sentry.io/quickstart/#about-the-dsn

Expand Down Expand Up @@ -125,7 +118,19 @@ end

`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).

## Statsd

## Prometheus monitoring

Create a `/config/initializers/prometheus.rb` file in the app and add the following

```ruby
require "govuk_app_config/govuk_prometheus_exporter"
GovukPrometheusExporter.configure
```

## Statsd (deprecated)

⚠️ Statsd support is deprecated and will be removed in a future major release of govuk_app_config.

Use `GovukStatsd` to send stats to graphite. It has the same interface as [the Ruby Statsd client](https://github.com/reinh/statsd).

Expand All @@ -145,10 +150,12 @@ GovukStatsd.time("account.activate") { @account.activate! }
This Gem provides a common "health check" framework for apps. See [the health
check docs](docs/healthchecks.md) for more information on how to use it.


## Rails logging

In Rails applications, the application will be configured to send JSON-formatted
logs to `STDOUT` and unstructed logs to `STDERR`.
logs to `STDOUT` and unstructured logs to `STDERR`.


## Content Security Policy generation

Expand All @@ -163,18 +170,10 @@ app with the following content:
GovukContentSecurityPolicy.configure
```

## i18n rules
## Internationalisation rules

Some frontend apps support languages that are not defined in the i18n gem. This provides them with our own custom rules for these languages.

## Prometheus monitoring for EKS

Create a `/config/initializers/prometheus.rb` file in the app and add the following

```ruby
require "govuk_app_config/govuk_prometheus_exporter"
GovukPrometheusExporter.configure
```

## License

Expand Down
1 change: 0 additions & 1 deletion govuk_app_config.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Gem::Specification.new do |spec|
spec.add_dependency "sentry-rails", "~> 5.3"
spec.add_dependency "sentry-ruby", "~> 5.3"
spec.add_dependency "statsd-ruby", "~> 1.5"
spec.add_dependency "unicorn", "~> 6.1"

spec.add_development_dependency "byebug"
spec.add_development_dependency "climate_control"
Expand Down
3 changes: 0 additions & 3 deletions lib/govuk_app_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
require "govuk_app_config/govuk_error"
require "govuk_app_config/govuk_proxy/static_proxy"
require "govuk_app_config/govuk_healthcheck"
# This require is deprecated and should be removed on next major version bump
# and should be required by applications directly.
require "govuk_app_config/govuk_unicorn"
require "govuk_app_config/govuk_prometheus_exporter"

if defined?(Rails)
Expand Down
20 changes: 0 additions & 20 deletions lib/govuk_app_config/govuk_unicorn.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/govuk_app_config/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module GovukAppConfig
VERSION = "6.0.1".freeze
VERSION = "7.0.0".freeze
end

0 comments on commit 71f4f2f

Please sign in to comment.