-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
134 lines (96 loc) · 3.34 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
PROJECT = "MOJA-BOX"
dir = $(shell pwd)
include ./config/.compiled_env
env_dir := $(dir)/config
##
# Env
##
env:
cat ${env_dir}/mojaloop.public.sh ${env_dir}/mojaloop.private.sh > ${env_dir}/.compiled_env
##
# Deployment
##
deploy-infra:
@cd terraform && terraform plan
deploy-infra-apply:
@cd ./terraform && terraform apply
deploy-infra-destroy:
@cd ./terraform && terraform destroy
deploy-kube:
#get the currently running clusters
gcloud container clusters list
gcloud container clusters get-credentials moja-box-cluster
#init helm
helm init
#Fix up permissions for helm to work
make helm-fix-permissions
kubectl -n kube-system get pod | grep tiller
@echo 'Not deploying-moja - make sure to set up CLUSTER_IP manually'
make deploy-moja
deploy-moja:
@echo 'Installing Mojaloop'
helm repo add mojaloop http://mojaloop.io/helm/repo/
helm install --debug --namespace=mojaloop --name=dev --repo=http://mojaloop.io/helm/repo mojaloop
helm repo update
@echo installing Nginx
helm --namespace=mojaloop install stable/nginx-ingress --name=nginx \
--set controller.service.loadBalancerIP="${CLUSTER_IP}"
@make print-hosts-settings
@echo installing Kubernetes dasboard
helm install stable/kubernetes-dashboard \
--namespace kube-dash \
--name kube-dash \
--set rbac.clusterAdminRole=true,enableSkipLogin=true,enableInsecureLogin=true
deploy:
make deploy-infra-apply
make deploy-kube
##
# Configuration
##
config-all:
@make config-set-up config-create-dfsps
config-set-up:
@make env
@./mojaloop_config/00_set_up_env.sh
@echo 'Done!'
config-create-dfsps:
@make env
@./mojaloop_config/01_create_dfsps.sh
@echo 'Done!'
##
# Examples
##
example-create-transfer:
@./mojaloop_config/02_create_transfer.sh
##
# Misc
##
helm-fix-permissions:
@helm list || echo 'command failed'
#Give helm the necessary permissions to install stuff on the cluster
kubectl -n kube-system delete serviceAccounts tiller || echo 'nothing to delete'
kubectl -n kube-system delete clusterrolebindings tiller-cluster-rule || echo 'nothing to delete'
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
#patch the permissions
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm init --service-account tiller --upgrade
sleep 10
helm list || echo 'helm list failed. May not be fatal'
print-hosts-settings:
@echo "Make sure your /etc/hosts contains the following:\n"
@echo ' ${CLUSTER_IP} interop-switch.local central-kms.local forensic-logging-sidecar.local central-ledger.local central-end-user-registry.local central-directory.local central-hub.local central-settlement.local ml-api-adapter.local'
proxy-kube-dash:
@echo "Go to: http://localhost:8002/api/v1/namespaces/kube-dash/services/kube-dash-kubernetes-dashboard:http/proxy/"
@kubectl proxy --port 8002
health-check:
@make env
curl -H Host:'central-directory.local' http://${CLUSTER_IP}/health
print-ip:
echo 'Warning! This is the cluster endpoint, and not the loadbalancer endpoint!'
@cd ./terraform && terraform output | grep loadbalancer | awk 'BEGIN { FS = " = " }; { print $$2 }'
print-endpoints:
@kubectl get ep -n mojaloop
remove-helm:
helm reset --force
.PHONY: switch switch-dev swich-prod env