| 
 | 1 | +##########################  | 
 | 2 | +# Bootstrapping variables  | 
 | 3 | +##########################  | 
 | 4 | +export STAGE ?= dev  | 
 | 5 | +export APP_NAME ?= gfe-db  | 
 | 6 | +export AWS_ACCOUNT ?= $(shell aws sts get-caller-identity --query Account --output text)  | 
 | 7 | +export REGION ?= us-east-1  | 
 | 8 | + | 
 | 9 | +export DATA_BUCKET_NAME ?= ${STAGE}-${APP_NAME}-${AWS_ACCOUNT}-${REGION}  | 
 | 10 | +export ECR_BASE_URI ?= ${AWS_ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com  | 
 | 11 | +export BUILD_REPOSITORY ?= ${STAGE}-${APP_NAME}-build-service  | 
 | 12 | +export LOAD_REPOSITORY ?= ${STAGE}-${APP_NAME}-load-service  | 
 | 13 | + | 
 | 14 | +target:  | 
 | 15 | +	$(info ${HELP_MESSAGE})  | 
 | 16 | +	@exit 0  | 
 | 17 | + | 
 | 18 | +deploy: check-env ##=> Deploy services  | 
 | 19 | +	$(info [*] Deploying ${APP_NAME} to ${AWS_ACCOUNT}...)  | 
 | 20 | +	$(MAKE) deploy.infrastructure  | 
 | 21 | +	$(MAKE) deploy.database  | 
 | 22 | +	$(MAKE) deploy.pipeline  | 
 | 23 | +	@echo "Finished deploying ${APP_NAME}."  | 
 | 24 | + | 
 | 25 | +check-env:  | 
 | 26 | +ifndef AWS_PROFILE  | 
 | 27 | +$(error AWS_PROFILE is not set. Please select an AWS profile to use.)  | 
 | 28 | +endif  | 
 | 29 | +ifndef NEO4J_USERNAME  | 
 | 30 | +$(error NEO4J_USERNAME is not set.)  | 
 | 31 | +endif  | 
 | 32 | +ifndef NEO4J_PASSWORD  | 
 | 33 | +$(error NEO4J_PASSWORD is not set.)  | 
 | 34 | +endif  | 
 | 35 | +ifndef GITHUB_PERSONAL_ACCESS_TOKEN  | 
 | 36 | +$(error GITHUB_PERSONAL_ACCESS_TOKEN is not set.)  | 
 | 37 | +endif  | 
 | 38 | +	@echo "Found environment variables"  | 
 | 39 | + | 
 | 40 | +# Deploy specific stacks  | 
 | 41 | +deploy.infrastructure:  | 
 | 42 | +	$(MAKE) -C gfe-db/infrastructure/ deploy  | 
 | 43 | + | 
 | 44 | +deploy.database:  | 
 | 45 | +	$(MAKE) -C gfe-db/database/ deploy  | 
 | 46 | + | 
 | 47 | +deploy.pipeline:  | 
 | 48 | +	$(MAKE) -C gfe-db/pipeline/ deploy  | 
 | 49 | + | 
 | 50 | +delete: ##=> Delete services  | 
 | 51 | +	$(info [*] Deleting ${APP_NAME} in ${AWS_ACCOUNT}...)  | 
 | 52 | +	$(MAKE) delete.pipeline  | 
 | 53 | +	$(MAKE) delete.database  | 
 | 54 | +	$(MAKE) delete.infrastructure  | 
 | 55 | +	@echo "Finished deleting ${APP_NAME}."  | 
 | 56 | + | 
 | 57 | +# Delete specific stacks  | 
 | 58 | +delete.infrastructure:  | 
 | 59 | +	$(MAKE) -C gfe-db/infrastructure/ delete  | 
 | 60 | + | 
 | 61 | +delete.database:  | 
 | 62 | +	$(MAKE) -C gfe-db/database/ delete  | 
 | 63 | + | 
 | 64 | +delete.pipeline:  | 
 | 65 | +	$(MAKE) -C gfe-db/pipeline/ delete  | 
 | 66 | + | 
 | 67 | +# run: ##=> Load an IMGT/HLA release version; make run release=3450 align=False kir=False mem_profile=False limit=1000  | 
 | 68 | +# 	$(info [*] Starting StepFunctions execution for release $(release))  | 
 | 69 | + | 
 | 70 | +# #	@# TODO: Add validation for positional arguments: release, align, kir, mem_profile, limit  | 
 | 71 | +# 	@echo "Execution running:"  | 
 | 72 | +# 	@aws stepfunctions start-execution \  | 
 | 73 | +# 	 	--state-machine-arn $$(aws ssm get-parameter --name "/${APP_NAME}/${STAGE}/${REGION}/UpdatePipelineArn" | jq -r '.Parameter.Value') \  | 
 | 74 | +# 	 	--input "{\"params\":{\"environment\":{\"RELEASES\":\"$(release)\",\"ALIGN\":\"False\",\"KIR\":\"False\",\"MEM_PROFILE\":\"False\",\"LIMIT\":\"$(limit)\"}}}" | jq '.executionArn'  | 
 | 75 | + | 
 | 76 | +define HELP_MESSAGE  | 
 | 77 | + | 
 | 78 | +	Environment variables:  | 
 | 79 | + | 
 | 80 | +	STAGE: "${STAGE}"  | 
 | 81 | +		Description: Feature branch name used as part of stacks name  | 
 | 82 | + | 
 | 83 | +	APP_NAME: "${APP_NAME}"  | 
 | 84 | +		Description: Stack Name already deployed  | 
 | 85 | + | 
 | 86 | +	AWS_ACCOUNT: "${AWS_ACCOUNT}":  | 
 | 87 | +		Description: AWS account ID for deployment  | 
 | 88 | + | 
 | 89 | +	REGION: "${REGION}":  | 
 | 90 | +		Description: AWS region for deployment  | 
 | 91 | + | 
 | 92 | +	DATA_BUCKET_NAME "$${DATA_BUCKET_NAME}"  | 
 | 93 | +		Description: Name of the S3 bucket for data, config and logs  | 
 | 94 | + | 
 | 95 | +	ECR_BASE_URI: "$${ECR_BASE_URI}"  | 
 | 96 | +		Description: Base URI for AWS Elastic Container Registry  | 
 | 97 | + | 
 | 98 | +	BUILD_REPOSITORY: "$${BUILD_REPOSITORY}"  | 
 | 99 | +		Description: Name of the ECR repository for the build service  | 
 | 100 | + | 
 | 101 | +	LOAD_REPOSITORY: "$${LOAD_REPOSITORY}"  | 
 | 102 | +		Description: Name of the ECR repository for the load service  | 
 | 103 | + | 
 | 104 | +	Common usage:  | 
 | 105 | + | 
 | 106 | +	...::: Deploy all CloudFormation based services :::...  | 
 | 107 | +	$ make deploy  | 
 | 108 | + | 
 | 109 | +	...::: Run the StepFunctions State Machine to load Neo4j :::...  | 
 | 110 | +	$ make run release=3450 align=False kir=False mem_profile=False limit=1000  | 
 | 111 | + | 
 | 112 | +	...::: Delete all CloudFormation based services and data :::...  | 
 | 113 | +	$ make delete  | 
 | 114 | + | 
 | 115 | +endef  | 
0 commit comments