From d9f6554956f543479e42eb00cfeb4474c5f3062c Mon Sep 17 00:00:00 2001 From: Athanasios Voutsadakis Date: Wed, 3 Jan 2018 17:17:26 +0000 Subject: [PATCH 1/3] Add make targets to enable and disable failwhale Also add a couple of convenience targets and bring back the DNS_NAME variable. --- Makefile | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d1536595b..b45f3fbd0 100644 --- a/Makefile +++ b/Makefile @@ -39,25 +39,30 @@ venv/bin/activate: .PHONY: check-env-vars check-env-vars: ## Check mandatory environment variables $(if ${DEPLOY_ENV},,$(error Must specify DEPLOY_ENV)) + $(if ${DNS_NAME},,$(error Must specify DNS_NAME)) .PHONY: sandbox sandbox: ## Set environment to sandbox $(eval export DEPLOY_ENV=sandbox) + $(eval export DNS_NAME="cloudapps.digital") @true .PHONY: preview preview: ## Set environment to preview $(eval export DEPLOY_ENV=preview) + $(eval export DNS_NAME="notify.works") @true .PHONY: staging staging: ## Set environment to staging $(eval export DEPLOY_ENV=staging) + $(eval export DNS_NAME="staging-notify.works") @true .PHONY: production production: ## Set environment to production $(eval export DEPLOY_ENV=production) + $(eval export DNS_NAME="notifications.service.gov.uk") @true .PHONY: dependencies @@ -173,9 +178,8 @@ cf-deploy: ## Deploys the app to Cloud Foundry cf delete -f notify-admin-rollback .PHONY: cf-deploy-prototype -cf-deploy-prototype: ## Deploys the app to Cloud Foundry +cf-deploy-prototype: cf-target ## Deploys the app to Cloud Foundry $(if ${CF_SPACE},,$(error Must specify CF_SPACE)) - cf target -s ${CF_SPACE} cf push -f manifest-prototype-${CF_SPACE}.yml .PHONY: cf-rollback @@ -188,3 +192,23 @@ cf-rollback: ## Rollbacks the app to the previous release .PHONY: cf-push cf-push: cf push -f manifest-${CF_SPACE}.yml + +.PHONY: cf-target +cf-target: check-env-vars + @cf target -o ${CF_ORG} -s ${CF_SPACE} + +.PHONY: cf-failwhale-deployed +cf-failwhale-deployed: + @cf app notify-admin-failwhale --guid || (echo "notify-admin-failwhale is not deployed on ${CF_SPACE}" && exit 1) + +.PHONY: enable-failwhale +enable-failwhale: cf-target cf-failwhale-deployed ## Enable the failwhale app and disable admin + @cf map-route notify-admin-failwhale ${DNS_NAME} --hostname www + @cf unmap-route notify-admin ${DNS_NAME} --hostname www + @echo "Failwhale is enabled" + +.PHONY: disable-failwhale +disable-failwhale: cf-target cf-failwhale-deployed ## Disable the failwhale app and enable admin + @cf map-route notify-admin ${DNS_NAME} --hostname www + @cf unmap-route notify-admin-failwhale ${DNS_NAME} --hostname www + @echo "Failwhale is disabled" From 85c7ecfe647e55e9a1fd1df60d928af5845c8f58 Mon Sep 17 00:00:00 2001 From: Athanasios Voutsadakis Date: Thu, 4 Jan 2018 11:02:18 +0000 Subject: [PATCH 2/3] Update docs about how to enable and disable failwhale --- paas-failwhale/README.md | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/paas-failwhale/README.md b/paas-failwhale/README.md index 25e10f6f4..540e812b5 100644 --- a/paas-failwhale/README.md +++ b/paas-failwhale/README.md @@ -10,21 +10,17 @@ It should already be deployed, but if not you can deploy it by running cf push notify-admin-failwhale -To direct traffic to it you need to update the routes by running +To enable it you need to run - cf map-route notify-admin-failwhale [ENVIRONMENT-URL] --hostname www - cf unmap-route notify-admin [ENVIRONMENT-URL] --hostname www + make enable-failwhale -To remove admin failwhale: +and to disable it - cf map-route notify-admin [ENVIRONMENT-URL] --hostname www - cf unmap-route notify-admin-failwhale [ENVIRONMENT-URL] --hostname www + make disable-failwhale -Where [ENVIRONMENT-URL] would be one of: +Where is any of -- notify.works for preview -- notify-staging.works for staging -- notifications.service.gov.uk for production - -**Make sure you are on the correct environment!** +- preview +- staging +- production From ee64d9bfee54fc900524dfe7a1bb6dc1255f8a88 Mon Sep 17 00:00:00 2001 From: Sakis Date: Thu, 4 Jan 2018 11:02:51 +0000 Subject: [PATCH 3/3] Use backticks around to make it render --- paas-failwhale/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paas-failwhale/README.md b/paas-failwhale/README.md index 540e812b5..95e0ea107 100644 --- a/paas-failwhale/README.md +++ b/paas-failwhale/README.md @@ -19,7 +19,7 @@ and to disable it make disable-failwhale -Where is any of +Where `` is any of - preview - staging