Automatize application deployment via scripts

To automatize application deployment via scripts, you must use the Genero Identity Provider (GIP) GetToken and deploy command line tools.

About this task

This procedure is intended to register applications that have to be executed not on behalf of a user, but as a scripting tool. For example, a batch app that gathers some monitoring data from several services.

You need first to register your scripting application using the ConsoleApp (the New service to service app menu option) in order to generate a CLIENT_ID and SECRET_ID for the application.

  1. Register a new service application in GIP via ConsoleApp, and select deployment and register scope.
    1. Open the ConsoleApp.
    2. Select Applications > New service to service app.
      The Registering a new service to service application form appears.
    3. In the Info section of the form, complete the fields.
      The Name must match the name of the application configuration file.
      The Client ID and Secret ID are generated for you. They will be required later to access that service app.
    4. In the Scopes section of the form, select the register and deployment scopes.
      Note: register and deployment are scopes needed to be able to get tokens and deploy using the console or script.
    5. Click Create.
  2. Use a script to get an access token for the deployment and register service.
    Note: The gettoken tool is located in the $FGLDIR/web_utilities/services/gip/bin/gettoken directory.
    Run this command:

    GetToken client_credentials --idp base_URL_of_idp --savetofile token.json --client_id client_id --secret_id secret_id deployment register

    where:
    • base_URL_of_idp is the base URL of the Genero Identity Provider:
      https://host:port[/gas]/ws/r/services/GeneroIdentityProvider
    • client_id is the Client ID generated in the previous step.
    • secret_id is the Secret ID generated in the previous step.
    This command saves the needed access token in a file named token.json. The token will be valid for a period of 10 minutes. After ten minutes, you will need to query for a new access token.
  3. Use a script to deploy a Genero Archive (.gar) using the generated access token file.
    Note: The DeployGar tool is located in your $FGLDIR/web_utilities/services/gip/bin/deploy directory.
    Run the command:

    DeployGar deploy --tokenfile token.json myGarfile.gar GAS_base_URL

    Where:
    1. The --tokenfile gives the path to a file name where the access token got from the IdP is saved.
    2. The Genero archive file name is specified.
    3. GAS_base_URL is the URL for the Genero Application Server (GAS) where you want to deploy the application.
      https://host:port/gas
    This command deploys the Genero Archive and returns the list of deployed Genero Archive (.gar) files on the specified GAS.