From 1187e08dec77c782ea11ba4c87fa464353462485 Mon Sep 17 00:00:00 2001 From: Malcolm Baig Date: Wed, 27 Mar 2024 13:09:52 +0000 Subject: [PATCH] Remove old PaaS jobs from Makefile These are jobs and scripts that were used when Find was still deployed to GOVUK PaaS. They are no longer required now that Find deploys to AKS. --- Makefile | 33 --------------------------------- bin/download-db-backup | 31 ------------------------------- bin/restore-db | 26 -------------------------- 3 files changed, 90 deletions(-) delete mode 100755 bin/download-db-backup delete mode 100755 bin/restore-db diff --git a/Makefile b/Makefile index 98ca284dc..932a07333 100644 --- a/Makefile +++ b/Makefile @@ -79,39 +79,6 @@ install-fetch-config: ## Install the fetch-config script, for viewing/editing se && chmod +x bin/fetch_config.rb \ || true -.PHONY: set-space-developer -set-space-developer: read-deployment-config ## make dev set-space-developer USER_ID=first.last@digital.education.gov.uk - $(if $(USER_ID), , $(error Missing environment variable "USER_ID", USER_ID required for this command to run)) - cf set-space-role ${USER_ID} dfe ${SPACE} SpaceDeveloper - -.PHONY: unset-space-developer -unset-space-developer: read-deployment-config ## make dev unset-space-developer USER_ID=first.last@digital.education.gov.uk - $(if $(USER_ID), , $(error Missing environment variable "USER_ID", USER_ID required for this command to run)) - cf unset-space-role ${USER_ID} dfe ${SPACE} SpaceDeveloper - -stop-app: read-deployment-config ## Stops api app, make dev stop-app CONFIRM_STOP=1 - $(if $(CONFIRM_STOP), , $(error stop-app can only run with CONFIRM_STOP)) - cf target -s ${SPACE} - cf stop ${FLT_APP_NAME} - -get-postgres-instance-guid: read-deployment-config ## Gets the postgres service instance's guid - cf target -s ${SPACE} > /dev/null - cf service ${POSTGRES_DATABASE_NAME} --guid - $(eval DB_INSTANCE_GUID=$(shell cf service ${POSTGRES_DATABASE_NAME} --guid)) - -rename-postgres-service: read-deployment-config ## make dev rename-postgres-service NEW_NAME_SUFFIX=old CONFIRM_RENAME - $(if $(CONFIRM_RENAME), , $(error can only run with CONFIRM_RENAME)) - $(if $(NEW_NAME_SUFFIX), , $(error NEW_NAME_SUFFIX is required)) - cf target -s ${SPACE} > /dev/null - cf rename-service ${POSTGRES_DATABASE_NAME} ${POSTGRES_DATABASE_NAME}-$(NEW_NAME_SUFFIX) - -restore-data-from-backup: read-deployment-config # make production restore-data-from-backup CONFIRM_RESTORE=YES BACKUP_FILENAME="find-a-lost-trn-production-pg-svc-2022-04-28-01" - @if [[ "$(CONFIRM_RESTORE)" != YES ]]; then echo "Please enter "CONFIRM_RESTORE=YES" to run workflow"; exit 1; fi - $(eval export AZURE_BACKUP_STORAGE_ACCOUNT_NAME=$(AZURE_BACKUP_STORAGE_ACCOUNT_NAME)) - $(if $(BACKUP_FILENAME), , $(error can only run with BACKUP_FILENAME, eg BACKUP_FILENAME="find-a-lost-trn-production-pg-svc-2022-04-28-01")) - bin/download-db-backup ${AZURE_BACKUP_STORAGE_ACCOUNT_NAME} ${AZURE_BACKUP_STORAGE_CONTAINER_NAME} ${BACKUP_FILENAME}.tar.gz - bin/restore-db ${DEPLOY_ENV} ${CONFIRM_RESTORE} ${SPACE} ${BACKUP_FILENAME}.sql ${POSTGRES_DATABASE_NAME} - terraform-init: bin/terrafile [[ "${SP_AUTH}" != "true" ]] && az account set -s $(AZURE_SUBSCRIPTION) || true ./bin/terrafile -p terraform/aks/vendor/modules -f terraform/aks/workspace_variables/$(CONFIG)_Terrafile diff --git a/bin/download-db-backup b/bin/download-db-backup deleted file mode 100755 index 722df22d6..000000000 --- a/bin/download-db-backup +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -set -eu - -AZURE_BACKUP_STORAGE_ACCOUNT_NAME=$1 -AZURE_BACKUP_STORAGE_CONTAINER_NAME=$2 -BACKUP_FILENAME=$3 - -if [[ -z "${AZURE_BACKUP_STORAGE_ACCOUNT_NAME}" ]]; then - echo "AZURE_BACKUP_STORAGE_ACCOUNT_NAME environment variable not set" - exit 1 -fi -if [[ -z "${AZURE_BACKUP_STORAGE_CONTAINER_NAME}" ]]; then - echo "AZURE_BACKUP_STORAGE_CONTAINER_NAME environment variable not set" - exit 1 -fi - -if [[ -z "${BACKUP_FILENAME}" ]]; then - echo "BACKUP_FILENAME environment variable not set" - exit 1 -fi - -Exists=$(az storage blob exists --account-name ${AZURE_BACKUP_STORAGE_ACCOUNT_NAME} -c ${AZURE_BACKUP_STORAGE_CONTAINER_NAME} -n ${BACKUP_FILENAME} -o tsv) - -if [[ "${Exists}" = "False" ]]; then - echo "There are no files found matching the filename ${BACKUP_FILENAME} in container ${AZURE_BACKUP_STORAGE_CONTAINER_NAME}" - exit 1 -else - echo "File ${BACKUP_FILENAME} found in container ${AZURE_BACKUP_STORAGE_CONTAINER_NAME}. Downloading" - az storage blob download --account-name ${AZURE_BACKUP_STORAGE_ACCOUNT_NAME} -c ${AZURE_BACKUP_STORAGE_CONTAINER_NAME} -n ${BACKUP_FILENAME} -f ${BACKUP_FILENAME} - tar -xvzf "${BACKUP_FILENAME}" -fi diff --git a/bin/restore-db b/bin/restore-db deleted file mode 100755 index 8449f8c20..000000000 --- a/bin/restore-db +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -set -eu -CF_ORG_NAME='dfe' -DEPLOY_ENV=$1 -CONFIRM_RESTORE=$2 -SPACE=$3 -BACKUP_FILENAME=$4 -POSTGRES_DATABASE_NAME=$5 - -if [[ -z "${DEPLOY_ENV}" ]]; then - echo "DEPLOY_ENV environment variable not set" - exit 1 -fi - -if [[ -z "${SPACE}" ]]; then - echo "SPACE environment variable not set" - exit 1 -fi - -if [[ ! -f "${BACKUP_FILENAME}" ]]; then - echo "${BACKUP_FILENAME} does not exist." - exit 1 -else - cf target -o "${CF_ORG_NAME}" -s "${SPACE}" - cf conduit ${POSTGRES_DATABASE_NAME} -- psql < "${BACKUP_FILENAME}" -fi