-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile.yml
144 lines (121 loc) · 4.42 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
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
version: '3'
dotenv:
- .env
env:
COMMIT_SHA:
sh: git rev-parse --short HEAD
vars:
PROJECT_NAME: giga-dataops_trino
tasks:
default:
cmds:
- task: up
up:
desc: Build and start Docker containers
cmds:
- docker compose --project-name giga-dataops-platform --file docker-compose-network.yaml up --detach --build --remove-orphans {{.CLI_ARGS}}
- docker compose --project-name {{.PROJECT_NAME}} up --detach --build --remove-orphans {{.CLI_ARGS}}
setup:
desc: Run first-time setup tasks
cmds:
- pip install pre-commit
- pre-commit install
- helm repo add trino https://trinodb.github.io/charts/
- helm repo update
logs:
desc: Attach to Docker logs
cmds:
- docker compose --project-name {{.PROJECT_NAME}} logs --follow {{.CLI_ARGS}}
stop:
desc: Stop containers
cmds:
- docker compose --project-name {{.PROJECT_NAME}} stop {{.CLI_ARGS}}
restart:
desc: Restart containers
cmds:
- docker compose --project-name {{.PROJECT_NAME}} restart {{.CLI_ARGS}}
exec:
desc: Run a command in the specified container
cmds:
- docker compose --project-name {{.PROJECT_NAME}} exec {{.CLI_ARGS}}
clean:
desc: Remove containers
cmds:
- docker compose --project-name {{.PROJECT_NAME}} down --volumes --remove-orphans {{.CLI_ARGS}}
build-and-push:
desc: Build and push Docker image
cmds:
- task: build
- task: push
build:
internal: true
desc: Build Docker image
cmds:
- docker build --tag {{.TRINO_IMAGE_REPOSITORY}}:{{.COMMIT_SHA}} .
push:
internal: true
desc: Push Docker image
cmds:
- docker push {{.TRINO_IMAGE_REPOSITORY}}:{{.COMMIT_SHA}}
k8s-prereqs:
desc: Setup pre-requisite K8s resources
dir: infra/k8s
cmds:
- kubectl apply -f namespace.yaml
- kubectl apply -f secrets.yaml -n giga-trino
- kubectl apply -f configmap.local.yaml -n giga-trino
helm-up:
desc: Install/upgrade Helm chart on a cluster running locally
cmds:
- task: k8s-prereqs
- >
helm upgrade --install trino ./infra/helm/trino
--namespace giga-trino
--set-string server.internalSharedSecret={{.SHARED_SECRET}}
--set-file 'accessControl.rules.rules\.json'=./conf/rules.json
--set-file additionalCatalogs.delta_lake=./conf/catalog/delta_lake.properties
--set service.type=LoadBalancer
helm-upi:
desc: Install/upgrade Helm chart on a cluster with pre-configured HTTPS ingress
cmds:
- task: k8s-prereqs
- >
helm upgrade --install trino ./infra/helm/trino
--namespace giga-trino
--set-string server.internalSharedSecret={{.SHARED_SECRET}}
--set-file additionalCatalogs.delta_lake=./conf/catalog/delta_lake.properties
--set additionalCatalogs.pg_dev_oia_prjrazordb=null
--set additionalCatalogs.gigamaps_production_db=null
--set additionalCatalogs.gigameter_production_db=null
--set-file auth.groups=./conf/group.txt
--set accessControl.refreshPeriod=5s
--set auth.refreshPeriod=5s
--set auth.passwordAuthSecret=giga-trino-secrets
--set ingress.enabled=true
--set ingress.annotations=null
--set ingress.hosts[0].host={{.TRINO_INGRESS_HOST}}
--set ingress.hosts[0].paths[0].path=/
--set ingress.hosts[0].paths[0].pathType=Prefix
--set envFrom[0].secretRef.name=giga-trino-secrets
helm-down:
desc: Uninstall Helm chart
cmds:
- helm uninstall trino --namespace giga-trino
helm-clean:
desc: Delete all K8s resources
cmds:
- kubectl delete all --all --namespace giga-trino
- kubectl delete pvc --all --namespace giga-trino
hash-password:
desc: Generate hash for a password
cmds:
- echo '{{.CLI_ARGS}}' | htpasswd -inBC 10 {{.TRINO_ADMIN_USER}}
trino:
desc: Spawn an interactive Trino shell connecting to your local instance
cmd: task exec -- -it trino trino --user {{.TRINO_ADMIN_USER}}
trino-dev:
desc: Spawn an interactive Trino shell connecting to the DEV instance
cmd: docker run --rm -it --entrypoint trino trinodb/trino:440 --server https://io-trino-dev.unitst.org --user tmadmin --password
trino-stg:
desc: Spawn an interactive Trino shell connecting to the STG instance
cmd: docker run --rm -it --entrypoint trino trinodb/trino:440 --server https://io-trino-stg.unitst.org --user giga-admin --password