Odin
  • Introduction
  • Why Odin?
  • Key Concepts
    • Environment
      • Environment Type
    • Provisioning
      • Provisioning Config for Component Types
    • Component
      • Available Component Types
      • Component Type reference
        • Optimus Components
          • Aerospike [6.3.0.7-1.0.0]
    • Service
      • Know Your Service Definition
    • Versioning
      • Clearing the Confusion: A Simplified Guide to Artifact, Component, and Service Versions
    • Service Sets
    • Labels
  • Reference
    • CLI reference
  • Onboard Your Service
    • Installation
    • Configure
    • Odin -h
    • Getting Started
    • Create Environment
      • Operations on Environment
    • Service Definition
    • Provisioning Config
    • Deploy Service
    • Release Service
    • Optimus Datastore Operations
      • How to use Optimus Datastore in my service?
      • RDS Operations
      • Aerospike Operations
      • Kafka Operations
    • Operating Service & Components
      • Redeploy
        • In Place Deployment
        • Blue Green Deployment
      • Rolling Restart
      • Adding & removing components
      • Revert a deployment for application component
      • Downscaling a Passive Stack
      • Updating the no. of stacks of application component
    • Dev <> QA iteration
    • Frequently Asked Questions
    • Deploy Concrete Service
    • Undeploy Service
    • Delete Environment
    • Appendix
  • How To
    • Define error threshold for canary deployment
    • Add or Remove a component in an already deployed service
    • Integrate mono-repo(cronjobs) with Odin
    • Deploy crontab with Odin
    • Integrate Data pipeline with Odin
    • Push logs to log central
    • Build artifacts for multi module applications
    • Load test with Odin
    • Track Deployments against Commit Ids
    • Deploy Service on Production - Dream11
    • How and when images are created
    • Check logs for deployed infrastructure - Dream11
    • Onboard Stepfunction as a component
    • Onboard Serverless as a component
    • Login to Kubernetes clusters
  • Release Notes
    • 1.2.0-beta.2 - 11 August, 2022
    • Odin October Release
    • Odin 1.2.0 - Nov 9th 2022
    • Odin February Release
Powered by GitBook
On this page
Export as PDF
  1. How To

Add or Remove a component in an already deployed service

What is it?

If you have already deployed a service in an environment and want to add or remove a component without undeploying the entire service, then odin operate service can help you to do that.

Command Format

You will need version 1.3.1-beta or higher to use this feature

There are two ways to perform either of the operation:

  • By passing a json as a file: You can pass the json file by using the option --file along with the command as shown below:

odin operate service --operation <operationName> --name <serviceName> --env <envName> --file <fileName>
//operationName can be add_component or remove_component
  • By passing the json inline: You can pass the content of the json inline by using the option --options along with the command as shown below:

odin operate service --operation <operationName> --name <serviceName> --env <envName> --options <JsonInline>
//operationName can be add_component or remove_component

To see the list of all available operations, you can use the following command:

odin list operation service

Example: How to add a component?

If you have a new application component called odindemo that you want to add to your existing service Service-A in environment env-1001, you need the service definition & provisioning definition in one single file in json format EXACTLY as shown below:

 //Sample json for adding component
 {
  "component_definition": [
    {
      "type": "application",
      "name": "odindemo",
      "version": "1.0.0",
      "config": {
        "build_type": "java",
        "build_version": "11",
        "artifact_name": "odindemo",
        "artifact_version": "1.0.0"
      }
    }
  ],
  "provisioning_config": [
    {
      "component_name": "odindemo",
      "deployment_type": "aws_ec2",
      "params": {
        "num_instances": 2
      }
    }
  ]
}

Once the above details are ready, you can add the component in any of the two ways as mentioned earlier. The following example shows the addition of a component by passing a json file:

// add component by passing a file
odin operate service --operation add_component --name Service-A --env env-1001 --file file.json

With the help of the above command, odin will go ahead and add the component odindemo to the Service-A within environment env-1001.

Please note, Odin will also deploy a version of the service with following syntax:

EXISTING_VERSION-OPERATE-RANDOMNUMBER. So if your current version is 2.0.0 and you are performing operate on the service for n-th time (including redeploy), your version number will be 2.0.0-opt-random_number

Example : How to remove a component?

Removing a component called odindemo from a service Service-A within an environment env-1001 is very simple. You can pass the component name as an inline input as shown below. The following example shows the removal of the component by passing the json inline:

odin operate service --operation remove_component --name Service-A --env env-1001 --options {\"component_name\":\"odindemo\"}

PreviousDefine error threshold for canary deploymentNextIntegrate mono-repo(cronjobs) with Odin

Last updated 1 year ago

This operation can also be performed by passing a file instead using --options as mentioned in the section.

Command Format