Navigation

Deploy Changes with Stitch CLI

Overview

You can deploy changes to your Stitch app with Stitch CLI by importing an application directory with configuration files that define the updated app.

Prerequisites

Procedure

1

Prepare the Application Directory

Export your application to a local application directory. Alternatively, create a new application directory that contains a stitch.json file with your application’s app_id.

{
  "app_id": "<Your Application ID>"
}
2

Add or Update Application Entities

Add sub-directories and configuration files for any new entities you’re importing, or update the values in existing entity files. All entity files must conform to the Application File Schema.

3

Authenticate a MongoDB Atlas User

To import or update a MongoDB Stitch application with stitch-cli, users must authenticate with Atlas using an API Key.

stitch-cli login --api-key=my-api-key --private-api-key=my-private-api-key
4

Run the Import Command

Run the following command in your application directory:

stitch-cli import --strategy=merge

The --strategy flag indicates how you want Stitch to handle configuration files that are missing or duplicated compared to the currently deployed version of your application. For more information, see import strategies.

Note

The import command has several optional arguments. For a complete list, see the import reference documentation.

5

Review and Confirm Import Diff

Before committing the import, stitch-cli will show you a diff of the changes that will be made to your application. Review the diff to ensure that all changes are correct then confirm the import.

After successfully importing your application, Stitch will automatically publish a new deployment of your app and update your local application directory with the new deployment.