Deploy an app

After testing locally, use mistral deploy to build the pushed commit and deploy it to Studio. The command uses your mistral login session. Without one, it uses an API key, for example in CI.

i
Information

mistral deploy appears after you sign in with mistral login.

Before deploying

Before deploying

  • Commit and push the app to a GitHub repository, as a Git remote named origin. Use a repository in your own account or organization.
  • Connect GitHub to your Mistral account, and install the Mistral GitHub app on the repository. The platform clones the commit through this app, public repositories included.
  • Keep the working tree clean, including untracked files.
  • Commit the Dockerfiles generated for your modules. The CLI checks that they exist in the commit it deploys.
  • Plan the production secrets. The CLI doesn't upload local environment files: you set the values in Studio, as described in Secrets and runtime configuration.
  • Check that your organization's plan includes Apps. See Plan limits.

mistral deploy checks the GitHub connection and the app installation before it creates anything. On a terminal, it offers to open the GitHub page that sets them up, and continues after you finish there. Elsewhere, it stops and prints the page's link.

If the commit was pushed from another machine, run git fetch origin before deploying. For code that isn't on GitHub, see Deploy from disk.

First deployment

First deployment

mistral login
mistral deploy

Select the organization and workspace when prompted. You can also specify them by ID or name:

mistral deploy --organization "My organization" --workspace "My workspace"

The CLI prints the destination before starting work, creates the app and its modules, builds the pushed commit, and waits for the deployment to finish. It then prints the app URL and a link to the app in Studio.

Save the deployment target

Save the deployment target

The first deployment writes the app binding to mistral.json. The CLI offers to commit and push this file. If you decline, save it before your next deployment:

git add mistral.json
git commit -m "chore: save the app deployment target"
git push

Other clones use the saved binding to update the same app.

Warning

Before you delete or edit the binding to switch destinations, check which app it points to. Without a binding, the next deployment creates a new app.

Deploy a change

Deploy a change

Commit and push your changes, then run mistral deploy again. The CLI reuses the saved binding. Check the reported destination before continuing.

Deploy from disk

Deploy from disk

To deploy code that isn't on GitHub, upload the app directory instead of a pushed commit:

mistral deploy --from-disk

Nothing needs to be committed or pushed, and the CLI skips the GitHub checks. Inside a Git repository, files that Git ignores are left out. The CLI never uploads files whose names start with .env, other than .env.example. Each upload can be at most 256 MiB.

A first deployment from disk saves the binding in mistral.json but doesn't commit it. Commit it yourself so other clones deploy to the same app.

Deploy with an API key

Deploy with an API key

Without a mistral login session, mistral deploy uses the API key in MISTRAL_API_KEY, or one saved with mistral login --api-key. A key belongs to one workspace, so the app deploys there. When you're signed in, the CLI uses your session even if MISTRAL_API_KEY is set.

To deploy from CI, see Deploy with an API key for the key the job needs. mistral apps publish and mistral apps unpublish don't accept an API key, so run them after mistral login.

Secrets and runtime configuration

Secrets and runtime configuration

Keep credentials out of Git. Before using the app, set the values required by your selected capabilities, such as MISTRAL_API_KEY, in the Secrets tab of the app in Studio, on each module that needs them. Use Secrets Manager for shared credentials, and review the managed Apps deployment guidance.

After the app works at its deployed URL, see Publish to Vibe.

Read the logs

Read the logs

From the app directory, pass a module name from mistral.json to read its logs. Leave the name out to read the gateway, which handles sign-in and routing:

mistral apps logs api
mistral apps logs api --build
mistral apps logs api -f

The first command prints the module's recent runtime logs, --build reads its latest build, and -f keeps printing new lines until you press Ctrl-C. When a module fails to deploy, mistral deploy prints the last lines of its logs and the mistral apps logs command that reads the rest. For --since, --lines, and --json, see the CLI reference.

Delete an app

Delete an app

Warning

Deleting an app can't be undone. Its modules and databases are deleted with it, so copy any data you want to keep first.

From the app directory, delete the app that mistral.json points to:

mistral apps delete

To delete another app, pass its name or ID. On a terminal, the CLI asks you to type the app's name to confirm. For --yes, --organization, and --workspace, see the CLI reference.