Is there a way to specify a deployment region (or global deployment) while deploying from Realm CLI?
I have an app that is deployed to a DEV project, and the deployment region is selected as Single Deployment/region automatically.
When I deploy the same app to a different TEST project, the Global Deployment option is selected.
Hoping to control this option during deployment and not have to manually change later.
In this example, the --deployment-model flag is set to “GLOBAL” to indicate a global deployment, and the --deployment-target flag is set to “us-west-2” to specify the deployment region.
You can replace “my-project” with your actual project ID.
Note: The available deployment regions may depend on the selected deployment model and the location of your Realm app. You can use the realm-cli deployment list command to see the available deployment regions for your app.
Replace my-project with your actual project ID, and us-west-2 with the desired region.
To list the available deployment targets for your app, you can use the realm-cli app describe command with the --project-id flag. For example:
realm-cli app describe --project-id=my-project
Replace my-project with your actual project ID. This command will output information about your app, including the available deployment targets.
To deploy your app using Realm CLI, you can use the realm-cli deploy command. Make sure you have the latest version of the CLI installed by running npm install -g mongodb-realm-cli. For example:
realm-cli deploy --project-id=my-project
Replace my-project with your actual project ID.
If you are using an older version of the Realm CLI and the deployment command is not available, you can use the realm-cli atlas env list command to list the available environments (which correspond to deployment regions) for your app. For example:
realm-cli atlas env list --project-id=my-project
Replace my-project with your actual project ID.
I hope this information helps to resolve the issue.
None of the commands/arguments you listed seem to work with the latest realm-cli version.
When I run realm-cli -h, the following commands are listed:
Available Commands:
whoami Display information about the current user
login Log the CLI into Realm using a MongoDB Cloud API Key
logout Log the CLI out of Realm
push Imports and deploys changes from your local directory to your Realm app (alias: import)
pull Exports the latest version of your Realm app into your local directory (alias: export)
apps Manage the Realm apps associated with the current user (alias: app)
users Manage the Users of your Realm app (alias: user)
secrets Manage the Secrets of your Realm app (alias: secret)
logs Interact with the Logs of your Realm app (alias: log)
function Interact with the Functions of your Realm app (alias: functions)
schema Manage the Schemas of your Realm app (alias: schemas)
accessList Manage the allowed IP addresses and CIDR blocks of your Realm app (aliases: accesslist, access-list)
help Help about any command
@Sudarshan_Muralidhar is right - I had a similar case where I wanted to use a GCP region that was not part of the old cli commands (they seem to be hardcoded).
I’ve found this out as well @Sven_Hergenhahn I kind of wish the docs would update the cli commands for more regions etc, as you’re also right, they do seem to be hard coded.
I had an answer back then from the developers of the cli that a new version is due and will contain more regions - so it seems the are still hardcoded, but more will be added…
I’m actually kind of surprised they don’t just make it relative and run a route service to direct to the region specified, than it would be agnostic and just send and error back if it doesn’t exist or the wrong place address/name used. (This is how a lot of services that are cloud based do this to route between regions etc)
Thank you for raising your concerns and discussing this. Please note, the deployment region and other app settings can be changed by editing the config.json file as suggested above by @Sudarshan_Muralidhar.
When a new app is deployed via Cli, it defaults to global deployment while it picks the existing region, if changes are made via cli to an existing app. This is termed as ‘default’ behavior instead of hard-coded as it does allow changing regions via the config.json file.
Please note, there is an ongoing project on cli that will allow you to specify region and deployment model instead of default values.