-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
135 lines (118 loc) · 4.71 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
TAG = "Makefile"
MYSQLCLIENT = mycli
DOCKER_HOST_IP := $(shell ipconfig getifaddr en0)
##
## Jupyter
##
.PHONY: jupyter
jupyter:
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Preparing docker-compose"
@ echo "-----------------------------------------\n"
@ jupyter lab --ip=127.0.0.1 --port=8080
##
## Compose
##
.PHONY: compose.prepare
compose.prepare:
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Preparing docker-compose"
@ echo "-----------------------------------------\n"
@ echo "export DOCKER_HOST_IP=$(DOCKER_HOST_IP)"
@ echo "\n-----------------------------------------"
@ echo ""
.PHONY: compose.storage
compose.storage: compose.prepare
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose"
@ docker stop $(docker ps -a -q) || true
@ docker rm -f $(docker ps -a -q) || true
@ docker volume rm $(docker volume ls -f dangling=true -q) || true
@ docker compose -f docker-compose.storage.yml rm -fsv || true
@ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \
-f docker-compose.storage.yml \
up
.PHONY: compose.spark
compose.spark: compose.prepare
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose"
@ docker stop $(docker ps -a -q) || true
@ docker rm -f $(docker ps -a -q) || true
@ docker volume rm $(docker volume ls -f dangling=true -q) || true
@ docker compose -f docker-compose.spark.yml rm -fsv || true
@ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \
-f docker-compose.spark.yml \
up
.PHONY: compose.kafka
compose.kafka: compose.prepare
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose"
@ docker stop $(docker ps -a -q) || true
@ docker rm -f $(docker ps -a -q) || true
@ docker volume rm $(docker volume ls -f dangling=true -q) || true
@ docker compose -f docker-compose.kafka.yml rm -fsv || true
@ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \
-f docker-compose.kafka.yml \
up
.PHONY: compose.metastore
compose.metastore: compose.prepare
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose"
@ docker stop $(docker ps -a -q) || true
@ docker rm -f $(docker ps -a -q) || true
@ docker volume rm $(docker volume ls -f dangling=true -q) || true
@ docker compose -f docker-compose.metastore.yml rm -fsv || true
@ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \
-f docker-compose.metastore.yml \
up --build
.PHONY: compose.presto
compose.presto: compose.prepare
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose"
@ docker stop $(docker ps -a -q) || true
@ docker rm -f $(docker ps -a -q) || true
@ docker volume rm $(docker volume ls -f dangling=true -q) || true
@ docker compose -f docker-compose.presto.yml rm -fsv || true
@ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \
-f docker-compose.presto.yml \
up --build
.PHONY: compose.aws
compose.aws: compose.aws
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose"
@ docker stop $(docker ps -a -q) || true
@ docker rm -f $(docker ps -a -q) || true
@ docker volume rm $(docker volume ls -f dangling=true -q) || true
@ docker compose -f docker-compose.aws.yml rm -fsv || true
@ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \
-f docker-compose.aws.yml \
up --build
.PHONY: compose.clean
compose.clean:
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Starting: Cleaning docker resources"
@ echo "-----------------------------------------\n"
@ docker stop `docker ps -a -q` || true
@ docker rm -f `docker ps -a -q` || true
@ docker rmi -f `docker images --quiet --filter "dangling=true"` || true
@ docker volume rm `docker volume ls -f dangling=true -q` || true
@ rm -rf ./docker-volumes
@ docker network rm `docker network ls -q` || true
@ echo ""
@ rm -rf metastore_db
@ echo "\n-----------------------------------------"
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Finished: Cleaning docker resources"
.PHONY: compose.storage-all
compose.storage-all: compose.storage-all
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Running docker-compose"
@ docker stop $(docker ps -a -q) || true
@ docker rm -f $(docker ps -a -q) || true
@ docker volume rm $(docker volume ls -f dangling=true -q) || true
@ docker compose -f docker-compose.aws.yml rm -fsv || true
@ DOCKER_HOST_IP=$(DOCKER_HOST_IP) docker compose \
-f docker-compose.storage.yml \
-f docker-compose.aws.yml \
-f docker-compose.kafka.yml \
up --build
##
## Storage CLIs
##
.PHONY: mysql
mysql:
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Connecting to mysql"
@ $(MYSQLCLIENT) -u root -h localhost ad_stat -p root
.PHONY: redis
redis:
@ echo "[$(TAG)] ($(shell TZ=UTC date -u '+%H:%M:%S')) - Connecting to redis"
@ redis-cli -a credential