-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
148 lines (114 loc) · 4.23 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
# ______ ____ ______ ____ _____ ____ _____ __ __
# | ___ \ / ___ \ | ___ \ / ___ \ | ___ \ / ___ \ / _____\ | | / /
# | |__| / | | | | | |__| / | | | | | | | | | | | | | | | |/ /
# | \ | | | | | ___ \ | | | | | | | | | | | | | | | /
# | |\ \ | |__| | | |__| | | |__| | | |__| | | |__| | | |_____ | |\ \
# |__| \__\ \_____/ |_______/ \_____/ |______/ \_____/ \______/ |__| \__\
# Written by Mutlu Polatcan
# 21.06.2018
include robodock-core/default_vars.env
.ONESHELL:
SHELL := /bin/bash
ifndef VERBOSE
.SILENT:
endif
.PHONY: robodock-install
robodock-install:
# If user is not root, get root permissions
if [[ $$(whoami) != "root" ]]; then \
echo "ERROR ! Please run \"sudo make robodock-install\" to get root permissions"
else
# Install docker
echo "Installing Docker..."
./docker-latest.sh
# Copy configuration files
echo "Copying configuration files..."
cp ./robodock-configs/docker /etc/default/docker
cp ./robodock-configs/docker.service /etc/systemd/system/docker.service
# Restart daemon and docker service
echo "Restarting daemons and Docker service..."
systemctl daemon-reload
service docker restart
# Save backup of initial sysctl.conf and load new configs
echo "Save backups of old configs..."
if [ ! -e /etc/sysctl.conf.bak ]; then \
cat /etc/sysctl.conf > /etc/sysctl.conf.bak
fi
cat /etc/sysctl.conf.bak > /etc/sysctl.conf
echo "vm.max_map_count=262144" >> /etc/sysctl.conf
echo "net.core.somaxconn=65535" >> /etc/sysctl.conf
# Save backup of initial common-session, common-session-noninteractive and limits.conf. Then load new configs.
if [ ! -e /etc/pam.d/common-session.bak ]; then \
cat /etc/pam.d/common-session > /etc/pam.d/common-session.bak
fi
if [ ! -e /etc/pam.d/common-session-noninteractive.bak ]; then \
cat /etc/pam.d/common-session-noninteractive > /etc/pam.d/common-session-noninteractive.bak
fi
if [ ! -e /etc/security/limits.conf.bak ]; then \
cat /etc/security/limits.conf > /etc/security/limits.conf.bak
fi
cat /etc/pam.d/common-session.bak > /etc/pam.d/common-session
cat /etc/pam.d/common-session-noninteractive.bak > /etc/pam.d/common-session-noninteractive
cat /etc/security/limits.conf.bak > /etc/security/limits.conf
echo "session required pam_limits.so" >> /etc/pam.d/common-session
echo "session required pam_limits.so" >> /etc/pam.d/common-session-noninteractive
echo "* soft nofile 200000" >> /etc/security/limits.conf
echo "* hard nofile 200000" >> /etc/security/limits.conf
# Restart the machine
echo "Restarting the machine..."
reboot
fi
.PHONY: robodock-destroy
robodock-destroy:
sudo rm -r robodock
.PHONY: stop
stop:
sudo docker stop $(c)
.PHONY: rm
rm:
sudo docker rm $(c)
.PHONY: restart
restart:
sudo docker restart $(c)
.PHONY: log
log:
sudo docker logs $(c)
.PHONY: up-all
up-all:
sudo docker-compose -f dc_node_$(node).yml up -d
.PHONY: format
format:
./robodock-constructor/RobodockConstructor.py $(file)
.PHONY: stop-all
stop-all:
sudo docker-compose -f dc_node_$(node).yml stop
.PHONY: rm-all
rm-all:
sudo docker-compose -f dc_node_$(node).yml rm --force
.PHONY: restart-all
restart-all:
sudo docker-compose -f dc_node_$(node).yml restart
.PHONY: exec
exec:
sudo docker exec -it $(c) "$(cmd)"
.PHONY: ps
ps:
sudo docker-compose -f dc_node_$(node).yml ps
.PHONY: network-info
network-info:
sudo docker network inspect $(ROBODOCK_NET)
.PHONY: streamer-run
streamer-run:
sudo docker exec -d data_streamer$(index) /bin/bash -c "cd /streamers/$(streamer); npm install; node $(file)"
.PHONY: kafka-topic-list
kafka-topic-list:
sudo docker exec -it kafka$(index) /bin/bash -c "kafka-topics.sh --zookeeper \$$KAFKA_ZOOKEEPER_CONNECT --list"
.PHONY: kafka-topic-delete
kafka-topic-delete:
sudo docker exec -it kafka$(index) /bin/bash -c "kafka-topics.sh --zookeeper \$$KAFKA_ZOOKEEPER_CONNECT --topic $(topic) --delete"
.PHONY: kafka-topic-consume
kafka-topic-consume:
sudo docker exec -it kafka$(index) /bin/bash -c "kafka-console-consumer.sh --zookeeper \$$KAFKA_ZOOKEEPER_CONNECT --topic $(topic) --from-beginning"
.PHONY: health-check
health-check:
sudo docker exec -it healthchecker$(index) python RobodockHealthChecker.py /hc-conf/config.yml