Skip to content
tako
Esc
↑↓navigate↵open⌘Jpreview
On this page

Deployment

Build and deploy a Tako release: select an environment, package native or container artifacts, run release commands, and verify rolling updates.

Tako deploys locally built apps to servers you control. The CLI validates project state, builds and packages the release, uploads artifacts over signed, pinned HTTPS management, and asks tako-server to prepare and roll the release into traffic.

Server Setup

Provision a supported Linux host and enroll private management access using Servers. That page covers system requirements, isolation, installation, and recovery access.

Add A Server

Use Native networks to create a network and enroll a host.

Configure An Environment

Copy its stable ID from tako network list --json:

[envs.production]
network = "0123456789abcdef0123456789abcdef"
route = "app.example.com"

The CLI resolves current trusted server members and uses per-device signed HTTPS. No local WireGuard interface or SSH agent is needed. A scoped deployment requires administrator-provisioned routes and server-level bindings. App secrets remain separate per-environment credentials. See sandbox enrollment.

Set servers = ["edge-a", "edge-b"] alongside network to deploy this app to those two members. Omit servers to deploy to the entire network. Other applications can choose other members and communicate over the same private network. See re-enrollment when replacing an external VPN installation.

Deploy

tako deploy --env production
tako deploy --env staging

Use tako --config release.toml deploy --env production for an alternate config. Its parent directory supplies the project root and local secret drafts. Deploy loads cached secrets and resolves server inventory only for the selected environment and network; an expired membership in an unrelated staging network does not block a production deploy. Existing drafts cannot silently move to another app or network when you change configs. See alternate configurations.

When --env is omitted, deploy targets production. In an interactive terminal, an implicit production deploy asks for confirmation — but only if tako.toml declares more than one deployable environment (development doesn’t count). With a single environment, there’s nothing the deploy could have implicitly missed, so it proceeds without asking. Passing --env production, --yes, or -y also skips the prompt by making the target explicit.

The CLI, server, and release artifact must use the same protocol version. Tako checks before parallel deployment starts and again on each server before dependency preparation, release commands, workflow synchronization, or app startup. A mismatch fails the deploy without starting those workloads. --force attempts the incompatible deploy but does not skip validation or readiness checks; unlike --yes, it does not control confirmation prompts.

Inspect a mismatch before choosing to force it. For automation, select the environment explicitly and use --yes only when the deployment is already authorized.

Deploy validates secrets, storage credentials, provider credentials, routes, server target metadata, workflow/channel storage requirements, and local-storage limitations before build work starts.

Build And Artifact Rules

Build precedence:

  1. [[build_stages]]
  2. [build]
  3. Runtime default
  4. No-op

Tako copies the source root into .tako/build, respects .gitignore, symlinks node_modules from the original tree for JS builds, omits source symlinks, runs build commands, merges assets into public/, verifies the resolved main, and archives the result without node_modules.

The final native artifact includes regular files only; build-created symlinks are omitted too. Do not depend on linked files being deployed. This differs from app data backups, which preserve symlinks.

Native network servers accept compressed artifacts up to 512 MiB. The upload deadline is five minutes plus six seconds per MiB, rounded up. A 102 MiB upload has 15 minutes and 12 seconds to finish. An upload that stops sending data for 30 seconds times out. Transfer errors include the number of bytes received and the declared size.

Always-excluded paths: .git/, .tako/, .env*, and node_modules/.

Version names are based on git state: clean commit hash, dirty commit plus content hash, or nogit_<hash> when no git commit is available.

Native Releases

Native releases use runtime plugins or explicit start commands. JS runtimes run through SDK entrypoint wrappers. Go binaries run directly. Explicit start commands skip runtime defaults and runtime version probing.

Runtime download or version resolution failures abort release preparation. Runtimes without a download definition use the server’s PATH. Production dependency installation must succeed before the new release starts; dependency directories are not included in the uploaded archive.

Native HTTP instances bind 127.0.0.1 on an OS-assigned port and signal readiness through fd 4. Secrets, storage bindings, and the internal health token arrive through fd 3.

Compose Releases

Docker Compose deployments prepare images and update only changed services. Each stateless x-tako app uses readiness checks, traffic switching, and draining while unchanged dependencies keep running. Stateful services and workers default to stop-first updates. Compose supports one server, any number of x-tako apps with their own routes, and persistent named volumes; rollback restores containers and configuration, not database contents.

Container Releases

The Docker section covers image configuration, Dockerfiles by language, and container workflow workers.

container = "Dockerfile"

Container releases upload source and let tako-server build the image with Podman. HTTP containers run from the image defaults and receive HOST=0.0.0.0, PORT=3000, app vars, TAKO_BUILD, and TAKO_BOOTSTRAP_DATA.

Use a Tako SDK inside the container so secrets, storage bindings, internal status, and health-probe authentication follow the same contract as native releases. Container HTTP instances receive a persistent data mount and TAKO_DATA_DIR. They do not receive fd 3, fd 4, or the internal workflow socket. Plain images may opt out of the SDK contract with container_options.sdk = false; see Container releases.

A configured workflow run starts a separate container process from the same image with an entrypoint override, args from run[1..], a mounted internal socket, and TAKO_BOOTSTRAP_DATA. In v0, container releases support one configured workflow run command across the base workflow config and named groups.

Release Commands

release = "bun run db:migrate"

[envs.staging]
release = ""

The release command runs once on the leader server after extract and production install but before rolling update. Followers wait for the leader result. If the command fails, times out, or exits by signal, deploy aborts on every server and leaves the old release serving.

The command runs with the same env as new HTTP instances, plus freshly decrypted secrets as env vars. The hard timeout is 10 minutes.

Release commands, production installs, and container builds retain the last 64 KiB of each output stream for diagnostics. Output is drained throughout execution, including when a command writes binary data.

Rolling Updates

For a native rolling update, each server starts the replacement instances while the previous release continues serving its routes and static assets. Once the replacements pass readiness and stability checks, the server saves the release, routes, and bindings in one transaction. It then publishes the new routes and assets, switches traffic, and drains the previous instances. If the save fails, deploy reports an error and the previous release stays active, including after a server restart. The current symlink moves after the rolling update succeeds.

Draining an old instance waits up to 30 seconds for its in-flight requests to finish, including streaming responses such as server-sent events, so a finite stream like a token-by-token answer completes before the instance stops. Upgraded WebSocket connections do not hold the drain: once the other requests finish, Tako sends the instance SIGTERM and stops it, which closes those sockets, so clients should reconnect; new connections reach the replacement instances. On SIGTERM the JavaScript SDK stops accepting connections and lets in-flight requests and streams finish for up to 8 seconds, then closes what remains abruptly, so clients see an error rather than a truncated response that looks complete. Plain fetch handlers cannot accept WebSocket upgrades. Go and Rust apps that serve WebSockets can close them with code 1012 (service restart) on SIGTERM; clients should treat it as a signal to reconnect. The process is killed if it has not exited after a grace period (15 seconds for native processes, 10 seconds for containers by default); connections still open then are reset. For long-lived subscriptions, use Tako channels and presence: their connections terminate at tako-server rather than at an app instance, so app deploys do not close them.

After finalize, each server keeps the active release and prunes non-active releases older than 30 days or beyond 50 total releases. Release files still referenced by Compose containers are retained until those containers are replaced or removed.

If desired instances are 0, deploy still starts one warm instance for the new build so traffic works immediately. It can later idle out.

Failures, including a new instance becoming unhealthy during the stability window, keep old instances running, clean partial release directories when needed, roll back release metadata, and report per-server results.

After rollout, inspect tako status --json, request the real route, and read finite app logs. Verify the changed behavior through the application; successful upload or rollout alone does not prove that a database migration or user flow works.

Scaling

See Operations for changing desired instance counts, scale-to-zero behavior, and post-change verification. Scaling is server-side state rather than a tako.toml instance-count field. For Compose, per-service scale overrides survive deployments and take precedence over deploy.replicas; tako scale --reset restores the selected service’s Compose default.

Secrets And Credentials

Configure app secrets and provider credentials before deployment. App secrets feed your SDK; ssl.cloudflare and postgres_url configure Tako-owned runtime services. Deployment sends the relevant changed values.

Storage And Backups

Use Storage to bind app files and Backups to protect the deployed data tree. Backup-only resources are not exposed as app storage bindings.

TLS

See Routing and TLS for domain routes, certificate providers, wildcard credentials, public ports, and client-IP policy.

Server Maintenance

See Servers for reloads, protocol-checked upgrades, recovery, and uninstall behavior.

Logs And Releases

Use Operations to inspect release history, collect finite logs, and roll back code. Verify the deployed route after every release.

Metrics

The Prometheus endpoint and metric names are documented in Operations.

Network primitives

Deploy callers and recipients into the same environment and network for network primitive calls. The caller uses app.primitive and inherits its environment. The recipient needs the JavaScript managed HTTP runtime. Share generated tako-schema.json files and list them under schemas in each consumer. Commit tako-schema.lock for remote sources; deployment reuses pinned schemas. Run tako gen before building native Go/Rust consumers. Types do not configure routing or grant access; signed cross-server invocations authenticate app callers separately from ordinary private HTTP.

Last updated on

Was this page helpful?