Skip to main content
Last updated: 12 Apr 2023

Deploy an emergency banner

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.

Note

There is also a non-emergency sitewide banner, used to convey important information on GOV.UK which is not deemed emergency level information.

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 Ops manual.

Adding an emergency banner

1. Get the content you will need

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

  • The emergency banner type or campaign class. Must be one of the following:
    • notable-death
    • national-emergency
    • 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). Use a relative URL if the link on the www.gov.uk domain.
  • (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

The banner is deployed by running a rake task in Static. This task stores the banner information in Redis, which modifies the page template used by frontend apps.

  1. Set banner content as environment variables

    CAMPAIGN_CLASS="notable-death|national-emergency|local-emergency"
    HEADING="replace with heading"
    SHORT_DESCRIPTION="replace with desciption"
    LINK="replace with link"
    LINK_TEXT="replace with link text"
    

    Note

    You may need to escape certain characters (including , and ") with a backslash. For example \, or \".

  2. Run the rake task in the app container

    kubectl -n apps exec -i deploy/static -- rake "emergency_banner:deploy[$CAMPAIGN_CLASS,$HEADING,$SHORT_DESCRIPTION,$LINK,$LINK_TEXT]"
    

3. Test with cache bust strings

Most GOV.UK pages have a cache TTL of 5 minutes. After deploying the emergency banner you should expect to see the banner appear on all GOV.UK pages within 10 minutes.

Once the banner deployment completes, wait a minute to allow frontend application caches to clear, and then do a test to see if the deployment has succeeded.

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

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 section.

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 an emergency banner

Run the rake task in the app container:

kubectl -n apps exec -i deploy/static -- rake emergency_banner:remove

Troubleshooting

Background

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

The banner is not showing / not clearing

Usually this is because a cache has not expired or 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 caching. Chrome seems to aggressively cache on occasion. You can also test in an private browser instance.
  • It is possible that the caching layers for the GOV.UK stack have evolved and we need to tweak the scripts to clear new caches that have been set up.
  • You can check if the banner is being rendered by the relevant applications to narrow down the problem:
  • You can also try manually purging the Varnish and CDN caches:
    1. Wait for 2 minutes after the Deploy Emergency Banner job has completed. This will allow the frontend application caches to clear automatically after 60s.
    2. Run the “Clear CDN cache” Jenkins job

Manually testing the Redis key

You can manually check whether the data has been stored in Redis.

  1. Start a Rails console for Static

    kubectl -n apps exec -i deploy/static -- rails console
    
  2. Check the Redis key exists:

    Redis.new.hgetall("emergency_banner")
    
    #> {}
    

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

    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"}
    

Types of emergency banners

Death of a notable person

A large black banner is 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, for example ‘His Royal Highness Henry VIII 1491 to 1547’. The text should link to their official biography.

GOV.UK Homepage

GOV.UK Homepage

Other pages

National emergency (level 1 or category 2)

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

GOV.UK Homepage

GOV.UK Homepage

Other pages

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

A large green banner is 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