View Markdown

Sandbox to deployment

A complete first workflow: create an environment, write an application, inspect it, and publish a version with a clear rollback path.

Before you start

For a real cloud workflow, install your provider’s CLI or SDK and configure an account with the permissions you need. The following examples describe the MIOSA workflow; they do not execute a production request from this page.

For a working local request, use the API explorer. For a visual simulation, use the sandbox lab.

1. Create a sandbox

Name the workspace explicitly. Treat the returned resource identifier as the identity of your sandbox and use it for subsequent operations.

import { Miosa } from "@miosa/sdk";

const miosa = new Miosa({ apiKey: "YOUR_API_KEY" });
const sandbox = await miosa.sandboxes.create({
  workspaceSlug: "default",
  templateId: "miosa-sandbox",
});
console.log(sandbox.id);

2. Run your application

Install dependencies inside the sandbox, then start the application on a known port. Read its output before assuming it is ready.

const result = await sandbox.exec("node --version");
console.log(result.stdout);

await sandbox.exec("npm install");

3. Inspect the preview

A successful command is one piece of evidence. Also open the application, exercise its main task, and inspect its logs. Check the candidate that you intend to publish rather than an unrelated development instance.

The verification boundary

4. Publish a version

Publishing should identify an immutable candidate. Verify that candidate, then promote that same identifier. Save the returned deployment address rather than constructing a URL from a guessed naming pattern.

miosa app preview ./app --json
miosa app verify <release-id> ./app --json
miosa app promote <release-id> ./app --yes --json

5. Keep a way back

Record the active release and the previous known good version. When a release fails, inspect the exact failed operation. A retry, recovery and rollback solve different problems; choose the one that matches the state you can observe.

Read deployments and rollback next, or put the sequence into practice in Shipping.

Make the example yours

Change these values to see a parameterized example. The selected language stays synchronized with the rest of the tutorial.

Make the example yours
const sandbox = await miosa.sandboxes.create({
  workspaceSlug: "my-workspace",
  name: "hello-world",
  templateId: "miosa-sandbox",
});

These fields update the example. They do not send a request.