Table of contents

Deploy emergency publishing banners

There are three types of events that would lead GOV.UK to add an emergency banner to the top of each page on the web site; a notable death, a national emergency or a local emergency.

The GOV.UK on-call escalations contact will tell you when you need to publish an emergency banner. They will ensure that the event is legitimate and provide you with the text for the emergency banner. They will also tell you what type of event it is; you do not need to determine the type of event yourself.

If you need to publish the emergency banner out of hours, you will be instructed to do so either by the GOV.UK on-call escalations contact or the Head of GOV.UK.

Contact numbers for those people are in the legacy Opsmanual in a private repo.

Adding emergency publishing banners

1. Content you will need

The GOV.UK on-call escalations contact will supply you with:

  • The emergency banner type or campaign class (one of notable-death, national-emergency or local-emergency)
  • Text for the heading.
  • (Optional) Text for the ‘short description’, which is a sentence displayed under the heading. This is optional.
  • (Optional) A URL for users to find more information (it might not be provided at first).
  • (Optional) Link text that will be displayed for the more information URL (this will default to “More information” if you do not supply it).

2. Deploy the banner using Jenkins

The data for the emergency banner is stored in Redis. Jenkins is used to set the variables.

1) Go to the Jenkins task:

2) Fill in the appropriate variables using the form presented by Jenkins

3) Click Build.

Jenkins Deploy Emergency Banner

NOTE: The jenkins job will also clear all caches. The main page updates immediately, however whitehall and travel advice can take a couple of minutes before the banner appears.

3. Test with cache bust strings

Test the changes by visiting pages and adding a cache-bust string. Remember to change the URL based on the environment you are testing in (integration, staging, production).

You can automate this by using the emergency publishing scraper

For each page:

  • Check the banner displays as expected
  • Double check the information for the header, short description and link are as they should be
  • Test the link if it is present
  • Make sure the banner colour is appropriate - black for a notable death, red for a national emergency, green for a local emergency.

Some example pages to check:

If the banner doesn’t show look at the troubleshooting chapter

If you are in production environment, once the origin cache is purged the CDN cache will be purged automatically. This will clear cache for the top 10 most visited pages.

Once all caches have had time to clear, check that the emergency banner is visible when accessing the same pages as before but without a cache-bust string.


Removing emergency publishing banners

Remove the banner using Jenkins

1) Navigate to the appropriate deploy Jenkins environment (integration, staging or production):

2) Click Build now in the left hand menu.

Jenkins Remove Emergency Banner

Caches will clear automatically.

HELP, the banner won’t go away. Try out some handy hints and tips


Troubleshooting

Background

The information for the emergency banner is stored in Redis. Static is responsible for displaying the data and we use Jenkins to run rake tasks in static to set or delete the appropriate hash in Redis.

The banner is not showing / not clearing

Usually this is because the caching has not cleared properly. This can be at various points in our stack as well as locally in your browser. Things to try:

  • Make sure you are actually looking at a page on the environment you released the banner. All the links in this document go to the production version of GOV.UK. Remember to use the equivalent page for the environment (often staging) on which you are testing/releasing the banner.
  • Test the page with curl to circumvent any browser based in memory caching. Chrome seems to aggressively cache on occasion. You can also test in an incognito browser instance.
  • It is possible that the caching layers for the GOV.UK stack have evolved and we need to tweak the fabric scripts to clear new caches that have been set up.

Manually testing the Redis key

You can manually check whether the data has been stored in Redis by the Jenkins job on one of the frontend machines.

1) From your development machine SSH into a frontend box appropriate to the environment you want to check.

For staging or production: ssh frontend-1.frontend.staging

for integration:

ssh $(ssh integration "govuk_node_list --single-node -c frontend").integration

2) Load a Rails console for static:

govuk_app_console static

3) Check the Redis key exists:

irb(main):001:0> Redis.new.hgetall("emergency_banner")
#> {}

In the above example the key has not been set. A sucessfully set key would return a result similar to the following:

irb(main):001:0> Redis.new.hgetall("emergency_banner")
=> {"campaign_class"=>"notable-death", "heading"=>"The heading", "short_description"=>"The short description", "link"=>"https://www.gov.uk", "link_text"=>"More information about the emergency"}

Manually running the rake task to deploy the emergency banner

If you need to manually run the rake tasks to set the Redis keys for some reason, you can do so (remember to follow the instructions above to clear application template caches, restart Whitehall and purge origin caches afterwards):

1) SSH into a frontend machine appropriate to the environment you are deploying the banner on. For example, for integration:

ssh $(ssh integration "govuk_node_list --single-node -c frontend").integration

for staging or production:

ssh frontend-1.frontend.staging

2) CD into the directory for static:

cd /var/apps/static

3) Run the rake task to create the emergency banner hash in Redis, substituting the quoted data for the parameters:

sudo -u deploy govuk_setenv static bundle exec rake
emergency_banner:deploy[campaign_class,heading,short_description,link,link_text]

The campaign_class is directly injected into the HTML as a class and must be one of

  • notable-death
  • national-emergency
  • local-emergency

For example, if you are deploying an emergency banner for which you have the following information:

  • Type: Death
  • Heading: Alas poor Yorick
  • Short description: I knew him Horatio
  • URL: https://www.gov.uk
  • Link text: Click for more information

You would enter the following command:

sudo -u deploy govuk_setenv static bundle exec rake
emergency_banner:deploy["notable-death","Alas poor Yorick","I knew him
Horatio","https://www.gov.uk","Click for more information"]

Note there are no spaces after the commas between parameters to the rake task.

Quit your SSH session:

exit

Manually running the rake task to remove an emergency banner

1) As above you first need to SSH into a frontend machine:

for staging or production:

ssh frontend-1.frontend.staging

for integration:

ssh $(ssh integration "govuk_node_list --single-node -c frontend").integration

2) CD into the directory for static:

cd /var/apps/static

3) Run the rake task to remove the emergency banner hash from Redis:

sudo -u deploy govuk_setenv static bundle exec rake
emergency_banner:remove

4) Quit your SSH session

exit

Types of emergency banners

Death of a notable person

A large black banner is to be displayed on all GOV.UK pages, including the homepage.

The wording to use in the template will be the official title of the deceased and the years of their life e.g. 'His Royal Highness Henry VIII 1491 to 1547’. The text should link to their official biography.

GOV.UK Homepage

GOV.UK Homepage

Other pages

Notable death

National emergency (level 1 or category 2)

A large red banner is to be displayed on all GOV.UK pages, including the homepage.

GOV.UK Homepage

GOV.UK Homepage

Other pages

National emergency

Localised large-scale emergency (level 2 or category 1)

A large green banner is to be displayed on all GOV.UK pages, including the homepage.

These incidents will not be processed outside of business hours.

GOV.UK Homepage

GOV.UK Homepage

Other pages

Local emergency

This page was last reviewed . It needs to be reviewed again by the page owner #govuk-2ndline.