-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (72 loc) · 2.17 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
#!ash # Explicitly specify ash shell
PARENT_DIR := /root/redis-docker/
CHILD_DIR := /root/redis-docker/docker/
## start: Start redis container
start:
clear && . $(PARENT_DIR)ascii.sh "Redis"; \
cd $(CHILD_DIR); \
chmod 666 /var/run/docker.sock; \
docker-compose pull && docker compose up -d; \
cd $(PARENT_DIR) || exit 1
## restart: Restart redis container
restart:
clear && . $(PARENT_DIR)ascii.sh "Redis"; \
cd $(CHILD_DIR); \
chmod 666 /var/run/docker.sock; \
docker-compose down && docker compose up -d; \
cd $(PARENT_DIR) || exit 1
## stop: Stop redis container
stop:
clear && . $(PARENT_DIR)ascii.sh "Redis"; \
cd $(CHILD_DIR); \
docker-compose stop; \
cd $(PARENT_DIR) || exit 1
## logs: Tail redis container logs
logs:
clear && . $(PARENT_DIR)ascii.sh "Redis"; \
cd $(CHILD_DIR); \
docker-compose logs -f; \
cd $(PARENT_DIR) || exit 1
## show: Show redis containers
show:
clear && . $(PARENT_DIR)ascii.sh "Redis"; \
cd $(CHILD_DIR); \
docker-compose ps; \
cd $(PARENT_DIR) || exit 1
## create-dirs: Create redis required data folders
create-dirs:
clear && . $(PARENT_DIR)ascii.sh "Redis"; \
cd $(CHILD_DIR); \
rm -rf /root/redis; \
mkdir /root/redis; \
mkdir /root/redis/data; \
mkdir /root/redis/node; \
mkdir /root/redis/insight; \
chmod -R 777 /root/redis; \
echo; \
echo "All Done!"; \
ls -al /root/redis; \
cd $(PARENT_DIR) || exit 1
## clean: Clean redis containers and volumes (using implicit rule)
.PHONY: clean
clean:
clear && . $(PARENT_DIR)ascii.sh "Redis"; \
cd $(CHILD_DIR); \
docker system prune -f; \
docker volume prune -f; \
cd $(PARENT_DIR) || exit 1
## help: Command to view help
help: Makefile
clear && . $(PARENT_DIR)ascii.sh "Redis"
@echo
@echo "Choose a command (Alpine Linux ONLY):"
@echo
@echo " start : Start redis container"
@echo " restart : Restart redis container"
@echo " stop : Stop redis container"
@echo " logs : Tail redis container logs"
@echo " show : Show redis containers"
@echo " clean : Clean redis containers and volumes"
@echo " create-dirs : Create redis required data folders"
@echo " help : Show this help message"
@echo