-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (48 loc) · 2.38 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
docker-spin-up:
docker compose --env-file env up --build -d
sleeper:
sleep 15
up: docker-spin-up sleeper warehouse-migration
down:
docker compose down
shell:
docker exec -ti pipelinerunner bash
format:
docker exec pipelinerunner python -m black -S --line-length 79 .
isort:
docker exec pipelinerunner isort .
pytest:
docker exec pipelinerunner pytest /code/test
type:
docker exec pipelinerunner mypy --ignore-missing-imports /code
lint:
docker exec pipelinerunner flake8 /code
ci: isort format type lint pytest
stop-etl:
docker exec pipelinerunner service cron stop
####################################################################################################################
# Set up cloud infrastructure
tf-init:
terraform -chdir=./terraform init
infra-up:
terraform -chdir=./terraform apply
infra-down:
terraform -chdir=./terraform destroy
infra-config:
terraform -chdir=./terraform output
####################################################################################################################
# Datawarehouse migration
db-migration:
@read -p "Enter migration name:" migration_name; docker exec pipelinerunner yoyo new ./migrations -m "$$migration_name"
warehouse-migration:
docker exec pipelinerunner yoyo develop --no-config-file --database postgres://sdeuser:sdepassword1234@warehouse:5432/finance ./migrations
warehouse-rollback:
docker exec pipelinerunner yoyo rollback --no-config-file --database postgres://sdeuser:sdepassword1234@warehouse:5432/finance ./migrations
####################################################################################################################
# Port forwarding to local machine
cloud-metabase:
terraform -chdir=./terraform output -raw private_key > private_key.pem && chmod 600 private_key.pem && ssh -o "IdentitiesOnly yes" -i private_key.pem ubuntu@$$(terraform -chdir=./terraform output -raw ec2_public_dns) -N -v -f -L 3001:$$(terraform -chdir=./terraform output -raw ec2_public_dns):3000 && rm private_key.pem
####################################################################################################################
# Helpers
ssh-ec2:
terraform -chdir=./terraform output -raw private_key > private_key.pem && chmod 600 private_key.pem && ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i private_key.pem ubuntu@$$(terraform -chdir=./terraform output -raw ec2_public_dns) && rm private_key.pem