-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
145 lines (114 loc) · 3.69 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
ifeq ($(SHELL),/bin/sh)
SHELL:=/bin/bash
endif
DEBUG ?= -
ifeq (true,$(DEBUG))
AUTO_APPROVE =
OUTPUT_SUPPRESSOR =
else
AUTO_APPROVE = -auto-approve
OUTPUT_SUPPRESSOR = 1>/dev/null
endif
.PHONY: one-click-mlflow
one-click-mlflow: welcome dependencies-checks pre-requisites set-config deploy goodbye
.PHONY: deploy
deploy: docker apply
.PHONY: apply
apply: init-terraform import-oauth-stuff apply-terraform
.PHONY: destroy
destroy: init-terraform destroy-terraform
#################
# TERRAFORM #
#################
.PHONY: init-terraform
init-terraform:
@echo "Initializing Terraform..."
@source vars && cd IaC && rm -rf .terraform && terraform init -backend-config="bucket=$${TF_VAR_backend_bucket}" $(OUTPUT_SUPPRESSOR)
@echo "Done"
@echo
.PHONY: apply-terraform
apply-terraform:
@echo "Deploying infrastructure..."
@echo "This should take about 20 minutes, don't forget to stretch and hydrate ☕️"
@source vars && cd IaC && terraform apply $(AUTO_APPROVE) $(OUTPUT_SUPPRESSOR)
@echo "Done"
@echo
.PHONY: destroy-terraform
destroy-terraform:
@echo "Destroying deployed infrastructure..."
@source vars && cd IaC && terraform destroy $(AUTO_APPROVE) $(OUTPUT_SUPPRESSOR)
@echo "Done"
@echo
.PHONY: pre-requisites
pre-requisites: init-config set-project
@echo "Setting up your GCP project..."
@source vars && cd IaC/prerequesites && terraform init $(OUTPUT_SUPPRESSOR) && terraform apply $(AUTO_APPROVE) $(OUTPUT_SUPPRESSOR)
@echo "Done"
@echo
#################
# CONFIG #
#################
.PHONY: set-config
set-config: set_app_engine set-various set-network set-support-email set-users
.PHONY: set_app_engine
set_app_engine:
@cd bin && ./set_app_engine.sh
.PHONY: set-various
set-various:
@chmod +x ./bin/set_various.sh
@cd bin && ./set_various.sh
.PHONY: set-network
set-network:
@chmod +x ./bin/set_network.sh
@cd bin && ./set_network.sh
.PHONY: set-support-email
set-support-email:
@chmod +x ./bin/set_support_email.sh
@cd bin && ./set_support_email.sh
.PHONY: set-users
set-users:
@chmod +x ./bin/set_users.sh
@cd bin && ./set_users.sh
.PHONY: init-config
init-config:
@chmod +x ./bin/init_conf.sh
@cd bin && ./init_conf.sh
.PHONY: import-oauth-stuff
import-oauth-stuff:
@cd bin && ./oauth_stuff_import.sh
.PHONY: set-project
set-project:
@chmod +x ./bin/set_project.sh
@cd bin && ./set_project.sh
#################
# MISC #
#################
.PHONY: docker
docker:
@echo
@echo "Remotely building mlflow server docker image"
@source vars && gcloud builds submit --tag $${TF_VAR_mlflow_docker_image} ./tracking_server $(OUTPUT_SUPPRESSOR)
@echo "Done"
@echo
.PHONY: welcome
welcome:
@echo
@echo "Welcome to the GCP Mlflow deployment helper!"
@echo "If everything goes according to plan, you should have an up and running secure MLFlow install on your project in about 30 minutes"
@echo
.PHONY: dependencies-checks
dependencies-checks:
@chmod +x ./bin/check_dependencies.sh
@cd bin && ./check_dependencies.sh
.PHONY: goodbye
goodbye:
@echo
@echo "Congratulations, you successfully deployed MLFlow on your project! 🎉"
@source vars && echo "The web app is available at https://mlflow-dot-$${TF_VAR_project_id}.ew.r.appspot.com (You may have trouble connecting for a few minutes after the deployment, while IAP gets setup)"
@echo "To push your first experiment, take a look at the bottom of the readme for an example."
#################
# DEVTOOLS #
#################
setup-new-project:
rm -rf .terraform vars vars.json && cd IaC && rm -rf .terraform .terraform.lock.hcl prerequesites/.terraform prerequesites/.terraform.lock.hcl prerequesites/terraform.tfstate prerequesites/terraform.tfstate.backup
gcloud auth login && gcloud auth application-default login