Skip to content

Using Odin

Harshit Sharma edited this page Feb 23, 2022 · 14 revisions

Installation

In order to use Odin and to work on your environments, you first need to install Odin. For that,

export HOMEBREW_GITHUB_API_TOKEN=<your github access token>
brew install dream11/tools/odin

Or, if you need a development setup and want to add/fix the features,

  1. Download and run the Go 1.17 installer.
  2. Verify Go: go version
  3. Clone this repo: git clone https://github.com/dream11/odin
  4. Enter the repository: cd odin
  5. Install dependencies: go mod download
  6. Verify the cli: go run main.go --version

Post this,

  1. Use make install to compile, package and install the code as a running executable on your system.

Commands

Grammar

Each command is formed of 2 resources, a verb and a resource, which are further assisted by a few command-specific and some generic options.

odin [--version] [--help] <command> [<options>]

command → verb + resource

Verb

A verb simply denotes any action that can be performed.

Supported verbs -

  1. Create - To create/register a new resource record.
  2. Update - To update an existing resource record.
  3. Delete - To delete/deregister an existing resource record.
  4. Describe - To describe an existing resource record.
  5. Label - To label/mark an existing resource record.
  6. List - To list a number of existing resource records.
  7. Status - To fetch the current status of a resource.
  8. Logs - To fetch the logs of a resource execution.
  9. Deploy - To deploy the resource record to form a functional unit.
  10. Undeploy - To undeploy the resource record to form a functional unit.
  11. Destroy - To destroy the deployed functional unit of a resource.
  12. GetHistory - To get a changelog of resources.
  13. DescribeHistory - To describe a changelog of resources.

Resource

A resource is an entity on which the verbs are performed.

Component-type

This is the type of component, that can be attached to a service.

Verbs & Options -

  1. Verb: list, Options: --name & --version, Example:

    odin list component-type --name=rds --version=1.0.0
  2. Verb: describe, Options: --name & --version, Example:

    odin describe component-type --name=rds --version=1.0.0

A component is the smallest individual entity in the framework, which represents an actual deployable unit, like - databases and application resources

Service

This is a logical boundary around stateless and stateful components that together form a functional entity capable to handle some business logic. Example: fantasy-tour service comprises fantasy-tour & fantasy-tour-admin applications and aerospike & redis datastores.

Verbs & Options -

  1. Verb: create, Options: --file, Example:

    odin create service --file=fantasy-tour.yaml
  2. Verb: delete, Options: --name, --version & --component, Example:

    odin delete service --name=fantasy-tour --version=1.0.0
  3. Verb: describe, Options: --name, --version & --component, Example:

    odin describe service --name=fantasy-tour --version=1.0.0 --component=aerospike
  4. Verb: label, Options: --name, --version & --mature, Example:

    odin label service --name=fantasy-tour --version=1.0.0 --mature
  5. Verb: list, Options: --team, --version, --mature & --detailed, Example:

    odin list service --team=coreinfra --version=1.0.0 --mature --detailed
  6. Verb: deploy, Options: --name, --version, --force, --rebuild & --env, Example:

    odin deploy service --name=fantasy-tour --version=1.0.0 --env=demo-1234 --force --rebuild
  7. Verb: undeploy, Options: --name & --env, Example:

    odin undeploy service --name=fantasy-tour --env=demo-1234
  8. Verb: status, Options: --name & --version, Example:

    odin status service --name=fantasy-tour --version=1.0.0

Env

This is a set of infrastructural components that are required to deploy the components of a service.

Verbs & Options -

  1. Verb: create, Options: --team, --purpose, --env-type & --account, Example:

    odin create env --team=coreinfra --purpose=demo --env-type=kube
  2. Verb: update, Options: --name & --file, Example:

    odin update env --name=kube-1234 --file=config.json
  3. Verb: status, Options: --name & --service, Example:

    odin status env --name=demo-1234 --service=fantasy-tour
  4. Verb: delete, Options: --name, Example:

    odin delete env --name=kube-1234
  5. Verb: describe, Options: --name, --service & --component, Example:

    odin describe env --name=kube-1234 --service --component
  6. Verb: list, Options: --name, --team, --env-type & --account, Example:

    odin list env --name=demo-1234 --team=coreinfra --env-type=stag --account=revenue
  7. Verb: get-history, Options: --name, Example:

    odin get-history env --name=demo-1234
  8. Verb: describe-history, Options: --name & --id, Example:

    odin describe-history --name=demo-1234 --id=1

Configure

This is a unique resource that itself is a verb but doesn't apply to any resource and acts as a fully-fledged command.

Verbs & Options -

  1. Verb: configure, Options: --refresh & --hard, Example:

    odin configure --refresh --hard
Clone this wiki locally