-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
67 lines (54 loc) · 1.85 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
.PHONY: test
CONTAINER_NAME_V1=influxdb-test-v1
CONTAINER_NAME_V2=influxdb-test-v2
SHELL=bash
USERNAME=myuser
PASSWORD=mysecretpassword
STORAGE=myinflux
TOKEN=mysecrettoken
start_influx: start_influx_v1 start_influx_v2
start_influx_v1: stop_influx_v1
docker run -tid -p 8087:8086 \
-p 8089:8089/udp \
-e INFLUXDB_UDP_ENABLED=true \
-e INFLUXDB_DB=${STORAGE} \
-e INFLUXDB_HTTP_AUTH_ENABLED=true \
-e INFLUXDB_ADMIN_ENABLED=true \
-e INFLUXDB_ADMIN_USER=${USERNAME} \
-e INFLUXDB_ADMIN_PASSWORD=${PASSWORD} \
-v ${PWD}/influxdb-meta.conf:/etc/influxdb/influxdb-meta.conf \
--name=${CONTAINER_NAME_V1} influxdb:1.8 -config /etc/influxdb/influxdb-meta.conf
start_influx_v2: stop_influx_v2
docker run -tid -p 9999:8086 \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_USERNAME=${USERNAME} \
-e DOCKER_INFLUXDB_INIT_PASSWORD=${PASSWORD} \
-e DOCKER_INFLUXDB_INIT_ORG=myorg \
-e DOCKER_INFLUXDB_INIT_BUCKET=${STORAGE} \
-e DOCKER_INFLUXDB_INIT_RETENTION=1w \
-e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=${TOKEN} \
--name=${CONTAINER_NAME_V2} influxdb:2.0
wait_for_influx: wait_for_influx_v1 wait_for_influx_v2
wait_for_influx_v1:
@echo "Waiting for InfluxDB v1: "
@i=0; while \
!(curl --fail -i 'http://localhost:8087/ping' >error_v1.log 2>&1 ); do \
sleep 1; echo -n '.'; \
if [ $$((i+=1)) -gt 60 ] ; then cat error_v1.log ; exit 1; fi; \
done
@echo "DONE"
wait_for_influx_v2:
@echo "Waiting for InfluxDB v2: "
@i=0; while \
!(curl --fail -i 'http://localhost:9999/ping' >error_v2.log 2>&1 ); do \
sleep 1; echo -n '.'; \
if [ $$((i+=1)) -gt 60 ] ; then cat error_v2.log ; exit 1; fi; \
done
@echo "DONE"
stop_influx: stop_influx_v1 stop_influx_v2
stop_influx_v1:
docker rm -f ${CONTAINER_NAME_V1} || true
stop_influx_v2:
docker rm -f ${CONTAINER_NAME_V2} || true
test: start_influx wait_for_influx
MIX_ENV=test mix test ${file}