Developer Documentation

Update a Deployment

A deployment defines which server configuration runs with how many instances at a specific location. You can update a deployment to change the number of instances or the configuration that is used thus updating all running server instances with just one command.

This is also how you start and stop servers - you don’t babysit individual servers, you update the deployment and the system takes care of the rest.

For example, if you have a deployment with 10 instances and you update the configuration, all 10 instances will be restarted with the new configuration. Reducing the number of instances to 8 will stop 2 instances and reduce the number of running servers to 8. Increasing the number of instances to 12 will start 4 new instances with the selected configuration.

Info

You have two options to update servers: In either case you need to create a new image of your updated server binaries. Then you can either create a new configuration with the new image and update the deployment to use the new configuration or you can update the configuration directly with the new image. The latter will update all deployments that use this configuration.

Usage

odin fleet deployments update [--name=IMAGE_NAME] [--num-instances=NUM_INSTANCES] [--deployment-id=DEPLOYMENT_ID] [--payload=JSON_PAYLOAD] [--dry-run]

Flags

The command will only update the fields that are provided. If you want to update multiple fields, you can provide them all in one command. You can also provide a JSON payload to update the configuration using the usual --payload flag. This command also support the --dry-run flag to see the JSON payload that would be sent to the API without actually updating the configuration.

  • --name=<string>:
    The name of the configuration.
  • --num-instances=<number>:
    The number of instances that should be running with this configuration.
  • --deployment-id=<number>:
    The ID of the deployment that should be updated. Omitd if you want to choose deployment interactively.
  • --payload=<string>:
    An optional flag that allows you to specify a JSON payload to update the deployment. This is useful for non-interactive mode and if you want to update a deployment with a specific configuration.
  • --dry-run:
    An optional flag that shows the JSON payload that would be sent to the API without actually updating the deployment. You can use that payload to update the deployment with the --payload flag.

Examples

Increase the number of deployments by 4:

DEPLOYMENT_ID=123456
NUM_INSTANCES=$(odin fleet deployments get --deployment-id=$DEPLOYMENT_ID --format="value(numInstances)")
NUM_INSTANCES=$((NUM_INSTANCES + 4))
odin fleet deployments update --deployment-id=123456 --num-instances=$NUM_INSTANCES --force

Global Flags

The following flags can be used with any ODIN CLI command:

  • --api-key=<string>
    The API key to use for authentication. If omitted, the CLI will use the api-key stored in the configuration file on your system. Use odin login to store the API key for subsequent commands.

  • --app-id=<string>
    The ID of the app to use for the command. If omitted, the CLI will use the currently selected app. Use odin apps select to select an app interactively.

  • --format=<string>
    The output format to use for the command. Supported formats are json, value, flattened and table. If omitted, the CLI will use the default format specified in the configuration file. Learn more about output formatting.

  • --force
    Forces the command to execute without prompting for confirmation. Use with caution.

  • --quiet
    Suppresses all informational output except for errors. Useful for scripting and automation.