Article · 3 min read · Getting started

kubespin: Build an app on another server

A small server can run an app it hasn’t the memory to build. kubespin can build the app on a bigger server of yours instead: the images go through your registry, and the app’s own server pulls them and starts them without building.

A small server can run an app it hasn’t the memory to build. kubespin can build the app on a bigger server of yours instead: the images go through your registry, and the app’s own server pulls them and starts them without building.

Small servers: done for you

When an app that builds goes to a server with less than 2 GB of memory, kubespin builds it on your largest active server with at least 2 GB, without being asked. The deploy log says so, for example: “ionos-mini has 0.8 GB of memory, too little to build this app; building it on ionos and pulling the images here.”

This needs your area of kubespin’s registry (kubespin: The local container registry). Without it, or without another server big enough, the app builds on its own server as before.

Choose the server yourself

  1. Open the app and go to Settings.
  2. Under Where it’s built, choose one of your servers. Each shows its memory. Choose the app’s own server to build there again.
  3. Choose Save. The next deploy builds on the server you chose.

The server must be yours and active. Your choice replaces the automatic one.

What happens on a deploy

  1. kubespin gets the same commit on the build server. For a private repository, the app’s deploy key is copied there for the fetch, and removed again afterwards.
  2. It builds the images there. The build runs on the server as a process of its own, so it carries on if kubespin restarts (kubespin: Runs, logs and kubespin restarts).
  3. It pushes the images to your area of the registry.
  4. The app’s own server pulls them by digest and starts them. Your compose files stay as they are: kubespin adds an overlay that swaps each build: for the built image.

On the app’s server, Runs here on its Overview says where each app is built.

Command line

The kubespin command has no command for this yet. Call the API with kubespin api, or from a script with an API token:

bash
kubespin api PUT /deployments/$APP_ID/build-server '{"server_id": "'"$BUILD_SERVER_ID"'"}'

API

bash
curl -s -X PUT https://kubespin.io/api/v1/deployments/$APP_ID/build-server \
  -H "Authorization: Bearer $KUBESPIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"server_id": "'"$BUILD_SERVER_ID"'"}'

It returns build_server_id and build_server, the server’s name. Send {"server_id": null} to build on the app’s own server again. A server that isn’t yours, or isn’t active, is refused with the reason.

[!permissions] Permissions Area: Deployments

Step Needs Default roles
See where an app is built View Admin, Developer, Operator, Viewer
Choose where it’s built Manage Admin, Developer

API token: Read and change.