-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
81 lines (73 loc) · 2.44 KB
/
Taskfile.yml
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
version: "3"
vars:
CLI_IMAGE_LOCAL_NAME: moderate-cli
CLI_IMAGE_REMOTE_NAME: agmangas/moderate-cli
DAGSTER_NAMESPACE: dagster
DAGSTER_WEBSERVER_PORT: 8181
dotenv:
- .env.local
tasks:
get-credentials:
desc: Configure kubectl with credentials for the GKE cluster
requires:
vars:
- PROJECT_ID_PRODUCTION
- REGION_PRODUCTION
cmds:
- >
gcloud container clusters get-credentials gke-cluster
--region {{.REGION_PRODUCTION}}
--project {{.PROJECT_ID_PRODUCTION}}
update-dns:
desc: Update DNS records to point to the cluster load balancer
deps:
- get-credentials
requires:
vars:
- PROJECT_ID_COMMON
dir: "{{.ROOT_DIR}}/scripts"
env:
PROJECT_ID: "{{.PROJECT_ID_COMMON}}"
cmds:
- ./update-dns.sh
apply-prod:
desc: Apply Terraform configuration for the "production" GCP project
dir: "{{.ROOT_DIR}}/gcp_prod"
cmds:
- terraform init
- terraform apply
- task: get-credentials
- task: update-dns
destroy-prod:
desc: Destroy Terraform configuration for the "production" GCP project
dir: "{{.ROOT_DIR}}/gcp_prod"
cmds:
- terraform destroy
push-cli-image:
desc: Build and push the MODERATE CLI image to the public registry
vars:
CLI_IMAGE_REMOTE_TAG:
sh: cd {{.ROOT_DIR}}/cli && poetry version --short 2> echo
prompt: 🚧 This will push the CLI image to the public registry with tag '{{.CLI_IMAGE_REMOTE_TAG}}'. Are you sure?
cmds:
- docker buildx build --platform=linux/amd64 -t {{.CLI_IMAGE_LOCAL_NAME}} {{.ROOT_DIR}}/cli
- docker tag {{.CLI_IMAGE_LOCAL_NAME}} {{.CLI_IMAGE_REMOTE_NAME}}:{{.CLI_IMAGE_REMOTE_TAG}}
- docker tag {{.CLI_IMAGE_LOCAL_NAME}} {{.CLI_IMAGE_REMOTE_NAME}}:latest
- docker push {{.CLI_IMAGE_REMOTE_NAME}}:{{.CLI_IMAGE_REMOTE_TAG}}
- docker push {{.CLI_IMAGE_REMOTE_NAME}}:latest
port-forward-dagster-ui:
desc: Expose the Dagster UI to localhost using kubectl port-forward
deps:
- get-credentials
vars:
DAGSTER_WEBSERVER_POD_NAME:
sh: kubectl get pods --namespace {{.DAGSTER_NAMESPACE}} -l "component=dagster-webserver" -o jsonpath="{.items[0].metadata.name}"
cmds:
- >
while true; do
(kubectl port-forward
-n {{.DAGSTER_NAMESPACE}}
--address=0.0.0.0
{{.DAGSTER_WEBSERVER_POD_NAME}}
{{.DAGSTER_WEBSERVER_PORT}}:80) || true;
done