# Configuration and use of monqctl

# Installation

Installation is done on the server d-head.

  1. Download the latest MONQ Management Client from our repository:

    curl -LO https://downloads.monq.ru/tools/monqctl/`curl -s https://downloads.monq.ru/tools/monqctl/latest.txt`/linux-x64/monqctl.zip
    
    To download a specific version paste in the command fragment `$(curl -s https://downloads.monq.ru/tools/monqctl/latest.txt)` the needed version number.

    For example, the command to load version v1.1.0 for Linux would be:

    curl -LO https://downloads.monq.ru/tools/monqctl/v1.1.0/linux-x64/monqctl.zip
    
  2. Unzip the downloaded file:

    #debian based distribs
    sudo apt-get install unzip
    #redhat based distribs
    sudo yum install unzip
    
    unzip monqctl.zip
    
  3. Make the monqctl binary executable:

    chmod +x ./monqctl
    
  4. Move binary to a directory defined in the environment variable $PATH:

    sudo mv ./monqctl /usr/local/bin/monqctl
    
  5. Make sure you have the latest version of monqctl installed:

    monqctl --version
    

# Configuration

Getting started with monqctl requires you to configure the program context for use with a particular instance of Monq.

NOTE

When configuring monqctl you will need a token to access MONQ ReleaseHub. It must be obtained by contacting the Monq support.

Let's assume that your Monq system installation is located at the following address: monq.domain.com

  1. Add an instance of Monq to the context configuration.

    monqctl config set instance monq.domain.com --server=http://pl-microservice-registry.api.monq.domain.com
    
  2. Add permissions to access the Monq instance. Tokens are not used in earlier versions of the microservices registry.

    monqctl config set credential monq-user
    
  3. Add access to MONQ ReleaseHub to receive updates. A token for receiving updates, you can get in your personal account or from a manager.

    monqctl config set releasehub monq-release-hub --token=<token>
    
  4. Configure the context that binds the Monq instance, access permissions, and MONQ ReleaseHub to access updates.

    monqctl config set context monq.domain.com --instance=monq.domain.com --credential=monq-user --releasehub=monq-release-hub
    
  5. Set the current context of the Monq instance to work with.

    monqctl config use-context monq.domain.com 
    

# Examples of usage

# Command GET

# Get a list of Monq instances

monqctl config get instances

# Get detailed information on a monq instance

`monqctl config get instances sm-monq-en`

# Get list of users from configuration

`monqctl config get credentials`

# Get detailed information about a user

`monqctl config get credentials smon-user`

# Get list of configured release hubs from configuration

`monqctl config get releasehubs`

# Get detailed information on the release hub

`monqctl config get releasehubs monq-cloud`

# Get a list of configured contexts

`monqctl config get contexts`

# Get detailed information about a context

`monqctl config get contexts smon` 

# Command RENAME

# Rename monq instance in config

`monqctl config rename instance old-instance new-instance`

# Rename monq user alias in configuration

`monqctl config rename credential old-user new-user`

# Rename release hub in the configuration

`monqctl config rename releasehub old-release-hub new-release-hub`

# Rename the monq instance in the config

`monqctl config rename context old-smon new-smon`

# Command DELETE

# Delete configured monq instance from configuration

`monqctl config delete instance sm-monq-en`

# Delete user from configuration

`monqctl config delete credential smon-user`

# Delete release hub from configuration

`monqctl config delete releasehub monq-cloud`

# Delete context from configuration

`monqctl config delete context smon` 

# General commands

# Show full configuration file

`monqctl config view`

# Show current context

`monqctl config current-context`

# Set the current context of the instance to work with

`monqctl config use-context smon`