-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
160 lines (135 loc) · 4.98 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
SHELL := /bin/bash
PROJECT_ID := realtime
default: build deploy status
build:
@echo
@echo "--------------------------"
@echo "Building"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) build
ansible-check:
@echo "Check ansible command"
@ansible -i ansible/development/hosts all -m ping
@ansible-playbook -i ansible/development/hosts ansible/development/site.yml --check --list-tasks --list-hosts $(ANSIBLE_ARGS)
setup-ansible:
@echo "Setup configurations using ansible"
@ansible-playbook -i ansible/development/hosts ansible/development/site.yml -v $(ANSIBLE_ARGS)
up:
@echo
@echo "--------------------------"
@echo "Bringing up fresh instances"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) up -d btsync
@docker-compose -p $(PROJECT_ID) up -d bnpb-sync
@docker-compose -p $(PROJECT_ID) up -d bmkg-sync
@docker-compose -p $(PROJECT_ID) up -d shakemaps-corrected-sync
@docker-compose -p $(PROJECT_ID) up -d shakemaps-extracted-sync
@docker-compose -p $(PROJECT_ID) up -d shakemaps-corrected-extracted-sync
@docker-compose -p $(PROJECT_ID) up -d floodmaps-sync
@docker-compose -p $(PROJECT_ID) up -d ashmaps-sync
@docker-compose -p $(PROJECT_ID) up -d sftp
@docker-compose -p $(PROJECT_ID) up -d --force-recreate apache
@docker-compose -p $(PROJECT_ID) up -d --force-recreate inasafe
deploy: up bmkg-monitor inasafe-worker status
bmkg-monitor:
@docker-compose -p $(PROJECT_ID) up -d inasafe-shakemap-monitor
@docker-compose -p $(PROJECT_ID) up -d inasafe-shakemap-corrected-monitor
@docker-compose -p $(PROJECT_ID) stop inasafe-shakemap-monitor-bnpb
bnpb-monitor:
@docker-compose -p $(PROJECT_ID) up -d inasafe-shakemap-monitor-bnpb
@docker-compose -p $(PROJECT_ID) up -d inasafe-shakemap-corrected-monitor
@docker-compose -p $(PROJECT_ID) stop inasafe-shakemap-monitor
down:
@docker-compose -p $(PROJECT_ID) down
checkout:
@echo
@echo "--------------------------"
@echo "Checkout InaSAFE develop "
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) run --rm inasafe /start.sh checkout realtime-backport-cherry-pick
inasafe-env:
@docker-compose -p $(PROJECT_ID) exec inasafe /bin/bash -c "source run-env-realtime.sh && printenv"
inasafe-shakemap:
@echo
@echo "--------------------------"
@echo "Running InaSAFE Assesment"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) run --rm inasafe /start.sh make-latest-shakemap
inasafe-floodmap:
@echo
@echo "--------------------------"
@echo "Running InaSAFE Assesment"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) run --rm inasafe /start.sh make-latest-floodmap
inasafe-worker:
@echo
@echo "--------------------------"
@echo "Running InaSAFE Workers"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) up -d --force-recreate inasafe-worker
inasafe-worker-log:
@echo
@echo "--------------------------"
@echo "View Logs InaSAFE Workers"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) logs -f --tail=50 inasafe-worker
restart-inasafe-worker: stop-inasafe-worker
@echo
@echo "--------------------------"
@echo "Hard Restart InaSAFE Workers"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) rm inasafe-worker
@docker-compose -p $(PROJECT_ID) up -d --force-recreate inasafe-worker
stop-inasafe-worker:
@echo
@echo "--------------------------"
@echo "Hard Stop InaSAFE Workers"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) stop inasafe-worker
inasafe-shell:
@echo
@echo "--------------------------"
@echo "Running InaSAFE Shell"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) run --rm inasafe /bin/bash
bmkg-monitor-log:
@echo
@echo "--------------------------"
@echo "Viewing shakemaps monitor logs"
@echo "Latest lines, and follow logs"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) logs -f --tail=50 inasafe-shakemap-monitor
bnpb-monitor-log:
@echo
@echo "--------------------------"
@echo "Viewing shakemaps monitor logs"
@echo "Latest lines, and follow logs"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) logs -f --tail=50 inasafe-shakemap-monitor-bnpb
status:
@echo
@echo "--------------------------"
@echo "Show status of all containers"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) ps
sftp-credential:
@echo
@echo "--------------------------"
@echo "Show sftp credential"
@echo "--------------------------"
@docker-compose -p $(PROJECT_ID) exec sftp cat /credentials
rm:
@echo
@echo "--------------------------"
@echo "Killing $(MODE_STRING) instance!!! "
@echo "--------------------------"
@echo "Killing shakemap monitor"
@for i in $$(docker ps -a | grep "realtime_inasafe-shakemap-monitor_run" | cut -f1 -d" "); \
do docker rm -f $$i; \
done
@echo "Killing event processor"
@for i in $$(docker ps -a | grep "realtime_inasafe_run" | cut -f1 -d" "); \
do docker rm -f $$i; \
done
@docker-compose -p $(PROJECT_ID) kill
@docker-compose -p $(PROJECT_ID) rm