Files
hatchet/Taskfile.yaml
Sean Reilly e32f353587 Speed up the delete worker query (#1103)
* add an index on lastHeartbeatAt and don't do highly related actions concurrently



---------

Co-authored-by: Sean Reilly <sean@hatchet.run>
2024-12-12 20:49:22 -05:00

181 lines
5.3 KiB
YAML

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:hatchet@127.0.0.1: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:hatchet@127.0.0.1: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:hatchet@127.0.0.1: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/sqlc@v1.24.0 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