-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathTaskfile.yml
83 lines (69 loc) · 2 KB
/
Taskfile.yml
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
version: '3'
vars:
GOOS: "{{default OS .GOOS}}"
MVNW: '{{if eq .GOOS "windows"}}mvnw.cmd{{else}}./mvnw{{end}}'
DC_DIR: "deployment/docker-compose"
INFRA_DC_FILE: "{{.DC_DIR}}/infra.yml"
APPS_DC_FILE: "{{.DC_DIR}}/apps.yml"
MONITORING_DC_FILE: "{{.DC_DIR}}/monitoring.yml"
SLEEP_CMD: '{{if eq .GOOS "windows"}}timeout{{else}}sleep{{end}}'
tasks:
default:
cmds:
- task: test
test:
deps: [format]
cmds:
- "{{.MVNW}} clean verify"
format:
cmds:
- "{{.MVNW}} spotless:apply"
build:
cmds:
- "{{.MVNW}} -pl catalog-service spring-boot:build-image -DskipTests"
- "{{.MVNW}} -pl order-service spring-boot:build-image -DskipTests"
- "{{.MVNW}} -pl notification-service spring-boot:build-image -DskipTests"
- "{{.MVNW}} -pl api-gateway spring-boot:build-image -DskipTests"
- "{{.MVNW}} -pl bookstore-webapp spring-boot:build-image -DskipTests"
start_infra:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} up -d"
stop_infra:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} stop"
- "docker compose -f {{.INFRA_DC_FILE}} rm -f"
restart_infra:
cmds:
- task: stop_infra
- task: sleep
- task: start_infra
start_monitoring:
cmds:
- "docker compose -f {{.MONITORING_DC_FILE}} up -d"
stop_monitoring:
cmds:
- "docker compose -f {{.MONITORING_DC_FILE}} stop"
- "docker compose -f {{.MONITORING_DC_FILE}} rm -f"
restart_monitoring:
cmds:
- task: stop_monitoring
- task: sleep
- task: start_monitoring
start:
deps: [build]
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} up -d"
stop:
cmds:
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} stop"
- "docker compose -f {{.INFRA_DC_FILE}} -f {{.APPS_DC_FILE}} rm -f"
restart:
cmds:
- task: stop
- task: sleep
- task: start
sleep:
vars:
DURATION: "{{default 5 .DURATION}}"
cmds:
- "{{.SLEEP_CMD}} {{.DURATION}}"