- Drop support for Ruby 3.0
- Drop support for Ruby 2.7.
- BREAKING: Plek will no longer try to fix malformed service names and will instead raise an ArgumentError.
- Add convenience methods for
Plek.external_url_for
,Plek.asset_root
andPlek.website_root
for consistency in methods. - BREAKING: Remove
Plek.find_uri
,Plek#find_uri
,Plek#asset_uri
andPlek#website_uri
these weren't consistent with full interface and are barely used. UseURI(Plek.find('foo'))
,URI(Plek.asset_uri)
orURI(Plek.website_uri)
instead. - BREAKING: Remove
Plek.current
method, this was deprecated 10 years ago and apps should be usingPlek.new
or shorthand alternatives (Plek.find
)
- Deprecate usage of
Plek.current
this method will be removed in next major version. This adds a warning for users. - Remove public setter methods for
parent_domain
andexternal_domain
. These are not used anywhere so there are no API compatibility issues. - Allow setting
GOVUK_APP_DOMAIN=""
(empty string). Similarly forGOVUK_APP_DOMAIN_EXTERNAL
. This allows single-label domains to be used in service URLs instead of FQDNs, which eliminates a lot of configuration complexity when running on Kubernetes. This also paves the way for eventually retiring Plek, if we want. - Take an optional, comma-separated list of hostnames
PLEK_UNPREFIXABLE_HOSTS
not to be prefixed even whenPLEK_HOSTNAME_PREFIX
is set. This simplifies the configuration of the draft stack in Kubernetes. - Support using
http
as the URL scheme for single-label domains whenPLEK_USE_HTTP_FOR_SINGLE_LABEL_DOMAINS=1
. (A single-label domain looks likecontent-store
, as opposed tocontent-store.test.govuk.digital
.) This is is needed in order to run in Kubernetes without a service mesh, without hard-to-maintain configuration logic to generate domains names depending on the environment.
- Remove #public_asset_host method since it is no longer used by any GOV.UK apps.
- Remove support for 'DEV_DOMAIN' environment variable
- Fallback to
GOVUK_APP_DOMAIN
whenGOVUK_APP_DOMAIN_EXTERNAL
is not set
- Add support for external domains, and the
GOVUK_APP_DOMAIN_EXTERNAL
environment variable. - Add the
external_url_for
method for generating external URLs.
- Consistently return a frozen string from the
Plek.find
method.
- Add
Plek.public_asset_host
for accessingGOVUK_ASSET_HOST
environment variable
- Add
PLEK_HOSTNAME_PREFIX
environment variable, which prepends the contents to the returned hostname
- Add
Plek.find_uri
for accessingURI
objects for any service
- Add
Plek.find
to simplify client interface.
- Remove unused
DEFAULT_PATTERN
constant.
- Add
website_uri
andasset_uri
methods for accessing URI objects
- Allow clients to request scheme-relative URLs
- Allow custom service URLs through individual environment variables
- Allow clients to request HTTP URLs
- Allow overriding the development domain through an environment variable
- Clean up a redundant dependency on the Builder gem
- Add the
asset_root
method for an environment's static assets
- Add the
website_root
method for an environment's web root
- Provide a sensible default app domain in development
- Removed all overrides and rely solely on convention and environment variables
- Removed Plek#environment in favour of standard constructions
-
There's a lot here. If you are confused about anything, please talk to the Infrastructure & Tools team.
-
If you are using
Plek.current.environment
:-
if it's for an api-adapter, you should upgrade to gds-api-adapters >= 4.1.3 and pass in the URL eg change
GdsApi::ContentApi.new(Plek.current.environment)
toGdsApi::ContentApi.new(Plek.current.find('contentapi'))
-
if it's for something else, consider if the configuration can instead be passed in using an initializer in alphagov-deployment. (non-Plek) e.g.:
alphagov-deployment/frontend/to_upload/initializers/preview/mapit.rb
specifies the mapit url by having different initializers per environment rather than by queryingPlek.current.environment
at runtime.
-
-
If using
Plek.new
e.gPlek.new(env_name).find(app)
which would usePlek.current.environment
to source the url. Instead we now pass a domain explicitly:Plek.new('dev.gov.uk').find(app)
. -
If using
Plek.current.find
:-
The old special cases have gone. You will need to change code as follows:
- 'cdn': use the GOVUK_ASSET_ROOT environment variable
- 'www': use the GOVUK_WEBSITE_ROOT environment variable
- 'assets': use
Plek.current.find('static')
- 'publication-preview': use
Plek.current.find('private-frontend')
-
For all other cases,
Plek.current.find
will continue to work as before.
-
-
If you're using:
gds-api-adapters
: ensure you upgrade to at least 4.1.3govuk_content_models
: ensure you upgrade to at least 2.5.0
-
Remember to check not only your app code for Plek usages, but also any initializers it may be configured with capistrano!
-
Plek no longer understands the
test.gov.uk
URLs; all URLs should bedev.gov.uk
instead. Tests which assumedtest.gov.uk
should be changed to reflect this. -
Because plek uses environment variables to configure itself, you will need to set up the correct environment, or plek will fail.
-
For running the app on the dev VM, simply prepend command you use to run the app with
govuk_setenv <appname>
. -
Make sure that your test scripts have a sensible default value for the
GOVUK_APP_DOMAIN
environment variable. NB you should not usegovuk_setenv
as part of your test harness, for the simple reason that you should not be coupling the process of running your tests to a particular deployment environment. -
If you are using whenever, you will want to add the following code to your schedule.rb:
set :job_template, "/usr/local/bin/govuk_setenv <appname> /bin/bash -l -c ':job'"
-