Remote deploy

Remote deploy

Run one service's hooks on another host over SSH, from the same muster.json.

Before you start

  • SSH access to the host (key, agent or password).
  • The project checked out on the host if hooks or git pull need its files.
  • For many servers, or servers you can't reach over SSH, use a fleet instead.

Point a service at a host

Terminal
muster setup --remote [email protected]:2222:/opt/app

This writes the service's remote block:

muster.json
"api": {
  "remote": {
    "enabled": true,
    "host": "prod.example.com",
    "user": "deploy",
    "port": 2222,
    "identity_file": "~/.ssh/deploy_key",
    "project_dir": "/opt/app"
  }
}

Every key is listed in the muster.json reference.

How it runs

muster pipes each hook to the host with ssh user@host "bash -s", exporting the service context, Kubernetes variables and credentials on the remote side. Hooks run from project_dir. Health checks run there too.

SSH passwords are collected once, before the first service deploys, so a multi-service deploy doesn't keep prompting. Host keys are checked: accept-new on your machine, strict on CI (MUSTER_SSH_HOSTKEY_CHECK overrides).

Pull before deploying

Terminal
muster setup --git-pull api=origin:main

muster runs git pull origin main before the deploy hook, on the host for remote services. If the pull fails you can retry, skip the pull, or abort.