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
- Open the app and go to Settings.
- Under Where it’s built, choose one of your servers. Each shows its memory. Choose the app’s own server to build there again.
- 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
- 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.
- 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).
- It pushes the images to your area of the registry.
- 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:
kubespin api PUT /deployments/$APP_ID/build-server '{"server_id": "'"$BUILD_SERVER_ID"'"}'
API
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.