Republish content
Sometimes it may be necessary to republish content to make it show up on the website. For example if we make an update to govspeak that would require us to re-render and save new HTML for content.
This process varies per app and requires
- Connection to the [VPN][vpn] and
- Production access
Whitehall
If the documents are in Whitehall, there are Rake tasks you can run as outlined below. Try to pick the one most focused to the scope of what you need to republish to avoid unnecessary load. You can monitor the effect on the publishing queue via these Grafana dashboards:
- Run publishing_api:republish:document_by_slug[slug] on Integration
- Run publishing_api:republish:document_by_slug[slug] on Staging
- ⚠️ Run publishing_api:republish:document_by_slug[slug] on Production ⚠️
For organisations, use the organisation_by_slug
rake task:
- Run publishing_api:republish:organisation_by_slug[slug] on Integration
- Run publishing_api:republish:organisation_by_slug[slug] on Staging
- ⚠️ Run publishing_api:republish:organisation_by_slug[slug] on Production ⚠️
For all of a single document type, use the bulk_republish
rake task:
- Run publishing_api:bulk_republish:document_type[DocumentClass] on Integration
- Run publishing_api:bulk_republish:document_type[DocumentClass] on Staging
- ⚠️ Run publishing_api:bulk_republish:document_type[DocumentClass] on Production ⚠️
For example:
/government/case-studies/alexander-dennis-maximum-capacity
publishing_api:bulk_republish:document_type[CaseStudies]
You may wish to test first on Integration.
For a short list of Content IDs, use the documents_by_content_ids
rake task:
- Run publishing_api:bulk_republish:documents_by_content_ids[content_id_1 content_id_2] on Integration
- Run publishing_api:bulk_republish:documents_by_content_ids[content_id_1 content_id_2] on Staging
- ⚠️ Run publishing_api:bulk_republish:documents_by_content_ids[content_id_1 content_id_2] on Production ⚠️
For a significant number of Content IDs, some preparation is needed for this as a CSV file needs to be in place.
- The CSV should have a column called content_id that contains all the relevant IDS. This should be added to the whitehall repository at
lib/tasks/{FILENAME}.csv
. Run the
documents_by_content_ids_from_csv
rake task:After the job has completed, remove the CSV from the repository.
To republish all documents: Caution: this is a lot of content and will take hours to complete. If it is possible to scope the republish do so and use a different task, but if you have made a change such as something in govspeak that will affect the majority of content, this is available. Before running this job confirm with Technical 2nd Line that they are happy for you to proceed as it could cause backed up publishing queues and alerts.
- Run publishing_api:bulk_republish:all on Integration
- Run publishing_api:bulk_republish:all on Staging
- ⚠️ Run publishing_api:bulk_republish:all on Production ⚠️
Content Publisher
If the document is in content publisher, there is a resync Rake task you can run.
You can resync a single document by passing it a content ID and locale:
- Run resync:document[a-content-id:locale] on Integration
- Run resync:document[a-content-id:locale] on Staging
- ⚠️ Run resync:document[a-content-id:locale] on Production ⚠️
or you can resync all documents: