-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (66 loc) · 2.15 KB
/
Makefile
File metadata and controls
82 lines (66 loc) · 2.15 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
SECRET_NAME=""
ENV_FILE=".env"
GITHUB_ACTIONS_ENV := $(shell test -n "$$GITHUB_ACTIONS" && echo "true" || echo "false")
important_message = \
@echo "\033[0;31m$(1) \033[0m"
info_message = \
@echo "\033[0;32m$(1) \033[0m"
count_down = \
@echo "Spinning up the system please wait..."; \
secs=10 ;\
while [ $$secs -gt 0 ]; do \
printf "%d\033[0K\r" "$$secs"; \
sleep 1; \
secs=$$((secs - 1)); \
done;
.PHONY:
clean
all
list
test
all: sm2a-local-init sm2a-local-run
refresh: sm2a-local-build sm2a-local-run
count_down_test:
$(count_down)
sm2a-local-run: sm2a-local-stop
@echo "Running SM2A"
docker compose up -d
$(call important_message, "Give the resources a minute to be healthy 💪")
$(count_down)
$(call info_message, "Please visit http://localhost:8080")
@echo "username:airflow | password:airflow"
@echo "To use local SM2A with AWS update ${SM2A_FOLDER}/sm2a-local-config/.env AWS credentials"
sm2a-local-init:
docker compose run --rm airflow-cli db init
docker compose run --rm airflow-cli users create --email airflow@example.com --firstname airflow --lastname airflow --password airflow --username airflow --role Admin
sm2a-local-stop:
docker compose down
sm2a-local-build:
docker compose build
sm2a-deploy:
ifeq ($(GITHUB_ACTIONS_ENV),true)
@echo "Installing the deployment dependency"
pip install -r ./deploy_requirements.txt
@echo "Deploying SM2A"
python scripts/generate_env_file.py --secret-id ${SECRET_NAME} --env-file ${ENV_FILE}
@bash -c './scripts/deploy.sh ${ENV_FILE} <<< init'
@bash -c './scripts/deploy.sh ${ENV_FILE} <<< deploy'
else
$(call important_message, "Wait a minute you are not github 😡")
endif
sm2a-plan:
@echo "Installing the deployment dependency"
pip install -r ./deploy_requirements.txt
@echo "Shopwing Plan for Deploying SM2A"
python scripts/generate_env_file.py --secret-id ${SECRET_NAME} --env-file ${ENV_FILE}
@bash -c './scripts/deploy.sh ${ENV_FILE} <<< init'
@bash -c './scripts/deploy.sh ${ENV_FILE} <<< plan'
clean: sm2a-local-stop
@echo "Cleaning local env"
docker container prune -f
docker image prune -f
docker volume prune -f
list:
@grep '^[^#[:space:]].*:' Makefile
test:
pytest tests