diff --git a/Makefile b/Makefile index 4cae3883d..27bf91ebb 100644 --- a/Makefile +++ b/Makefile @@ -90,6 +90,23 @@ test: venv ## Run tests deploy: check-env-vars ## Upload deploy artifacts to S3 and trigger CodeDeploy aws deploy create-deployment --application-name ${CODEDEPLOY_APP_NAME} --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name ${CODEDEPLOY_APP_NAME} --s3-location bucket=${DNS_NAME}-codedeploy,key=${CODEDEPLOY_PREFIX}-${DEPLOY_BUILD_NUMBER}.zip,bundleType=zip --region eu-west-1 +.PHONY: check-aws-vars +check-aws-vars: ## Check if AWS access keys are set + $(if ${AWS_ACCESS_KEY_ID},,$(error Must specify AWS_ACCESS_KEY_ID)) + $(if ${AWS_SECRET_ACCESS_KEY},,$(error Must specify AWS_SECRET_ACCESS_KEY)) + +.PHONY: deploy-suspend-autoscaling-procecces +deploy-suspend-autoscaling-procecces: check-aws-vars ## Suspend launch and terminate processes for the auto-scaling group + aws autoscaling suspend-processes --region eu-west-1 --auto-scaling-group-name ${CODEDEPLOY_APP_NAME} --scaling-processes "Launch" "Terminate" + +.PHONY: deploy-resume-autoscaling-processes +deploy-resume-autoscaling-processes: check-aws-vars ## Resume launch and terminate processes for the auto-scaling group + aws autoscaling resume-processes --region eu-west-1 --auto-scaling-group-name ${CODEDEPLOY_APP_NAME} --scaling-processes "Launch" "Terminate" + +.PHONY: deploy-check-autoscaling-processes +deploy-check-autoscaling-processes: check-aws-vars ## Returns with the number of instances with active autoscaling events + @aws autoscaling describe-auto-scaling-groups --region eu-west-1 --auto-scaling-group-names ${CODEDEPLOY_APP_NAME} | jq '.AutoScalingGroups[0].Instances|map(select(.LifecycleState != "InService"))|length' + .PHONY: coverage coverage: venv ## Create coverage report ./venv/bin/coveralls