Deploy Tool · Go

Deploy before you need Kubernetes.

docker compose for production — git-aware, multi-host, over SSH. Build, push, pull, restart — in order, only what changed. One binary, one config, no cluster.

Terminal
$_
Configuration

One file. Apps and infra together.

Drop .kb/deploy.yaml in the repo. kb-deploy reads it and decides what to build, push, and restart — over SSH, on the target host.

SSH_KEY is the name of an env variable holding the PEM key. Locally — in .env, in CI — as a secret.

yaml
registry: ghcr.io/your-org

targets:
  api:
    watch: [apps/api/**]
    image: my-project/api
    ssh:
      host: ${SSH_HOST}
      user: ${SSH_USER}
      key_env: SSH_KEY
    remote:
      compose_file: ~/app/docker-compose.yml
      service: api

  web:
    watch: [apps/web/**]
    image: my-project/web
    ssh:
      host: ${SSH_HOST}
      user: ${SSH_USER}
      key_env: SSH_KEY
    remote:
      compose_file: ~/app/docker-compose.yml
      service: web

infrastructure:
  postgres:
    type: docker-image
    image: postgres:16
    ssh:
      host: ${SSH_HOST}
      user: ${SSH_USER}
      key_env: SSH_KEY
    restart: unless-stopped
Commands

Everything is scriptable.

kb-deploy runBuild and deploy affected targets (git diff against last deployed SHA).
kb-deploy run --allForce a full deploy of every target regardless of git state.
kb-deploy run kb-labs-webDeploy a specific target by name. Useful for hotfixes and targeted redeploys.
kb-deploy statusShow the last deployed SHA per target and whether each is in sync with HEAD.
kb-deploy listList every target configured in .kb/deploy.yaml, with their compose files and hosts.
kb-deploy infra upBring up stateful infra declared under infrastructure. Idempotent: running services are skipped.

All commands support --json for scripts and CI

How it works

The details that matter.

Deploys only what changed

Affected targets are detected via git diff against the last deployed SHA. Nothing untouched rebuilds.

Builds, pushes, pulls, restarts — in order

Build on your machine or in CI, push to the registry, pull on the host, docker compose up. Each step is verified before the next.

Tracks last-deployed SHA per target

Every target remembers what it's currently running. status shows you the drift between HEAD and prod for each service.

Install

One binary. No Kubernetes.

curl -fsSL https://kblabs.ru/kb-deploy/install.sh | sh
kb-deploy — KB Labs