Table of contents

Retire an application

To remove an application from our infrastructure take the following steps:

1. Archive database

This is only relevant if the application has a database. You can skip this when retiring frontends.

Grab a copy of the latest production backup of the database and put a copy in the /data/backups/archived directory on the backup-1.management machine. This will then be included in the sync to the offsite backup machines

2. Remove app from puppet

Configure Puppet to remove the app from all servers. Change the app resource, and any database resources to ensure => absent, remove any host and load-balancer entries, but leave the hieradata entries.

See this pull request for an example:

After this has been deployed, remove it entirely. For example:

3. Remove smoke tests

Remove any smokey tests specific to the application.

4. Remove deploy scripts

Remove necessary scripts from the alphagov-deployment and govuk-app-deployment repos.

5. Update Release app

Mark the application as archived in the Release app.

Edit the application in the release app (you’ll need the deploy permission to do this), and check the archived checkbox. This will hide it from the UI.

6. Remove from deploy Jenkins

Remove entry from the deploy Jenkinses. This is managed through govuk-puppet in the common.yml.

7. Move repo

Move the repository to the attic. Go into the repository settings in Github, and change the owner to gds-attic. Once moved, delete any webooks and services that exist for it.

8. Remove from Errbit

Delete the application from Errbit. On all 3 Errbit instances, delete the application (you’ll need the admin permission to do this). The delete button can be found in the application edit screen.

Handling timeouts from the UI:

If the app has received lots of errors, the request to delete it can timeout. If this happens, it will need to be deleted manually from the Rails console as follows:

  • SSH to exception-handler-1.backend.{integration,staging,production}
  • start a Rails console govuk_app_console errbit

  • Find and destroy the application:

a = App.where(:name => "Foo API").first
a.destroy # This could take a long time to return

9. Update Signon

Mark the application as “retired” in signon, if it used it.

Click on the Applications tab. Find the application that is being retired and click the “edit” button. Tick the box that says “This application is being retired”, then save your changes.

10. Update development scripts

Remove from the development-vm directory Procfile and Pinfile:

Leave a comment in the Procfile indicating that the port used to be used by this app, to avoid port conflicts causing a problem running this app locally in the future (eg https://github.digital.cabinet-office.gov.uk/gds/development/pull/149).

11. Check replication script

Check the data replication scripts for anything specific to this application.

Some applications have special case details in https://github.com/alphagov/env-sync-and-backup/. Any relating to the application should be removed.

12. Update DNS

Request any public DNS entries be removed. If the app had an admin UI, it will have had public DNS entries in the publishing.service.gov.uk domain.

Follow the instructions for DNS changes in order to remove these, and ask the infrastructure team to approve any necessary Pull Requests.

13. Update docs

Mark the application as retired in govuk-developer-docs.

14. Remove credentials

Remove any hieradata credential entries for the app:

For example: https://github.com/alphagov/govuk-secrets/pull/408

15. Drop database

If Puppet hasn’t done it (eg for MongoDB databases), drop the database.

16. Remove jobs in CI

If tests were set up, go to CI and choose “Delete Repository” for your project.

17. Remove other references

Do a code search on GitHub to find any references to the application and update or remove them.

18. Unpublish routes

Some applications are responsible for publishing certain routes. If you’re retiring a publishing application, make sure you check if any of its content items need to be unpublished and do it via the Publishing API.

This page is owned by #2ndline and needs to be reviewed