-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
192 lines (169 loc) · 5.56 KB
/
Makefile
File metadata and controls
192 lines (169 loc) · 5.56 KB
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
CWD=$$(pwd)
.PHONY: help
help: ## Displays the help for each command.
@grep -E '^[a-zA-Z_-]+:.*## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
RECURSOR?=unbound # unbound is default recursor
up: ## Starts all of the services.
docker compose \
-f compose.yml \
-f compose.app.yml \
-f compose.nginx.yml \
-f compose.db.yml \
-f compose.redis.yml \
-f compose.dns.yml \
-f compose.dnscheck.yml \
-f compose.unbound.yml \
-f compose.sdns.yml \
up -d;
# @if [ ${RECURSOR} = "unbound" ]; then \
# echo "Using unbound recursor...\n";\
# docker compose \
# -f compose.yml \
# -f compose.app.yml \
# -f compose.nginx.yml \
# -f compose.db.yml \
# -f compose.redis.yml \
# -f compose.dns.yml \
# -f compose.dnscheck.yml \
# -f compose.unbound.yml \
# up -d;\
# else \
# echo "Using SDNS recursor...\n";\
# docker compose -f compose.yml \
# -f compose.app.yml \
# -f compose.nginx.yml \
# -f compose.redis.yml \
# -f compose.dns.yml \
# -f compose.dnscheck.yml \
# -f compose.sdns.yml \
# up -d; \
# fi
down: ## Stops all of the services.
docker compose -f compose.yml \
-f compose.app.yml \
-f compose.nginx.yml \
-f compose.db.yml \
-f compose.redis.yml \
-f compose.dns.yml \
-f compose.dnscheck.yml \
-f compose.sdns.yml \
-f compose.unbound.yml \
down; \
docker kill -a
up_dns: ## Starts the DNS services.
@if [ ${RECURSOR} = "sdns" ]; then \
echo "Using SDNS recursor...\n";\
docker compose \
-f compose.yml \
-f compose.dns.yml \
-f compose.sdns.yml up -d;\
else \
echo "Using Unbound recursor...\n";\
docker compose \
-f compose.yml \
-f compose.dns.yml \
-f compose.unbound.yml up -d;\
fi
down_dns: ## Stops the DNS services.
@if [ ${RECURSOR} = "sdns" ]; then \
echo "Starting DNS services with SDNS recursor...\n";\
docker compose \
-f compose.yml \
-f compose.dns.yml \
-f compose.sdns.yml \
down ;\
else \
echo "Starting DNS services with Unbound recursor...\n";\
docker compose \
-f compose.yml \
-f compose.dns.yml \
-f compose.unbound.yml \
down ;\
fi
# RECURSOR?=unbound # unbound is default recursor
up_dev: ## Starts the services for development purposes.
docker compose \
-f compose.yml \
-f compose.dev.yml \
-f compose.redis.yml \
-f compose.unbound.yml \
-f compose.sdns.yml \
up -d
down_dev: ## Stops the development services.
docker compose \
-f compose.yml \
-f compose.dev.yml \
-f compose.redis.yml \
-f compose.sdns.yml \
-f compose.unbound.yml \
down --remove-orphans --timeout 10
restart_dev: ## Restarts development services (down + up with proper wait).
docker compose \
-f compose.dev.yml \
-f compose.yml \
-f compose.sdns.yml \
-f compose.unbound.yml \
down --remove-orphans --timeout 10
@echo "Waiting for network resources to be released..."
@sleep 2
docker compose \
-f compose.yml \
-f compose.dev.yml \
-f compose.unbound.yml \
-f compose.sdns.yml \
up -d
IMAGE?=dnsapi
build_api_image: ## Builds the DNS REST API image.
docker build -t ${IMAGE} -f api/Dockerfile .
IMAGE?=dnsproxy
build_proxy_image: ## Builds the DNS Proxy image.
docker build -t ${IMAGE} -f proxy/Dockerfile .
IMAGE?=dnscheck
build_dnscheck_image: ## Builds the DNS check image.
docker build -t ${IMAGE} -f dnscheck/Dockerfile .
IMAGE?=dnsblocklists
build_blocklists_image: ## Builds the DNS Blocklists image.
docker build -t ${IMAGE} -f blocklists/Dockerfile .
IMAGE?=dnswebapp
ENVIRONMENT?=staging
build_frontend_image: ## Builds the DNS Webapp image.
docker build -t ${IMAGE} app/ --build-arg ENVIRONMENT=${ENVIRONMENT}
dev_api: ## Starts the development api service.
docker exec -it dnsapi make gow
dev_blocklists: ## Starts the development blocklists service.
docker exec -it dnsblocklists make gow
dev_proxy: ## Starts the development proxy service.
docker exec -it dnsproxy make gow
dev_check: ## Starts the development dnscheck service.
docker exec -it dnscheck make gow
gen_python_client: ## Generates the python client from swagger spec (renamed to moddns_client, package moddns).
sudo rm -r tests/moddns_client/ || true
docker run -v ${CWD}:/app -w /app/api/docs --rm -it openapitools/openapi-generator-cli generate --package-name moddns -i swagger.yaml -g python -o /app/tests/moddns_client --skip-validate-spec
sudo chmod -R 777 tests/moddns_client/
gen_ts_client: ## Generates the typescript client from swagger spec.
sudo rm -r app/src/api/client/ || true
docker run -v ${CWD}:/app -w /app/api/docs --rm -it openapitools/openapi-generator-cli generate --package-name idns -i swagger.yaml -g typescript-axios -o /app/app/src/api/client --skip-validate-spec
sudo chmod -R 777 app/src/api/client/
build_tests_image: ## Builds the smoke / integration tests image.
docker build -f tests/Dockerfile -t dns_tests:latest .
dev_tests: ## Starts the development tests docker container.
docker run --network host -it --rm -v ${CWD}:/app -w /app dns_tests:latest
### BUILD DEV IMAGES
image?=api
build_image_dev:
@if [ ${image} = "api" ]; then \
echo "Building DNS API dev image...\n"; \
docker build -t dnsapidev -f api/Dockerfile.dev . ;\
fi
@if [ ${image} = "proxy" ]; then \
echo "Building DNS Proxy dev image...\n"; \
docker build -t dnsproxydev -f proxy/Dockerfile.dev . ;\
fi
@if [ ${image} = "dnscheck" ]; then \
echo "Building DNS check dev image...\n"; \
docker build -t dnscheckdev -f dnscheck/Dockerfile.dev . ;\
fi
@if [ ${image} = "blocklists" ]; then \
echo "Building DNS Blocklists dev image...\n"; \
docker build -t dnsblocklistsdev -f blocklists/Dockerfile.dev . ;\
fi