-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
284 lines (263 loc) · 8 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
include vars.mk
HOST_CDN ?=
HOST_PRIMARY ?=
CON_DIR = build/containers
SRV = data db storage fileman acceptor inviter mailer
SRV_OBJ = $(addprefix $(CON_DIR)/teleport_,$(SRV))
start: data_dir $(SRV_OBJ)
stop: get_containers
@-docker stop $(CONTAINERS)
clean: stop
@-docker rm -fv $(CONTAINERS)
@-rm -rf $(CURDIR)/build/*
@-rm -rf $(CURDIR)/data/zip/*
@-rm -rf $(CURDIR)/data/unzip/*
@-rm -rf $(CURDIR)/data/parse/*
@-rm -rf $(CURDIR)/data/storage/*
TELEPORT_DATA_PORT ?= 6379
discovery_data:
@while [ "`docker inspect -f {{.State.Running}} teleport_data`" != "true" ]; do \
echo "wait db"; sleep 0.3; \
done
$(eval TELEPORT_DATA_IP = $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' teleport_data))
$(CON_DIR)/teleport_data:
@mkdir -p $(shell dirname $@)
@touch $@
@docker run -d --name teleport_data -v $(CURDIR)/data:/data imega/redis
$(CON_DIR)/teleport_db:
@mkdir -p $(shell dirname $@)
@touch $@
@docker run -d --name "teleport_db" -v $(CURDIR)/conf.d/mysql:/etc/mysql/conf.d imega/mysql
@docker run --rm \
-v $(CURDIR)/sql:/sql \
--link teleport_db:s \
imega/mysql-client \
mysql --host=s -e "source /sql/schema.sql"
TELEPORT_STORAGE_PORT ?= -p 8185:80
$(CON_DIR)/teleport_storage: discovery_data
@mkdir -p $(shell dirname $@)
@touch $@
@docker run -d \
--name teleport_storage \
--link teleport_data:teleport_data \
--env REDIS_IP=$(TELEPORT_DATA_IP) \
--env REDIS_PORT=$(TELEPORT_DATA_PORT) \
$(TELEPORT_STORAGE_PORT) \
-v $(CURDIR)/data/storage:/data \
imegateleport/york
$(CON_DIR)/teleport_fileman:
@mkdir -p $(shell dirname $@)
@touch $@
@docker run -d \
--name teleport_fileman \
--link teleport_db:server_db \
--link teleport_storage:storage \
-e DB_HOST=server_db:3306 \
-v $(CURDIR)/data:/data \
imegateleport/fileman
TELEPORT_ACCEPTOR_PORT ?= -p 8183:80
$(CON_DIR)/teleport_acceptor: discovery_data
@mkdir -p $(shell dirname $@)
@touch $@
@docker run -d --name teleport_acceptor \
--env REDIS_IP=$(TELEPORT_DATA_IP) \
--env REDIS_PORT=$(TELEPORT_DATA_PORT) \
--link teleport_fileman:fileman \
--link teleport_data:teleport_data \
-v $(CURDIR)/data:/data \
$(TELEPORT_ACCEPTOR_PORT) \
imegateleport/bremen
TELEPORT_INVITER_PORT ?= -p 8180:80
$(CON_DIR)/teleport_inviter: discovery_data
@mkdir -p $(shell dirname $@)
@touch $@
@docker run -d --name teleport_inviter \
--env REDIS_IP=$(TELEPORT_DATA_IP) \
--env REDIS_PORT=$(TELEPORT_DATA_PORT) \
--env HOST_CDN=$(HOST_CDN) \
--env HOST_PRIMARY=$(HOST_PRIMARY) \
$(TELEPORT_INVITER_PORT) \
imegateleport/malmo
TELEPORT_MAILER_PORT ?= -p 8181:9000
TELEPORT_MAILER_USER ?=
TELEPORT_MAILER_PASS ?=
$(CON_DIR)/teleport_mailer:
@mkdir -p $(shell dirname $@)
@touch $@
@docker run -d --name teleport_mailer \
$(TELEPORT_MAILER_PORT) \
--env SMTP_USER=$(TELEPORT_MAILER_USER) \
--env SMTP_PASS=$(TELEPORT_MAILER_PASS) \
imegateleport/narvik
get_containers:
$(eval CONTAINERS := $(subst $(CON_DIR)/,,$(shell find $(CON_DIR) -type f)))
data_dir:
@-mkdir -p $(CURDIR)/data/zip $(CURDIR)/data/unzip $(CURDIR)/data/parse $(CURDIR)/data/storage
#HOST_CDN ?=
#HOST_PRIMARY ?=
#
#TELEPORT_DATA ?= imega/redis:1.0.0
#TELEPORT_DATA_PORT ?= 6379
#TELEPORT_DATA_IP ?=
#
#TELEPORT_MAILER ?= imegateleport/narvik
#TELEPORT_MAILER_PORT ?= -p 8181:9000
#TELEPORT_MAILER_USER ?=
#TELEPORT_MAILER_PASS ?=
#
#TELEPORT_INVITER ?= imegateleport/malmo
#TELEPORT_INVITER_PORT ?= -p 8180:80
#
#TELEPORT_ACCEPTOR ?= imegateleport/bremen
#
#
#TELEPORT_SETTINGS ?= imegateleport/lahti
#TELEPORT_SETTINGS_PORT ?= -p 8184:80
#
#TELEPORT_STORAGE ?= imegateleport/york
#TELEPORT_STORAGE_PORT ?= -p 8185:80
#
#TELEPORT_FILEMAN ?= imegateleport/tokio
#TELEPORT_EXTRACTOR ?= imegateleport/vigo
#TELEPORT_PARSER ?= imegateleport/oslo
#
#start-old: work_dirs \
# build/containers/teleport_data \
# build/containers/teleport_fileman \
# build/containers/teleport_extractor \
# build/containers/teleport_mailer \
# build/containers/teleport_inviter \
# build/containers/teleport_acceptor \
# build/containers/teleport_storage \
# build/containers/teleport_parser \
# discovery_extractor \
# discovery_parser
#
#get_containers_old:
# $(eval CONTAINERS := $(subst build/containers/,,$(shell find build/containers -type f)))
#
#stop: get_containers
# @-docker stop $(CONTAINERS)
#
#clean: stop
# @-docker rm -fv $(CONTAINERS)
# @rm -rf build/containers/*
#
#build/containers/teleport_data:
# @mkdir -p $(shell dirname $@)
# @docker run -d --name teleport_data --restart=always -v $(CURDIR)/data:/data $(TELEPORT_DATA)
# @touch $@
#
#discovery_data:
# @while [ "`docker inspect -f {{.State.Running}} teleport_data`" != "true" ]; do \
# @echo "wait db"; sleep 0.3; \
# done
# $(eval TELEPORT_DATA_IP = $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' teleport_data))
#
#build/containers/teleport_mailer:
# @mkdir -p $(shell dirname $@)
# @docker run -d --name teleport_mailer --restart=always \
# $(TELEPORT_MAILER_PORT) \
# --env SMTP_USER=$(TELEPORT_MAILER_USER) \
# --env SMTP_PASS=$(TELEPORT_MAILER_PASS) \
# $(TELEPORT_MAILER)
# @touch $@
#
#build/containers/teleport_inviter: discovery_data
# @mkdir -p $(shell dirname $@)
# @docker run -d --name teleport_inviter --restart=always \
# --env REDIS_IP=$(TELEPORT_DATA_IP) \
# --env REDIS_PORT=$(TELEPORT_DATA_PORT) \
# --env HOST_CDN=$(HOST_CDN) \
# --env HOST_PRIMARY=$(HOST_PRIMARY) \
# $(TELEPORT_INVITER_PORT) \
# $(TELEPORT_INVITER)
# @touch $@
#
#build/containers/teleport_acceptor: discovery_data
# @mkdir -p $(shell dirname $@)
# @docker run -d --name teleport_acceptor --restart=always \
# --env REDIS_IP=$(TELEPORT_DATA_IP) \
# --env REDIS_PORT=$(TELEPORT_DATA_PORT) \
# --link teleport_fileman:fileman \
# -v $(CURDIR)/data:/data \
# $(TELEPORT_ACCEPTOR_PORT) \
# $(TELEPORT_ACCEPTOR)
# @touch $@
#
#build/containers/teleport_settings: discovery_data
# @mkdir -p $(shell dirname $@)
# @docker run -d --name teleport_settings --restart=always \
# --env REDIS_IP=$(TELEPORT_DATA_IP) \
# --env REDIS_PORT=$(TELEPORT_DATA_PORT) \
# -v $(CURDIR)/data:/data \
# $(TELEPORT_SETTINGS_PORT) \
# $(TELEPORT_SETTINGS)
# @touch $@
#
#build/containers/teleport_fileman:
# @mkdir -p $(shell dirname $@)
# @docker run -d \
# --name teleport_fileman \
# --restart=always \
# -v $(CURDIR)/data:/data \
# $(TELEPORT_FILEMAN)
# @touch $@
#
#build/containers/teleport_extractor:
# @mkdir -p $(shell dirname $@)
# @docker run -d \
# --name teleport_extractor \
# --restart=always \
# --link teleport_fileman:fileman \
# $(TELEPORT_EXTRACTOR)
# @touch $@
#
#build/containers/teleport_storage:
# @mkdir -p $(shell dirname $@)
# @docker run -d \
# --name teleport_storage \
# --restart=always \
# --link teleport_data:teleport_data \
# --env REDIS_IP=$(TELEPORT_DATA_IP) \
# --env REDIS_PORT=$(TELEPORT_DATA_PORT) \
# $(TELEPORT_STORAGE_PORT) \
# -v $(CURDIR)/data/storage:/data \
# $(TELEPORT_STORAGE)
# @touch $@
#
#build/containers/teleport_parser:
# @mkdir -p $(shell dirname $@)
# @docker run -d \
# --name teleport_parser \
# --restart=always \
# -v $(CURDIR)/data/parse:/data \
# --link teleport_fileman:fileman \
# $(TELEPORT_PARSER)
# @touch $@
#
#discovery_extractor:
# @while [ "`docker inspect -f {{.State.Running}} teleport_extractor`" != "true" ]; do \
# @echo "wait teleport_extractor"; sleep 0.3; \
# done
# $(eval IP := $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' teleport_extractor))
# @docker exec teleport_fileman sh -c 'echo -e "$(IP)\textractor" >> /etc/hosts'
#
#discovery_parser:
# @while [ "`docker inspect -f {{.State.Running}} teleport_parser`" != "true" ]; do \
# @echo "wait teleport_parser"; sleep 0.3; \
# done
# $(eval IP := $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' teleport_parser))
# @docker exec teleport_fileman sh -c 'echo -e "$(IP)\tparser" >> /etc/hosts'
#
#work_dirs:
# @-mkdir -p $(CURDIR)/build $(CURDIR)/data/zip $(CURDIR)/data/parse $(CURDIR)/data/storage
# @cp -r $(CURDIR)/sql/* $(CURDIR)/data/storage/
# @-chmod -R 777 $(CURDIR)/data
#
#update_custom:
# @cp -rf $(CURDIR)/sql/* $(CURDIR)/data/storage/
#
#discovery:
# @sh discovery.sh
#