SkybuDocs

Ferdigheter · Apper

Deploy an app

Publish a web app on Skybu from files, an uploaded folder or a Git repository, and get its address back.

skill://apps/deploy-an-appAgenter leser den med resources/read eller skills_read. Den er skrevet på engelsk, for agentene.

Skybu builds the app in an isolated virtual machine, runs it on its own address under skybu.app, and keeps the previous version serving if the new one fails. You need a project to put the app in.

In short

  1. list_projects to find the project, or create_project to make one.
  2. Ask the user what data the app handles (its data class) and, if list_departments returns any, which department owns it. Never guess these.
  3. Send the files with deploy_files (small apps), or create_upload + deploy_upload (larger ones).
  4. Follow the build with get_deployment until it is live, then give the user the address.

Step 1: the project

{ "name": "list_projects", "arguments": {} }

Each project lists its apps, databases and file storage with their ids. If the user has no suitable project, create one:

{ "name": "create_project", "arguments": { "name": "kundeportal" } }

Step 2: what the app is for

A new app needs a dataClass, one of:

ValueWhen
noneNo data about people or the business: a demo, a public page.
internalBusiness data that is not about individuals.
personalNames, emails, phone numbers or other data about people.
sensitiveHealth, religion, national identity numbers and other special categories.

Ask the user. If you think the app touches personal data, say so; never pick a lower class to get past a question. If the organisation has departments, department is required too. owner defaults to the signed-in user.

Step 3: send the files

The app's name is 2–31 lowercase letters, digits and hyphens. It becomes part of the address, https://<app>.<org>.skybu.app.

{
  "name": "deploy_files",
  "arguments": {
    "projectId": "<project id>",
    "name": "kundeportal",
    "dataClass": "internal",
    "files": [
      { "path": "package.json", "content": "{ \"name\": \"kundeportal\", \"scripts\": { \"start\": \"node server.js\" } }" },
      { "path": "server.js", "content": "…" },
      { "path": "public/logo.png", "content": "<base64>", "encoding": "base64" }
    ]
  }
}
  • Send every file the build needs: source, package.json and its lockfile, requirements.txt, and a Dockerfile if the app has one. Leave out node_modules, build output and .env files.
  • Without a Dockerfile, Skybu detects the language and framework and builds it (Railpack). With one, it uses it.
  • The app must listen on the port in the PORT environment variable.
  • Binary files go as base64 with "encoding": "base64".

For more than a few MB, upload a .tar.gz of the folder instead:

{ "name": "create_upload", "arguments": { "projectId": "<project id>", "name": "kundeportal" } }

PUT the archive to the returned address (Content-Type: application/gzip, at most 50 MB, within an hour), then:

{ "name": "deploy_upload", "arguments": { "uploadId": "<upload id>", "dataClass": "internal" } }

To deploy from GitHub or GitLab instead, so every push deploys, use create_app_from_git (see skill://apps/deploy-from-git).

Step 4: follow the build

Both deploy tools return a deployment. Poll it:

{ "name": "get_deployment", "arguments": { "deploymentId": "<deployment id>" } }
StatusMeaning
queued, building, deployingStill working. Check again in a few seconds.
awaiting_approvalBuilt, and the organisation requires an owner to approve production changes. Tell the user; agents cannot approve.
liveServing. Give the user the address.
failedThe build or the start failed. The previous version keeps serving. See skill://apps/fix-a-failed-deploy.

The log is live while the build runs, so you can show the user progress.

Things to know

  • Deploying again to the same name makes a new version of the same app. The old one serves until the new one is up.
  • rollback_app returns to an earlier version in a couple of seconds.
  • Variables the app needs (API keys, settings) are set with set_env_vars before or after the first deploy (skill://apps/environment-variables).
  • The project's database address is already in DATABASE_URL when the project has a database (skill://databases/use-the-database).