-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
84 lines (71 loc) · 2.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
ECR_REPO ?= $(shell awless list repositories --format json | jq -r '.[].URI' 2> /dev/null | grep archer)
IMAGE_TAG ?= latest
PARENT_STACK_NAME := parent
USERS_STACK_NAME := test-users
STACK_NAME ?= archersaurus
image:
awless --no-sync authenticate registry no-confirm=true --force
docker build -t $(ECR_REPO):$(IMAGE_TAG) .
docker push $(ECR_REPO):$(IMAGE_TAG)
awless_deploy:
awless --no-sync --force \
update stack \
name=$(STACK_NAME) \
capabilities=CAPABILITY_IAM \
template-file=$(STACK_TEMPLATE_FILE) \
stack-file=$(STACK_CONFIG_FILE) \
parameters=[ImageTag:$(IMAGE_TAG)]
awless_watch:
awless --no-sync \
tail stack-events $(STACK_NAME) \
--follow \
--frequency=6s \
--timeout=10m \
--cancel-on-timeout
# provision initial infrastructure
users:
awless create stack \
name=$(USERS_STACK_NAME) \
template-file=templates/users.yml \
capabilities=CAPABILITY_NAMED_IAM
parent_create:
awless create stack \
name=$(PARENT_STACK_NAME) \
template-file=templates/parent.yml \
capabilities=CAPABILITY_IAM \
stack-file=templates/parent.config.yml
parent_update:
awless update stack \
name=$(PARENT_STACK_NAME) \
template-file=templates/parent.yml \
capabilities=CAPABILITY_IAM \
stack-file=templates/parent.config.yml
parent: parent_create
awless tail stack-events $(PARENT_STACK_NAME) --follow
archersaurus: image
awless create stack \
name=$(STACK_NAME) \
template-file=templates/archersaurus.yml \
capabilities=CAPABILITY_IAM \
stack-file=templates/archersaurus.config.yml \
parameters=[ImageTag:latest,ParentStack:$(PARENT_STACK_NAME)] \
role=$$(awless show $$(awless list roles --filter name=CFDeployRole --ids) --values-for arn)
# rollback-triggers=$$(awless list alarms --filter name=TaskFailAlarm --ids)
# some helpers for demo
repos:
awless list repositories
show_users_stack:
awless show $(USERS_STACK_NAME)
show_ecs_stack:
awless show $(STACK_NAME)
show_ecs_alarm:
awless list alarms --filter name=TaskFailAlarm --ids
set_rollback_trigger: ROLLBACK_TRIGGER_ARN ?= $(shell awless list alarms --filter name=TaskFailAlarm --ids | head -n 1)
set_rollback_trigger:
awless update stack \
name=$(STACK_NAME) \
use-previous-template=true \
capabilities=CAPABILITY_IAM \
stack-file=templates/archersaurus.config.yml \
rollback-triggers='$(ROLLBACK_TRIGGER_ARN)' \
parameters=[ImageTag:latest,ParentStack:$(PARENT_STACK_NAME)]