blob: 4db2552ebd71c385fc650ca8d39ecfcb6a89f276 [file] [log] [blame]
include setup.env
CLUSTER_TEMPLATE:=cf-cluster.yml
SERVICE_TEMPLATE:=cf-service.yml
DNS_ROUTING_TEMPLATE:=cf-dns-route.yml
AWS_FC_COMMAND=export AWS_PAGER=;aws cloudformation
.PHONY: create-all delete-all \
cluster service dns-routing \
wait-for-cluster-creation wait-for-service-creation wait-for-dns-routing-creation \
wait-for-cluster-deletion wait-for-service-deletion wait-for-dns-routing-deletion \
gerrit-build gerrit-publish
create-all: cluster wait-for-cluster-creation \
service wait-for-service-creation \
dns-routing wait-for-dns-routing-creation
cluster:
$(AWS_FC_COMMAND) create-stack \
--stack-name $(CLUSTER_STACK_NAME) \
--capabilities CAPABILITY_IAM \
--template-body file://`pwd`/$(CLUSTER_TEMPLATE) \
--region $(AWS_REGION)
service:
$(AWS_FC_COMMAND) create-stack \
--stack-name $(SERVICE_STACK_NAME) \
--capabilities CAPABILITY_IAM \
--template-body file://`pwd`/$(SERVICE_TEMPLATE) \
--region $(AWS_REGION) \
--parameters \
ParameterKey=ClusterStackName,ParameterValue=$(CLUSTER_STACK_NAME) \
ParameterKey=HostedZoneName,ParameterValue=$(HOSTED_ZONE_NAME) \
ParameterKey=Subdomain,ParameterValue=$(SUBDOMAIN) \
ParameterKey=DockerRegistryUrl,ParameterValue=$(DOCKER_REGISTRY_URI) \
ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)
dns-routing:
$(AWS_FC_COMMAND) create-stack \
--stack-name $(DNS_ROUTING_STACK_NAME) \
--capabilities CAPABILITY_IAM \
--template-body file://`pwd`/$(DNS_ROUTING_TEMPLATE) \
--region $(AWS_REGION) \
--parameters \
ParameterKey=ServiceStackName,ParameterValue=$(SERVICE_STACK_NAME)
wait-for-cluster-creation:
@echo "*** Wait for cluster stack '$(CLUSTER_STACK_NAME)' creation"
$(AWS_FC_COMMAND) wait stack-create-complete \
--stack-name $(CLUSTER_STACK_NAME) \
--region $(AWS_REGION)
@echo "*** Cluster stack '$(CLUSTER_STACK_NAME)' created"
wait-for-service-creation:
@echo "*** Wait for service stack '$(SERVICE_STACK_NAME)' creation"
$(AWS_FC_COMMAND) wait stack-create-complete \
--stack-name $(SERVICE_STACK_NAME) \
--region $(AWS_REGION)
@echo "*** Service stack '$(SERVICE_STACK_NAME)' created"
wait-for-dns-routing-creation:
@echo "*** Wait for DNS routing stack '$(DNS_ROUTING_STACK_NAME)' creation"
$(AWS_FC_COMMAND) wait stack-create-complete \
--stack-name $(DNS_ROUTING_STACK_NAME) \
--region $(AWS_REGION)
@echo "*** DNS Routing stack '$(DNS_ROUTING_STACK_NAME)' created"
wait-for-cluster-deletion:
@echo "*** Wait for cluster stack '$(CLUSTER_STACK_NAME)' deletion"
$(AWS_FC_COMMAND) wait stack-delete-complete \
--stack-name $(CLUSTER_STACK_NAME) \
--region $(AWS_REGION)
@echo "*** Cluster stack '$(CLUSTER_STACK_NAME)' deleted"
wait-for-service-deletion:
@echo "*** Wait for service stack '$(SERVICE_STACK_NAME)' deletion"
$(AWS_FC_COMMAND) wait stack-delete-complete \
--stack-name $(SERVICE_STACK_NAME) \
--region $(AWS_REGION)
@echo "*** Service stack '$(SERVICE_STACK_NAME)' deleted"
wait-for-dns-routing-deletion:
@echo "*** Wait for DNS routing stack '$(DNS_ROUTING_STACK_NAME)' deletion"
$(AWS_FC_COMMAND) wait stack-delete-complete \
--stack-name $(DNS_ROUTING_STACK_NAME) \
--region $(AWS_REGION)
@echo "*** DNS routing stack '$(DNS_ROUTING_STACK_NAME)' deleted"
delete-cluster:
$(AWS_FC_COMMAND) delete-stack \
--stack-name $(CLUSTER_STACK_NAME) \
--region $(AWS_REGION)
delete-service:
$(AWS_FC_COMMAND) delete-stack \
--stack-name $(SERVICE_STACK_NAME) \
--region $(AWS_REGION)
delete-dns-routing:
$(AWS_FC_COMMAND) delete-stack \
--stack-name $(DNS_ROUTING_STACK_NAME) \
--region $(AWS_REGION)
delete-all: delete-dns-routing wait-for-dns-routing-deletion \
delete-service wait-for-service-deletion \
delete-cluster wait-for-cluster-deletion \
gerrit-publish:
$(MAKE) -C ../gerrit gerrit-publish RECIPE=single-master