From d7862c3b4fa0161aee00518f50a2834c8291f801 Mon Sep 17 00:00:00 2001 From: Fuhu Xia Date: Thu, 19 Dec 2024 15:16:15 -0500 Subject: [PATCH] prepare for federal government shutdown --- .github/workflows/maintenance.yml | 1 + README.md | 2 +- proxy/nginx-maintenance.conf | 6 +++++ proxy/public/federal-government-shutdown.html | 22 +++++++++++++++++++ tools/set_maintenance.sh | 3 +++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 proxy/public/federal-government-shutdown.html diff --git a/.github/workflows/maintenance.yml b/.github/workflows/maintenance.yml index 479361a4..dc384a7a 100644 --- a/.github/workflows/maintenance.yml +++ b/.github/workflows/maintenance.yml @@ -28,6 +28,7 @@ on: - Normal - Scheduled_Maintenance - Unscheduled_Downtime + - Federal_Shutdown notification: description: 'Notification to Slack?' required: true diff --git a/README.md b/README.md index 7b5d30aa..2242b772 100644 --- a/README.md +++ b/README.md @@ -245,4 +245,4 @@ Continuous Deployment via [GitHub Actions](https://github.com/GSA/catalog.data.g ## Put site into maintenance mode -To block access to the catalog apps (`catalog-web`, `catalog-admin`), set the environment variables (`CATALOG_WEB_MODE`, `CATALOG_ADMIN_MODE`) in the `catalog-proxy` app. Use 'MAINTENANCE' for scheduled downtime, 'DOWN' for unscheduled downtime. Any other value will resume normal operation. \ No newline at end of file +To block access to the catalog apps (`catalog-web`, `catalog-admin`), set the environment variables (`CATALOG_WEB_MODE`, `CATALOG_ADMIN_MODE`) in the `catalog-proxy` app. Use 'MAINTENANCE' for scheduled downtime, 'DOWN' for unscheduled downtime, 'FEDERAL-SHUTDOWN' for the special occasion. Any other value will resume normal operation. Any change on `CATALOG_WEB_MODE` need to be followed by a CloudFront cache clear. \ No newline at end of file diff --git a/proxy/nginx-maintenance.conf b/proxy/nginx-maintenance.conf index dc655b5d..6cf9af3e 100644 --- a/proxy/nginx-maintenance.conf +++ b/proxy/nginx-maintenance.conf @@ -10,6 +10,9 @@ if ($operation_mode = 'MAINTENANCE') { if ($operation_mode = 'DOWN') { set $takedown "2"; } +if ($operation_mode = 'FEDERAL-SHUTDOWN') { + set $takedown "3"; +} # Allow access to the following paths if ($uri = "/api/action/status_show") { set $takedown "0"; @@ -32,6 +35,9 @@ location @maintenance { if ($takedown = "2") { rewrite ^(.*)$ /sitedown.html break; } + if ($takedown = "3") { + rewrite ^(.*)$ /federal-government-shutdown.html break; + } rewrite ^(.*)$ /500.html break; } location = /maintenance.html { diff --git a/proxy/public/federal-government-shutdown.html b/proxy/public/federal-government-shutdown.html new file mode 100644 index 00000000..e572440b --- /dev/null +++ b/proxy/public/federal-government-shutdown.html @@ -0,0 +1,22 @@ + +Site Maintenance + + + +
+ data.gov logo +

Site not available

+
+

+ The Federal Government is currently shut down. As a result, this site is unavailable until further notice. Please visit https://usa.gov for more information. +

+
+
\ No newline at end of file diff --git a/tools/set_maintenance.sh b/tools/set_maintenance.sh index a8706442..540c0e03 100755 --- a/tools/set_maintenance.sh +++ b/tools/set_maintenance.sh @@ -18,6 +18,9 @@ case "$2" in "Unscheduled_Downtime") maintenance_mode="DOWN" ;; + "Federal_Shutdown") + maintenance_mode="FEDERAL-SHUTDOWN" + ;; *) maintenance_mode="NORMAL" ;;