Article · 3 min read · Getting started

kubespin: Runs, logs and kubespin restarts

Every deploy, update and restart of an app is a run, with its own log. A run carries on if kubespin itself restarts, and its output appears as it happens.

Every deploy, update and restart of an app is a run, with its own log. A run carries on if kubespin itself restarts, and its output appears as it happens.

Reading a log

Every log in kubespin looks the same: deploys, updates and restarts, onboarding, new Kubernetes clusters and WordPress sites, the optimiser, OS updates, prunes and container logs.

  • Steps on the left. For a deploy they’re Connect, Get the code, Build and Start. Choose one to see only its lines.
  • The log on the right, sized to the window.
  • Follow keeps the end of the log in view. It stops when you scroll up, and starts again when you reach the end.
  • Copy and Full screen.

Container logs also keep their line count and Live, which fetches new lines every 15 seconds.

In kubespin

  1. Open the app and go to Logs. Each run is listed with what started it, its commits and how it ended.
  2. Choose a run to read its log. A run that’s still going shows the build’s output line by line.

Runs on one app go one at a time. Asking for another while one is running queues it; asking for the same again joins the one waiting.

When kubespin restarts

kubespin restarts with each release. A deploy doesn’t depend on it:

  • The commands run on the server as a process of their own, writing to a log file there. kubespin follows the file every few seconds.
  • After a restart, kubespin picks the run up where it had got to, with nothing lost or repeated, and finishes it. The run says kubespin restarted during it.
  • If the server stops answering for a while, for example because a build uses all of a small server’s memory, kubespin says so and waits up to 15 minutes, reconnecting, then carries on following the build.
  • A command that dies on the server, through a reboot or the system killing it for lack of memory, is reported as stopped, not left waiting.
  • A run that can’t be picked up again is marked failed, and so is its app, so nothing shows “deploying” for ever.

A build that keeps running out of memory is better done elsewhere: see kubespin: Build an app on another server.

Command line

The kubespin command has no run commands yet. Use kubespin api, or a script with an API token:

bash
kubespin api POST /deployments/$APP_ID/actions/update
kubespin api GET /deployments/$APP_ID/runs

API

bash
curl -s -X POST https://kubespin.io/api/v1/deployments/$APP_ID/actions/update \
  -H "Authorization: Bearer $KUBESPIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

It answers 202 Accepted at once with the run and joined (true when it joined a run already waiting). The actions are update, force_update (send {"confirm": true}), restart and apply.

  • GET /api/v1/deployments/{id}/runs lists the latest runs.
  • GET /api/v1/deployments/{id}/runs/{run id} returns one run with its logs: each line’s message, level, stage and at.

[!permissions] Permissions Area: Deployments

Step Needs Default roles
See runs and their logs View Admin, Developer, Operator, Viewer
Update, force update, restart Operate Admin, Developer, Operator

API token: Read only to look; Read and change to start a run.