prefect server in zig
at main 159 lines 4.2 kB view raw
1default: 2 @just --list 3 4# build the server 5build: 6 zig build 7 8# build optimized release 9build-release: 10 zig build -Doptimize=ReleaseFast 11 12# run dev server (sqlite, memory broker, debug logging) 13dev: build 14 rm -f prefect.db 15 PREFECT_SERVER_LOGGING_LEVEL=DEBUG ./zig-out/bin/prefect-server 16 17# run API test suite against local server 18test: 19 PREFECT_PROFILE=zig-server ./scripts/test-api-sequence 20 21# run .serve() integration test 22test-serve: 23 PREFECT_PROFILE=zig-server ./scripts/test-serve 24 25# broker backend tests (memory + redis) 26test-broker backend="all": 27 #!/usr/bin/env bash 28 set -euo pipefail 29 if [ "{{backend}}" = "redis" ] || [ "{{backend}}" = "all" ]; then 30 docker compose up -d redis 31 sleep 1 32 fi 33 ./scripts/test-broker-backends {{backend}} 34 if [ "{{backend}}" = "redis" ] || [ "{{backend}}" = "all" ]; then 35 docker compose down redis 36 fi 37 38# database backend tests (sqlite + postgres) 39test-db backend="all": 40 #!/usr/bin/env bash 41 set -euo pipefail 42 if [ "{{backend}}" = "postgres" ] || [ "{{backend}}" = "all" ]; then 43 docker compose up -d postgres 44 sleep 2 45 fi 46 ./scripts/test-db-backends {{backend}} 47 if [ "{{backend}}" = "postgres" ] || [ "{{backend}}" = "all" ]; then 48 docker compose down postgres 49 fi 50 51# run high-level prefect client tests (requires running server) 52test-client: 53 PREFECT_PROFILE=zig-server ./scripts/test-flow 54 PREFECT_PROFILE=zig-server ./scripts/test-blocks 55 56# run worker integration tests (scheduler + worker execution) 57test-worker: 58 PREFECT_PROFILE=zig-server ./scripts/test-worker 59 60# run retry orchestration tests 61test-retry: 62 PREFECT_PROFILE=zig-server ./scripts/test-retry 63 64# run full test matrix (all db × broker combinations) 65test-matrix: 66 ./scripts/test-matrix 67 68# run quick test (sqlite + memory only) 69test-quick: 70 ./scripts/test-matrix --quick 71 72# run all tests (legacy - prefer test-matrix) 73test-all: test test-serve test-client test-broker test-db 74 75# start dev services (redis + postgres) 76services-up: 77 docker compose up -d redis postgres 78 79# stop dev services 80services-down: 81 docker compose down 82 83# build and run server in docker 84docker-build: 85 docker compose build server 86 87# run server in docker (sqlite + memory) 88docker-run: docker-build 89 docker compose up server 90 91# run integration tests in docker 92docker-test: 93 docker compose up --build -d server 94 docker compose run --rm test 95 docker compose down 96 97# run server with postgres + redis in docker 98docker-full: 99 PREFECT_DATABASE_BACKEND=postgres \ 100 PREFECT_DATABASE_URL="postgresql://prefect:prefect@postgres:5432/prefect" \ 101 PREFECT_BROKER_BACKEND=redis \ 102 docker compose up --build 103 104# run integration tests with postgres + redis 105docker-full-test: 106 PREFECT_DATABASE_BACKEND=postgres \ 107 PREFECT_DATABASE_URL="postgresql://prefect:prefect@postgres:5432/prefect" \ 108 PREFECT_BROKER_BACKEND=redis \ 109 docker compose up --build -d server 110 docker compose run --rm test 111 docker compose down 112 113# performance benchmark (zig server) 114bench: 115 ./scripts/benchmark --server zig 116 117# performance benchmark comparison (zig vs python) 118bench-compare: 119 ./scripts/benchmark --compare 120 121# performance benchmark matrix (all db × broker combinations) 122bench-matrix: 123 ./scripts/benchmark --matrix 124 125# publish docker image to atcr.io 126docker-publish tag="latest": 127 docker build -t prefect-server:{{tag}} . 128 docker tag prefect-server:{{tag}} atcr.io/zzstoatzz.io/prefect-server:{{tag}} 129 docker push atcr.io/zzstoatzz.io/prefect-server:{{tag}} 130 131# clean build artifacts 132clean: 133 rm -rf zig-out .zig-cache prefect.db 134 135# --- kubernetes --- 136 137# deploy to kubernetes 138k8s-deploy: 139 kubectl apply -k k8s/ 140 141# check kubernetes status 142k8s-status: 143 kubectl -n prefect get pods,svc 144 145# port-forward to access locally 146k8s-forward: 147 kubectl -n prefect port-forward svc/prefect-server 4200:4200 148 149# scale API servers 150k8s-scale replicas="3": 151 kubectl -n prefect scale deployment/prefect-api --replicas={{replicas}} 152 153# view logs 154k8s-logs component="api": 155 kubectl -n prefect logs -l app.kubernetes.io/component={{component}} -f 156 157# delete kubernetes deployment 158k8s-delete: 159 kubectl delete -k k8s/