Working with Command Line Interface (CLI)
Command Line Interface (CLI) tool provides functions for manipulating application and services in Fiorano Enterprise Server (FES). It is a command line interface to FES. Most of the functions that CLI offers can be done with eStudio tool but there can be situations where using a command line interface is convenient or there could be no support for a Graphical User Interface like eStudio.
Functionalities provided by CLI are:
- Multiple Application Launch/Stop: It is possible to launch/stop a set of applications with CLI with a single command similar to services.
Replacement utility: CLI also provides the replacement utility. Provided a properties file (key -value pairs), all the occurrences of keys in a given event process are replaced with corresponding values. This can be used to replace strings in configurations which are not supported by EPLCM.
Example
An error mail subject is hardcoded inside a route transformation as “Error occurred in Testing Environment”. Replace utility can be used to replace “Testing” with “Production” before deploying in production.
Location
The tool is available as a batch/script file (cli.bat/cli.sh) in CLI_HOME ( FIORANO_HOME/esb/tools/cli.)
Prerequisites
FES needs to be running for the scripts to work.
Property Files
Since the interface is command line, options for every target are included in the properties file.
Property | Description |
---|---|
connection.properties | Enterprise server connection configuration. Internally CLI uses either RMI or RTL connection; mention appropriate URL in this file |
nStudio.properties | Options while operating with nStudio applications. Used when CLI uses RTL connection |
eStudio.properties | Options while operating with eStudio applications. Used when CLI uses RMI connection |
svn.properties | SVN credentials and SVN path. Used in functions involving SVN |
All the examples in the below sections will be using RMI connections and hence the property file will be eStudio.properties.
Functions Supported
Launch Application
launchEStudioApps target has to be used to launch Event Processes whose description is as below.
Sample configuration to launch EAI Demo sample is shown below. The user needs to take care of populating required variables mentioned in the readme file. Batch scripts can also be used to provide these values which is discussed at the end of the section.
When the command is executed, the task prompts for the username and password and launches the Event Process(es). The password can also be provided in connection.properties to avoid the prompt or it can also be provided directly in batch files.
Sample screenshot is shown below for launchEStudioApps. During the first run it has prompted for the password and in the second run the password is picked up from connection.properties file (CONNECTION_STRING=tsp_tcp://localhost:1947;admin;passwd).
Stop Application
Same as startEStudioApps, but the following properties have to be provided in eStudio.properties file.
Sample scripts are provided below.
Fiorano Import.bat - Script to import applications
::Variable Declaration
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
set stagingfolder=%~dp0
set appzips="eventprocess1-1.0@EnterpriseServer.zip,[ |mailto: eventprocess2-1.0@EnterpriseServer.zip]eventprocess2-1.0@EnterpriseServer.zip (mailto: eventprocess2-1.0@EnterpriseServer.zip)"
set deploymentEnvironment=Testing
%drive%
cd %cliPath%
cd..
cd esb\Tools\cli
call ant importEStudioApps -D_ESTUDIO_IMPORT_APPLICATION_LIST=%appzips% -D_ESTUDIO_APPLICATION_IMPORT_DIR=%stagingfolder% -D_ESTUDIO_TARGET_APPLICATION_LABEL=%deploymentEnvironment% -D_ESTUDIO_OVER_WRITE_REFERRED_APP=true -D_ESTUDIO_IMPORT_WHOLE_APPLICATION_CHAIN=false
PAUSE
Fiorano Launch.bat -Script to launch Applications
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
set appguids=" EVENTPROCESS1, EVENTPROCESS2, EVENTPROCESS3"
%drive%
cd %cliPath%
cd..
cd esb\Tools\cli
call ant launchEStudioApps -D_ESTUDIO_LAUNCH_APPLICATION_LIST=%appguids%
Pause
Start and stop a component in an Application
From Fiorano 10 (recommended)
FioranoStartComponent.bat
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
SET complist=Feeder1
SET appname=EVENT_PROCESS1
SET appversion=1.0
%drive%
cd %cliPath%
cd..
cd esb\tools\cli
call ant startEStudioServices -D_ESTUDIO_START_SERVICES_LIST=%complist% -D_ESTUDIO_START_SERVICES_OF_APPLICATION=%appname% -D_ESTUDIO_APPLICATION_VERSION=%appversion%
Pause
FioranoStopComponent.bat
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
SET complist=Feeder1
SET appname=EVENT_PROCESS1
SET appversion=1.0
%drive%
cd %cliPath%
cd..
cd esb\tools\cli
call ant stopEStudioServices -D_ESTUDIO_STOP_SERVICES_LIST=%complist% -D_ESTUDIO_STOP_SERVICES_OF_APPLICATION=%appname% -D_ESTUDIO_APPLICATION_VERSION=%appversion%
Pause
Before Fiorano 10
FioranoRTLStartComponent.bat
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
SET complist=Feeder1
SET appname=EVENT_PROCESS1
%drive%
cd %cliPath%
cd..
cd esb\tools\cli
call ant startServices -DSTART_SERVICES_LIST=%complist% -DSTART_SERVICES_OF_APPLICATION=%appname%
Pause
FioranoRTLStopComponent.bat
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
SET complist=Feeder1
SET appname=EVENT_PROCESS1
%drive%
cd %cliPath%
cd..
cd esb\tools\cli
call ant stopServices -DSTOP_SERVICES_LIST=%complist% -DSTOP_SERVICES_OF_APPLICATION%appname%
Pause
Export Application
Exports the application in the FES repository to the local disk as a Zip file. To export, perform the following actions:
- Run FES server necessary for export application process.
Set properties directory to which application zip files are to be exported and the list of applications to be exported in eStudio.properties file:
_ESTUDIO_APPLICATION_EXPORT_DIR=/temp/import_ESTUDIO_EXPORT_APPLICATION_LIST=SIMPLECHAT:1.0,EVENT_PROCESS1:3.0
If the mentioned directory does not exist, the function creates it.
Run command "ant exportEStudioApps" in CLI_HOME. Refer Figure below for sample output.
Sample output for export Applications
Following is the script to export the given application.
FioranoExportApplication.bat
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
SET applist=EVENT_PROCESS1
SET appversion=1.0
SET destinationFolder=/root/import
%drive%
cd %cliPath%
cd..
cd esb\tools\cli
call ant exportEStudioApps -D_ESTUDIO_APPLICATION_EXPORT_DIR=%destinationFolder% -D_ESTUDIO_EXPORT_APPLICATION_LIST=%applist% -D_ESTUDIO_APPLICATION_VERSION=%appversion%
pause
Import Application
Imports FIorano Application from exported application Zip File.
Applications exported from previous versions of Fiorano tools (CLI/eStudio) also can be imported with this function
To import, perform the following actions:
- Run FES server necessary for import application process and have the application zip file to be imported in the local disk.
Set properties, directory from which application zips should be taken and the zip file names in eStudio.properties file:
_ESTUDIO_APPLICATION_IMPORT_DIR=/root/import/
_ESTUDIO_IMPORT_APPLICATION_LIST=SIMPLECHAT_1.0.zip,WORKLIST_MANAGER_1.0.zip
- Run command "ant importEStudioApps" in CLI_HOME. Refer Figure below for sample output.
Sample output for import Applications
Following is the script to import the given application
FioranoImportApplciation.bat
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
SET applist=EVENT_PROCESS1_1.0.zip,EVENT_PROCESS2_1.0.zip
SET destinationFolder=/root/import
::Set true to overwrite the zip file
SET overwriteFile=true
::Set true to overwrite the configurations in the Repository
SET overWriteNamedConfig=true
%drive%
cd %cliPath%
cd..
cd esb\tools\cli
call ant importEStudioApps -D_ESTUDIO_APPLICATION_IMPORT_DIR=%destinationFolder% -D_ESTUDIO_IMPORT_APPLICATION_LIST=%applist% -D_ESTUDIO_OVERWRITE=%overwriteFile% -D_ESTUDIO_OVER_WRITE_NAMED_CONFIG=%overWriteNamedConfig%
pause
Export Application with Libraries
While exporting an application, if the libraries for the application also need to be exported, then use this function.
- Set properties export directory, applications to be exported in eStudio.properties file.
_ESTUDIO_EXPORT_APPLICATION_LIB_LIST=SIMPLECHAT:1.0,EVENT_PROCESS1:3.0_ESTUDIO_APPLICATION_EXPORT_DIR_LIB=/temp/import
- Run command "ant exportEStudioAppsWithLibs" in CLI_HOME. Refer the below figure for sample output.
Sample output for exporting Applications with Libraries
Import Application with Libraries
In this function only those Zip files which are exported from the above function can be imported.
- Set properties import directory and the files to be imported in the directory:
_ESTUDIO_APPLICATION_IMPORT_DIR_LIB=/temp/import_ESTUDIO_IMPORT_APPLICATION_LIB_LIST=SIMPLECHAT_1.0.zip,EVENT_PROCESS1_3.0.zip
- Run command "ant importEStudioAppsWithLibs" in CLI_HOME. Refer Figure below for sample output.
Sample output for importing Applications with Libraries
Import Application from SVN
If the application folder is in SVN repository then this function can be used to import the application directly into the repository.
- Set properties for single application folder name, svn revision (HEAD indicates latest version), a temporary directory to which application is checked-out in eStudio.properties (also set SVN details in svn.properties):
svn.username=usersvn.password=passsvn.repository=/trunk/application_ESTUDIO_SVN_IMPORT_APPLICATION=event_process10-1.0_ESTUDIO_SVN_IMPORT_APPLICATION_REVISION=HEAD_ESTUDIO_APPLICATION_IMPORT_DIR=/temp
- Run command "ant importApplicationFromSVN" in CLI_HOME. Refer the figure below for sample output.
Sample output for importing Applications from SVN
Change Environment of an Application
Once the event process is set up for both environments with respective peer servers (Refer Configure Peer Server to Environment), by changing the Environment of the Event Process, the peer in which all the components are deployed can also be changed. Below script helps to change the Environment from CLI tool.
FioranoChangeEnvironment.bat
::Below scripts changes the environment
@ECHO OFF
SET cliPath=%ANT_HOME%
SET drive=%cliPath:~0,2%
SET applist=" EVENT_PROCESS1"
SET appversion=1.0
SET deploymentEnvironment=Production
%drive%
cd %cliPath%
cd..
cd esb\tools\cli
call ant migrateEventProcessEnvironment
-D_ESTUDIO_MIGRATE_APPLICATION_LIST=%applist%
-D_ESTUDIO_APPLICATION_VERSION=%appversion%
-D_ESTUDIO_TARGET_ENVIRONMENT=%deploymentEnvironment%
-D_ESTUDIO_OVER_WRITE_NAMED_CONFIG=true
-D_ESTUDIO_MIGRATE_COPY_NAMED_CONFIGS=true
pause
Environment Migration
Prerequisite
This operation primarily requires configuring peer server for components, attaching them to the specific environments, as explained below using eStudio tool.
In this example, fpsQA corresponds to Testing environment and fpsProd to Production environment.
Configuring fpsQA peer to Testing Environment
Change the Event Process to required Environment
- Open the required application.
- Go to Properties > Environment Properties.
- Select the required Testing Environment.
Set the required peer.
- Select all the components.
- Go to Properties > Deployment > Nodes
Set the peer name to fpsQA
Multiple peer names can be specified as comma separated values like fpsProd, fpsProd_BackUp
Save the Event Process. Once the Event Process is saved, notice the peer names being reflected in the Environment Properties of the Application as highlighted in the below image.
Configuring fpsProd peer to Production Environment
Configure the peer server with name 'fpsProd' similar to the steps described above.
Availability of Production Peer in QA
It is likely that the Production Peer is not available when logged into QA Enterprise server. However, the name can be provided manually with the environment set as Production.
Procedure Available from Fiorano 10.1
This function imports applications from one FES to another FES (Both Fiorano versions must be same). For example from Testing FES to Production FES.
With Configure Peer Server to Environment is done, execute the below function for all the components to be deployed in fpsProd, since Event Process is moved to Production Environment. If you do not want to change the peer deployment, then ignore Configure Peer Server to Environment and _ESTUDIO_TARGET_APPLICATION_LABEL
in the below function.
In the below example, the given source machine is the same one which is using the CLI function; a third machine can also use this CLI function to migrate the environment.
Location: CLI_HOME/EnvironmentMigration.
- Set properties application to import, components to import, source FES and target FES connection details in file environmentMigration.properties file:
_ESTUDIO_IMPORT_APPLICATION_LIST=EVENT_PROCESS4:1.0,EVENT_PROCESS5:2.0_ESTUDIO_IMPORT_SERVICES_LIST=Feeder:4.0,Display:4.0,JmsIn:5.0SOURCE_RMI_CONNECTION_STRING=rmi://192.168.1.76:2047TARGET_RMI_CONNECTION_STRING=rmi://localhost:2047 _ESTUDIO_TARGET_APPLICATION_LABEL=Production
- Run command ant
EnvironmentMigration
in CLI_HOME/EnvironmetMigration. Refer the figure below for sample output.
Sample output for importing Applications from remote FES
For elaborate descriptions of the targets and the usage of other targets, go through CLI Readme file (CLI_HOME/Readme.txt).
To use these functions in the previous version of Fiorano Refer Environment Migration (Before Fiorano 10.1), follow the steps mentioned below.
Procedure Before Fiorano 10.1
First and last steps can be ignored if you do not want to deploy Event Process into different Peer after moving into Production Enterprise server.
- Refer Configure Peer Server to Environment to configure the Environment to a peer server.
- Export the required application from Testing Enterprise Server.
- Copy the exported zip file to the local disk of the Production Enterprise Server machine.
- Import the application to Production Enterprise Server.
- Refer the Change Environment Of the Event Process From CLI to change the Environment to Production also deploys components into fpsProd
Replace Property
After exporting an Event Process zip file, if any property needs to be changed before using it again, use this function.
- In the above SIMPLECHAT_1.0.zip exported, all the components are deployed in peer 'fps' by default, to deploy that peer to 'mypeer' when imported.
- Create a file with any name, for example, 'replace.properties' with content: <string to be replaced>=<replacement string>. In this example, content is: fps=mypeer
- Set the properties for necessary options such as input zipfile, output zip file and properties in eStudio.properties file:
_ESTUDIO_INPUT_ZIP_FILE=/temp/import/SIMPLECHAT_1.0.zip_ESTUDIO_OUTPUT_ZIP_FILE=/temp/import/SIMPLECHAT_1.0_MYPEER.zip_ESTUDIO_PROPERTIES_FILE_ZIP=/temp/import/replace.properties
- Run command "ant replaceInZip" in CLI_HOME. Refer the below figure for sample output.