Quickstarts
Quickstart: Workers
Deploy a container from a gallery template and run a job.
Workers run heavy or long-running workloads (Python, Node, Go, Dockerfile) in isolated containers.
Variables used below: $HOSTBASE_TOKEN (access token), $REF (project ref). SDKs: @hostbase/management (TypeScript) and hostbase_management (Python); full reference at /docs/api.
1. Deploy from a template
The gallery has 30+ templates.
curl -X POST https://host.ulewicz.space/api/v1/projects/$REF/workers/from-template -H "Authorization: Bearer $HOSTBASE_TOKEN" -H "Content-Type: application/json" \
-d '{"template":"hono-bun-api","name":"api"}'await hb.deployWorkerFromTemplate({ ref, body: { template: "hono-bun-api", name: "api" } });hb.deploy_worker_from_template(ref=ref, body={"template": "hono-bun-api", "name": "api"})hostbase workers templates
hostbase workers deploy-template hono-bun-api --name api2. Scaling
Scale-to-zero and autoscaling between min and max.
curl -X PUT https://host.ulewicz.space/api/v1/projects/$REF/workers/api/scaling -H "Authorization: Bearer $HOSTBASE_TOKEN" -H "Content-Type: application/json" -d '{"min":0,"max":3,"auto":true}'await hb.setWorkerScaling({ ref, name: "api", body: { min: 0, max: 3, auto: true } });hb.set_worker_scaling(ref=ref, name="api", body={"min": 0, "max": 3, "auto": True})3. One-off job
Same image, your own command and timeout.
curl -X POST https://host.ulewicz.space/api/v1/projects/$REF/workers/api/jobs -H "Authorization: Bearer $HOSTBASE_TOKEN" -H "Content-Type: application/json" -d '{"command":"bun","args":["run","report.ts"],"timeout_s":600}'const job = await hb.runWorkerJob({ ref, name: "api", body: { command: "bun", args: ["run", "report.ts"], timeout_s: 600 } as never });hb.run_worker_job(ref=ref, name="api", body={"command": "bun", "args": ["run", "report.ts"], "timeout_s": 600})Next: /docs/workers.