-
Notifications
You must be signed in to change notification settings - Fork 170
/
Taskfile.yaml
180 lines (174 loc) · 5.26 KB
/
Taskfile.yaml
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
version: "3"
tasks:
setup:
cmds:
- task: install-dependencies
- task: generate-certs
- task: set-env-db
- task: migrate
- task: generate-all
- task: generate-local-encryption-keys
- task: set-env-all
- task: seed-dev
- task: copy-ca-to-sdks
set-env-db:
cmds:
- |
cat > .env <<EOF
DATABASE_URL='postgresql://hatchet:[email protected]:5431/hatchet'
EOF
set-env-all:
cmds:
- |
randstring() { openssl rand -base64 69 | tr -d "\n" | tr -d "=+/" | cut -c1-$1; }
cat > .env <<EOF
DATABASE_URL='postgresql://hatchet:[email protected]:5431/hatchet'
SERVER_TLS_CERT_FILE=./hack/dev/certs/cluster.pem
SERVER_TLS_KEY_FILE=./hack/dev/certs/cluster.key
SERVER_TLS_ROOT_CA_FILE=./hack/dev/certs/ca.cert
SERVER_ENCRYPTION_MASTER_KEYSET_FILE=./hack/dev/encryption-keys/master.key
SERVER_ENCRYPTION_JWT_PRIVATE_KEYSET_FILE=./hack/dev/encryption-keys/private_ec256.key
SERVER_ENCRYPTION_JWT_PUBLIC_KEYSET_FILE=./hack/dev/encryption-keys/public_ec256.key
SERVER_PORT=8080
SERVER_URL=http://localhost:8080
SERVER_AUTH_COOKIE_SECRETS="$(randstring 16) $(randstring 16)"
SERVER_AUTH_COOKIE_DOMAIN=app.dev.hatchet-tools.com
SERVER_AUTH_COOKIE_INSECURE=false
SERVER_AUTH_SET_EMAIL_VERIFIED=true
SERVER_LOGGER_LEVEL=debug
SERVER_LOGGER_FORMAT=console
DATABASE_LOGGER_LEVEL=debug
DATABASE_LOGGER_FORMAT=console
EOF
start-db:
cmds:
- docker compose up -d
stop-db:
cmds:
- docker compose down
recreate-db-from-scratch:
cmds:
- docker compose down
- docker volume rm oss_hatchet_postgres_data
- docker volume rm oss_hatchet_rabbitmq_data
- docker compose up -d
- task: setup
- task: init-dev-env
set-etc-hosts:
cmds:
- sudo sh ./hack/dev/manage-hosts.sh add 127.0.0.1 app.dev.hatchet-tools.com
migrate:
cmds:
- task: generate-sqlc
- task: atlas-compare-schema-to-migrations-dir
- task: atlas-apply-migrations
atlas-compare-schema-to-migrations-dir:
cmds:
- sh ./hack/dev/atlas-migrate.sh {{.CLI_ARGS}}
atlas-apply-migrations:
cmds:
- DATABASE_URL='postgresql://hatchet:[email protected]:5431/hatchet' sh ./hack/db/atlas-apply.sh
seed-dev:
cmds:
- SEED_DEVELOPMENT=true sh ./hack/dev/run-go-with-env.sh run ./cmd/hatchet-admin seed
start-dev:
deps:
- task: start-db
- task: start-api
- task: start-engine
- task: start-frontend
start-api:
cmds:
- sh ./hack/dev/start-api.sh
start-engine:
cmds:
- sh ./hack/dev/start-engine.sh
start-frontend:
cmds:
- sh ./hack/dev/start-frontend.sh
start-ngrok:
cmds:
- ngrok http 8080
start-lite:
cmds:
- sh ./hack/dev/start-lite.sh
generate-all:
cmds:
- task: install-dependencies
- task: generate-api
- task: generate-go
- task: generate-proto
- task: generate-sqlc
- task: pre-commit-run
install-dependencies:
cmds:
- go mod download
- cd frontend/app/ && pnpm install
- cd frontend/docs/ && pnpm install
generate-api:
cmds:
- task: generate-api-server
- task: generate-api-client
generate-certs:
cmds:
- sh ./hack/dev/generate-x509-certs.sh ./hack/dev/certs
generate-local-encryption-keys:
cmds:
- sh ./hack/dev/generate-local-encryption-keys.sh ./hack/dev/encryption-keys
init-dev-env:
- sh ./hack/dev/init-dev-token-and-env.sh
generate-dev-api-token:
cmds:
- sh ./hack/dev/generate-dev-api-token.sh
generate-api-server:
cmds:
- sh ./hack/oas/generate-server.sh
silent: true
generate-api-client:
cmds:
- sh ./hack/oas/generate-clients.sh
silent: true
generate-go:
cmds:
- go generate ./...
generate-proto:
cmds:
- sh ./hack/proto/proto.sh
generate-proto-python:
dir: ./python-sdk
cmds:
- sh ./generate.sh
generate-sqlc:
cmds:
- go run github.com/sqlc-dev/sqlc/cmd/[email protected] generate --file pkg/repository/prisma/dbsqlc/sqlc.yaml
lint:
cmds:
- task: lint-go
- task: lint-frontend
lint-go:
cmds:
- golangci-lint run ./... --config .golangci.yml
lint-frontend:
cmds:
- cd frontend/app/ && pnpm run lint:check
kill-query-engines:
cmds:
- ps -A | grep 'prisma-query-engine-darwin-arm64' | grep -v grep | awk '{print $1}' | xargs kill -9 $1
kill-apis:
cmds:
- ps -A | grep 'cmd/hatchet-api' | grep -v grep | awk '{print $1}' | xargs kill -9 $1
- ps -A | grep 'exe/hatchet-api' | grep -v grep | awk '{print $1}' | xargs kill -9 $1
kill-engines:
cmds:
- ps -A | grep 'cmd/hatchet-engine' | grep -v grep | awk '{print $1}' | xargs kill -9 $1
- ps -A | grep 'exe/hatchet-engine' | grep -v grep | awk '{print $1}' | xargs kill -9 $1
copy-ca-to-sdks:
cmds:
- mkdir -p ./python-sdk/certs/ && cp ./hack/dev/certs/ca.cert ./python-sdk/certs/
pre-commit-install:
cmds:
- pip install pre-commit # can use brew install pre-commit if you are on macOS
- pre-commit install
pre-commit-run:
cmds:
- pre-commit run --all-files || pre-commit run --all-files