Deploy through CLI

◷ Reading Time: 7 minutes

Deploy command will run the process of deploying a Package File (.frdp) to a Cloud or On-prem infrastructure to host a FlexRule model as a REST API service end point.

AWS Lambda

To deploy a package on AWS cloud; you can use the command syntax below.

fr.exe deploy --to AWS --package <value> --license <value> --includeAssemblies <value> --runtime <value> --function <value> --accesskeyid <value> --secret <value> --region <value> --bucket <value>
  • to: This is the target environment to deploy the package to. It can be either of AWS, AZURE, GOOGLE or FlexRule Server.
  • package: Path to the .frdp package file to be deployed
  • license: Path to the FlexRule Runtime license file. It is generally named as flexrule.license.lic.
  • runtime: This specifies the location where FlexRule Runtime is installed.
  • includeAssemblies: The can be either True or False. This specifies whether or not to copy all the assemblies in the bin folder of the project to the destination.
  • function: The AWS Lambda Function Name.
  • accesskeyid: Access Key Id of AWS account
  • secret: Secret for Access Key Id of AWS account
  • region: Datacenter where the deployment is going to happen
  • bucket: The bucket name that your account has access to deploy the decision models.

You can also use help function as a guide.

fr.exe --help deploy

Example

fr.exe deploy --to AWS --package C:\Repo\Output\calculator.frdp --license "C:\Users\<user-name>\Documents\.flexrule\flexrule.license.lic" --includeAssemblies true --runtime "C:\Users\<user-name>\Documents\.flexrule\9.0.177" --function CalcFunction --accesskeyid YourAwsId --secret YourAwsSecret --region us-west-1 --bucket testbucket

EC2 Machine

If you are using EC2 machine, you can use --environment instead of using --accesskeyid , --secret and --region . When --environment is set to EC2 then all the --accesskeyid, --secret and --region is reading from the EC2 machine’s environment variables.

fr.exe deploy --to AWS --package <value> --license <value> 
--includeAssemblies <value> --runtime <value> --function <value> --environment EC2 --bucket <value>

Example

fr.exe deploy --to AWS --package C:\Repo\Output\calculator.frdp --license "C:\Users\<user-name>\Documents\.flexrule\flexrule.license.lic" --includeAssemblies true --runtime "C:\Users\<user-name>\Documents\.flexrule\9.0.177" --function CalcFunction 
--environment EC2 --bucket testbucket

Before running this CLI command you need to configure environment variables for the default user in the EC2 machine.

To set environment variable you can use following commands.

set AWS_ACCESS_KEY_ID=xxx
set AWS_SECRET_ACCESS_KEY=xxx
set AWS_DEFAULT_REGION=xxx



To confirm whether you have set the environment variable or not, use following command.
echo %AWS_ACCESS_KEY_ID%

To learn more about setting environment variable click here.

Azure Function

To deploy a package on Azure cloud; you can use the command syntax below.

fr.exe deploy --to Azure --package <value> --license <value> --includeAssemblies <value> --runtime <value> --function <value> --subscriptionid <value> --tenantid <value> --clientid <value> --secret <value> --region <value> --resourcegroup <value> --plan <value>
  • to: This is the target environment to deploy the package to. It can be either of AWS, AZURE, GOOGLE or FlexRule Server.
  • package: Path to the .frdp package file to be deployed.
  • license: Path to the FlexRule Runtime license file. It is generally named as flexrule.license.lic.
  • runtime: This specifies the location where FlexRule Runtime is installed.
  • includeassemblies: The <value> can be either True or False. This specifies whether or not to copy all the assemblies in the bin folder of the project to the destination.
  • function: The Azure Function Name.
  • subscriptionid: Azure Subscription Id
  • tenantid: Azure Tenant Id
  • clientid: Azure Client Id
  • secret: Azure client secret for authentication
  • region: Datacenter where the deployment is going to happen
  • resourcegroup: Azure resource Group to holds all the resources related to the deployment
  • plan: Azure service plan. Available options are SharedD1, BasicB1, BasicB2, BasicB3, StandardS1, StandardS2, StandardS3, PremiumP1, PremiumP2, PremiumP3, PremiumP1v2, PremiumP2v2, PremiumP3v2, PremiumP1v3, PremiumP2v3, PremiumP3v3
    More information is on the URL

Example

fr.exe deploy --to Azure --package C:\Repo\Output\calculator.frdp --license "C:\Users\<user-name>\Documents\.flexrule\flexrule.license.lic" --includeAssemblies true --runtime "C:\Users\<user-name>\Documents\.flexrule\9.0.177" --function CalcFunction --subscriptionid xxxx --tenantid xxxx  --clientid xxxx --secret xxxx --region "East US" --resourcegroup resourcegroup --plan SharedD1

FlexRule Server

To deploy a package on the FlexRule server, you can use the command syntax below:

fr.exe deploy --to FRS --package <value> --license <value> --includeassemblies <value> --runtime <value> --serverurl <value> --username <value> --password <value> --apps <value> --grantapp <value> --userownership <value> --enablepackage <value> 
  • to: This is the target environment to deploy the package to. It can be either of AWS, AZURE, GOOGLE or FlexRule Server.
  • package: Path to the .frdp package file to be deployed
  • license: Path to the FlexRule Runtime license file. It is generally named as flexrule.license.lic.
  • runtime: This specifies the location where FlexRule Runtime is installed.
  • includeassemblies: The <value> can be either True or False. This specifies whether or not to copy all the assemblies in the bin folder of the project to the destination.
  • serverurl: FlexRule Server API end point address.
  • apps: List of application accounts (separated by ; or ,) that will have access to the service. Application accounts secures the service calls using Role-Based Access Control.
  • grantapp: grant the nominated app ownership for execution
  • userownership: Grants the package ownership to the provided account with –username.
  • enablepackage: By specifying the as True or False indicates whether or not the Package is enabled after deployment is finished.
  • username: Username that has the permission to create and deploy service.
  • password: Password of the username.

Example

fr.exe deploy --to FRS --package C:\Repo\Output\calculator.frdp --license "C:\Users\<user-name>\Documents\.flexrule\flexrule.license.lic" --includeassemblies true --runtime "C:\Users\<user-name>\Documents\.flexrule\9.0.201" --serverurl "http://localhost:9000" --username "XXX" --password "XXX" --apps "app1" --grantapp true --userownership true --enablepackage true 
Updated on December 8, 2022

Was this article helpful?

Related Articles