-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (46 loc) · 1.55 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
SHELL = /bin/bash
INIT_JOB_NAME = "initial-download"
.PHONY: makePV.yml scheduleUpdates.yml deployServer.yml
# Docker images
server-docker-image:
@pushd ${PWD}/geoipserver >/dev/null && \
make docker-image && \
popd
updater-docker-image:
@pushd ${PWD}/geoipupdate >/dev/null && \
make docker-image && \
popd
docker-images: server-docker-image updater-docker-image
# Manifest files
clean:
@rm -rf *.yml
all-manifests: makePV.yml scheduleUpdates.yml deployServer.yml
makePV.yml:
@./templates/generate-makePV-manifest.sh > makePV.yml
scheduleUpdates.yml:
@./templates/generate-scheduleUpdates-manifest.sh > scheduleUpdates.yml
deployServer.yml:
@./templates/generate-deployServer-manifest.sh > deployServer.yml
# Deploy on k8s
# Make local persistent volumes
makePV: makePV.yml
@kubectl apply -f makePV.yml
# Set up a cronjob for updating GeoIP2/GeoLite2 database binaries
scheduleUpdates: scheduleUpdates.yml makePV updater-docker-image
@kubectl apply -f scheduleUpdates.yml
@kubectl create job --from=cronjob/geoipupdate ${INIT_JOB_NAME}
# Deploy GeoIP WebAPI service
deployServer: deployServer.yml makePV server-docker-image
@kubectl apply -f deployServer.yml
# Deploy all
deploy: all
all: makePV scheduleUpdates deployServer
# Delete resources deployed on k8s
destroyPV: makePV.yml
@kubectl delete -f makePV.yml
unscheduleUpdates: scheduleUpdates.yml
@kubectl delete job ${INIT_JOB_NAME}
@kubectl delete -f scheduleUpdates.yml
destroyServer: deployServer.yml
@kubectl delete -f deployServer.yml
destroy-all: destroyServer unscheduleUpdates destroyPV