Regions and runners
A region is where sandboxes run, such as us or eu. Inside a region, runners are the machines that host sandboxes, and Daytona’s scheduler places each new sandbox on one. Daytona runs shared regions for every organization. An organization allowed to bring its own compute can add a custom region: Daytona still runs the API and the scheduler, and the runners are machines you operate.
Runners host sandboxes inside a region
Section titled “Runners host sandboxes inside a region”Pick a region
Section titled “Pick a region”A sandbox runs in its organization’s default region unless it sets target. Changing target replaces the sandbox.
import * as Daytona from "@alchemy.run/daytona";import { Base } from "./Images.ts";
export const DevBox = Daytona.Sandbox("DevBox", { snapshot: Base, target: "eu" });Set the organization’s default with defaultRegionId on OrganizationSettings.
Add a region of your own
Section titled “Add a region of your own”import * as Daytona from "@alchemy.run/daytona";
export const Home = Daytona.Region("Home", { proxyUrl: "https://proxy.daytona.example.com", sshGatewayUrl: "ssh.daytona.example.com:2222",});Daytona shows the region’s proxy and SSH gateway keys only when it creates or rotates them, so Alchemy keeps them in state. Bump a counter in rotate, like rotate: { proxyApiKey: 1 }, to rotate one.
Register a runner
Section titled “Register a runner”export const Box1 = Daytona.Runner("Box1", { region: Home });Box1.apiKey is the key you start the runner daemon with on your machine.
Drain a runner
Section titled “Drain a runner”export const Box2 = Daytona.Runner("Box2", { region: Home });export const Box2 = Daytona.Runner("Box2", { region: Home, draining: true });A draining runner takes no new sandboxes, and its sandboxes move off. unschedulable: true only stops new ones. Both change in place.