Skip to content

Datasource Commands

Athiththan Kathirgamasegaran edited this page May 3, 2020 · 3 revisions

Hydrogen-CLI is packed with a set of Datasource related commands to configure and alter WSO2 Servers (precisely API Manager and Identity Server) to work with supported Databases. The server-specific commands are separated with a tag to ignore the complexity and to focus on specific configurations

Help commands are integrated to list all supported sub-commands and flags which are related to each sub-commands. Given below is the help command for the Datasource

$ hydrogen datasource --help
---
Alter datasource configurations of WSO2 Platforms with supported config models and database vendors

USAGE
  $ hydrogen  datasource [COMMAND]

DESCRIPTION
  ...
  Alter datasource configurations of WSO2 Platforms based on your
  requirements

  Use the following command to list all available 'Datasource' related
  commands
  $ hydrogen datasource --help

COMMANDS
  datasource:apim  Alter datasource configurations related WSO2 API
                   Manager products with supported datasource config
                   models
  datasource:is    Alter datasource configurations related WSO2 Identity
                   Server products with supported datasource config models

Datasource APIM Commands

APIM Datasource commands (subjected by datasource:apim) are provided to help and configure datasource configurations of WSO2 API Manager with supported Database vendors (example: Postgres, MySQL, and etc.). The APIM Datasource command contains two boolean flags to configure the WSO2 API Manager servers

  • --replace : Replace flag to replace the existing H2 AM_DB datasource with other Database
  • --setup : Setup flag to define and configure AM_DB, UM_DB, and REG_DB datasources with the selective Database

Only WSO2 API Manager 2.6 is supported at the moment. Will be expanded sooner to support newer versions and older versions of the API Manager family

As an added feature, the Hydrogen CLI is shipped with Docker support to create Docker containers for respective Databases. Following flags are to determine the creation of databases and to containerize

  • --container : Creates a Docker container locally for the selected Database (supported databases and Docker image versions can be found here)
  • --generate : Creates databases and tables related to the Datasource configuration inside the Container

Execute the following --help command to list the supported flags and examples on how-to-use the datasource:apim command

$ hydrogen datasource:apim --help
---
Alter datasource configurations related WSO2 API Manager products with supported datasource config models

USAGE
  $ hydrogen datasource:apim [FLAG] [ARG]

OPTIONS
  -c, --container                              create a docker container for the datasource

  -d, --datasource=mysql|postgre|mssql|oracle  (required) [default: mysql] the type of datasource. refer to the  
                                               supported options below

  -g, --generate                               create database and tables in the docker container

  -r, --replace                                replace AM_DB H2 datasource configurations

  -s, --setup                                  configure AM, UM & REG datasources

  -v, --version=2.6                            (required) [default: 2.6] version of the WSO2 API Manager

DESCRIPTION
  ...
  Alter datasource configurations of WSO2 API Manager server based on your requirement

EXAMPLES
  Replace AM_DB H2 datasource with MySQL
  $ hydrogen datasource:apim --replace -v 2.6 --datasource mysql
  Replace AM_DB H2 datasource with MySQL and create Docker container for the datasource
  $ hydrogen datasource:apim --replace -v 2.6 --datasource mysql --container --generate
  Configure AM, UM & REG datasource with Postgre
  $ hydrogen datasource:apim --setup -v 2.6 --datasource postgre
  Configure AM, UM & REG datasources with Postgre and create Docker container for the datasources
  $ hydrogen datasource:apim --setup -v 2.6 --datasource postgre --container --generate

Datasource IS Commands

IS Datasource commands (subjected by datasource:is) are provided to help and configure the datasource configuration of WSO2 Identity Server with supported Database vendors (example: Postgres, MySQL, and etc.). The IS Datasource command contains the following flags

The IS Datasource command contains only the --replace flag. This will be expanded in the future to support various operations on Datasource configurations

  • --replace : Replace flag to replace the existing H2 Carbon_DB datasource with the selective Database

Only WSO2 Identity Server 5.7 is supported at the moment. Will be expanded sooner to support newer versions and older versions of the API Manager family

As an added feature, the Hydrogen CLI is shipped with Docker support to create Docker containers for respective Databases. Following flags are to determine the creation of databases and to containerize

  • --container : Creates a Docker container locally for the selected Database (supported databases and Docker image versions can be found here)
  • --generate : Creates databases and tables related to the Datasource configuration inside the Container

Execute the following --help command to list the supported flags and examples on how-to-use the datasource:is command

$ hydrogen datasource:is --help
---
Alter datasource configurations related WSO2 Identity Server products with supported datasource config models

USAGE
  $ hydrogen datasource:is [FLAG] [ARG]

OPTIONS
  -c, --container                              create a docker container for the datasource

  -d, --datasource=mysql|postgre|mssql|oracle  (required) [default: mysql] the type of datasource. refer to the  
                                               supported options below

  -g, --generate                               create database and tables in the docker container

  -r, --replace                                replace Carbon H2 datasource configuration

  -v, --version=5.7                            (required) [default: 5.7] version of the WSO2 Identity Server

DESCRIPTION
  ...
  Alter datasource configurations of WSO2 Identity Server based on your requirement

EXAMPLES
  Replace Carbon H2 datasource with MySQL
  $ hydrogen datasource:is --replace -v 5.7 --datasource mysql
  Replace Carbon H2 datasource with Postgre
  $ hydrogen datasource:is --replace -v 5.7 --datasource postgre
  Replace Carbon H2 datasource with Postgre and create Docker container for the datasource
  $ hydrogen datasource:is --replace -v 5.7 --datasource postgre --container --generate
Clone this wiki locally