-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
159 lines (141 loc) · 4.45 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
MAKEFLAGS += --silent
path := .
.PHONY: help
help: ## 지금 보고있는거
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
nb = sub( /^## /, "", helpMsg ); \
if(nb == 0) { \
helpMsg = $$0; \
nb = sub( /^[^:]*:.* ## /, "", helpMsg ); \
} \
if (nb) \
print $$1 " " helpMsg; \
} \
{ helpMsg = $$0 }' $(MAKEFILE_LIST) | \
sort | \
column -tx -s ':'
.PHONY: clean-cache
clean-cache: ## 캐시 및 필요없는 리소스 제거
rm -rf `find . -name '__pycache__'`
.PHONY: build
build: ## 레디스 환경 빌드
if [ -z "$(MODE)" ]; then \
echo "MODE is empty"; \
echo "Usage: make build MODE=<mode>"; \
exit 1; \
fi
docker-compose -f docker-compose-$(MODE).yaml build --no-cache
.PHONY: build-df
build-df: ## [unstable] dragonfly 레디스 환경 빌드
if [ -z "$(MODE)" ]; then \
echo "MODE is empty"; \
echo "Usage: make build-df MODE=<mode>"; \
exit 1; \
fi
docker-compose -f docker-compose-$(MODE)-dragonfly.yaml build --no-cache
.PHONY: up
up: ## 레디스 환경 실행
if [ -z "$(MODE)" ]; then \
echo "MODE is empty"; \
echo "Usage: make up MODE=<mode>"; \
exit 1; \
fi
docker-compose -f docker-compose-$(MODE).yaml --env-file .env up -d
.PHONY: up-df
up-df: ## [unstable] dragonfly 레디스 환경 실행
if [ -z "$(MODE)" ]; then \
echo "MODE is empty"; \
echo "Usage: make up-df MODE=<mode>"; \
exit 1; \
fi
docker-compose -f docker-compose-$(MODE)-dragonfly.yaml --env-file .env up -d
.PHONY: down
down: ## 레디스 환경 종료
docker-compose \
-f docker-compose-cluster.yaml \
-f docker-compose-replica.yaml \
-f docker-compose-sentinel.yaml \
-f docker-compose-cluster-dragonfly.yaml \
-f docker-compose-replica-dragonfly.yaml \
down --remove-orphans
.PHONY: stop-replica-master
stop-replica-master: ## 레플리카 마스터 레디스 종료
docker-compose -f docker-compose-replica.yaml stop redis-primary
.PHONY: start-replica-master
start-replica-master: ## 레플리카 마스터 레디스 실행
docker-compose -f docker-compose-replica.yaml restart redis-primary
.PHONY: stop-replica-slave
stop-replica-slave: ## 레플리카 슬레이브 레디스 종료
docker-compose -f docker-compose-replica.yaml stop redis-replica
.PHONY: start-replica-slave
start-replica-slave: ## 레플리카 슬레이브 레디스 실행
docker-compose -f docker-compose-replica.yaml restart redis-replica
.PHONY: stop-cluster-master
stop-cluster-master: ## 클러스터 마스터 레디스 종료
if [ -z "$(ID)" ]; then \
echo "ID is empty"; \
echo "Usage: make stop-cluster-master ID=<id>"; \
exit 1; \
fi
docker-compose -f docker-compose-cluster.yaml stop redis-primary-$(ID)
.PHONY: start-cluster-master
start-cluster-master: ## 클러스터 마스터 레디스 실행
if [ -z "$(ID)" ]; then \
echo "ID is empty"; \
echo "Usage: make stop-cluster-master ID=<id>"; \
exit 1; \
fi
docker-compose -f docker-compose-cluster.yaml restart redis-primary-$(ID)
.PHONY: stop-cluster-slave
stop-cluster-slave: ## 클러스터 슬레이브 레디스 종료
if [ -z "$(ID)" ]; then \
echo "ID is empty"; \
echo "Usage: make stop-cluster-master ID=<id>"; \
exit 1; \
fi
docker-compose -f docker-compose-cluster.yaml stop redis-replica-$(ID)
.PHONY: start-cluster-slave
start-cluster-slave: ## 클러스터 슬레이브 레디스 실행
if [ -z "$(ID)" ]; then \
echo "ID is empty"; \
echo "Usage: make stop-cluster-master ID=<id>"; \
exit 1; \
fi
docker-compose -f docker-compose-cluster.yaml restart redis-replica-$(ID)
.PHONY: client
client: ## 클라이언트 실행
if [ -z "$(MODE)" ]; then \
echo "MODE is empty"; \
echo "Usage: make client MODE=<mode> TYPE=<type>"; \
exit 1; \
fi
if [ -z "$(TYPE)" ]; then \
echo "TYPE is empty"; \
echo "Usage: make client MODE=<mode> TYPE=<type>"; \
exit 1; \
fi
docker-compose -f docker-compose-$(MODE).yaml exec -- $(TYPE)-client /bin/sh -c "./redis-client"
.PHONY: shell
shell: ## 클라이언트 쉘 접속
if [ -z "$(MODE)" ]; then \
echo "MODE is empty"; \
echo "Usage: make shell MODE=<mode> TYPE=<type>"; \
exit 1; \
fi
if [ -z "$(TYPE)" ]; then \
echo "TYPE is empty"; \
echo "Usage: make shell MODE=<mode> TYPE=<type>"; \
exit 1; \
fi
docker-compose -f docker-compose-$(MODE).yaml exec -- $(TYPE)-client /bin/sh
.PHONY: account
account: ## 계정 생성
if [ -z "$(NAME)" ]; then \
echo "NAME is empty"; \
echo "Usage: make account NAME=<name>"; \
exit 1; \
fi
python tool/acl_generator.py $(NAME)