-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
109 lines (75 loc) · 2.9 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
#!/usr/bin/make -f
# DOCKER_USERNAME:= hagzag
# REPO:= docker.io
# REGISTRY := $(REPO)/$(DOCKER_USERNAME)
DOCKER_COMPOSE := /usr/local/bin/docker-compose
REDIS_PASSWORD := 'MyS3cr3t'
RELEASE_NAME := ping-app
CHART_BASE_DIR := ./deployment/helm/charts
CHART_NAME := pingalicious
.PHONY: k3d-devcluster k3d-cleanup-cluster dc-build dc-push dc-stop dc-clean-run dc-run
.PHONY: docker-check redis-container-start redis-container-stop redis-container-cleanup node-cleanup node-npm-install node-run-local
# k3d crete devcluster
k3d-devcluster:
@k3d cluster create devcluster \
--api-port 127.0.0.1:6443 \
-p 80:80@loadbalancer \
-p 443:443@loadbalancer
k3d-cleanup-cluster:
@k3d cluster delete devcluster
# helm labs
helm-dependency-build: ## helm-chart :: dependency build
@rm -f $(CHART_BASE_DIR)/$(CHART_NAME)/Chart.lock ; \
helm dependency build $(CHART_BASE_DIR)/$(CHART_NAME)
helm-install-chart: helm-dependency-build ## helm-install-source: helm upgrade $(CHART_NAME)-dev --install
@helm upgrade $(RELEASE_NAME)-dev --install $(CHART_BASE_DIR)/$(CHART_NAME)
helm-install-chart-init: ## helm-install-source: helm upgrade $(CHART_NAME)-dev --install
@echo "Please note this install is without ingress !"
@helm upgrade $(RELEASE_NAME)-dev --install -f $(CHART_BASE_DIR)/$(CHART_NAME)/values-init-version.yaml $(CHART_BASE_DIR)/$(CHART_NAME)
helm-cleanup-chart-release:
@helm uninstall $(RELEASE_NAME)-dev
helm-get-values: ## helm-get-values: helm get values $(CHART_NAME)-dev
@helm get values $(RELEASE_NAME)-dev
helm-get-manifest: ## helm-get-manifest: helm get manifest $(CHART_NAME)-dev
@helm get manifest $(RELEASE_NAME)-dev
# kustomize labs
ping-kustomize-deploy:
@kubectl apply -k ./deployment/kustomize/manifests
ping-kustomize-deploy-ingress:
@kubectl apply -k ./deployment/kustomize/ingress
ping-kustomize-deploy-configs:
@kubectl apply -k ./deployment/kustomize/configs
ping-kustomize-deploy-initContainers:
@kubectl apply -k ./deployment/kustomize/initContainers
# node-* run nodejs local
docker-check:
@docker ps &>/dev/null || echo "docker not running"
redis-container-start: docker-check
@docker ps | grep redis || \
docker run -d --name redis -p 6379:6379 redis redis-server --requirepass $(REDIS_PASSWORD) && \
docker ps | grep redis
redis-container-stop: docker-check
@docker stop redis
redis-container-cleanup:
@docker rm -f redis
# node-* run nodejs local
node-cleanup:
@rm -rf ./src/api/node_modules
node-npm-install:
@cd ./src/api && npm install
node-run-local: node-npm-install redis-container-start
@cd ./src/api && npm start
# dc-* docker-compose
dc-build:
$(DOCKER_COMPOSE) build
dc-run: | dc-stop
$(DOCKER_COMPOSE) up -d
dc-stop:
$(DOCKER_COMPOSE) down
dc-run-clean: | dc-stop dc-build dc-run
# remove volumes !
dc-clean:
$(DOCKER_COMPOSE) down --rmi local
# pushed to whatever the image: <repo>/<name> is set to ...
dc-push:
$(DOCKER_COMPOSE) push