Deploy Command

◷ Reading Time: 10 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 endpoint.

You can also use help function as a guide.

fr.exe --help deploy

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. In this instance use AWS.
  • package: Path to the .frdp package file to be deployed
  • license: Path to the FlexRule Runtime license file. It is generally named flexrule.license.lic.
  • runtime: This specifies the location where FlexRule Runtime is installed.
  • includeAssemblies: This can be either True or False. This determines whether or not to copy all the assemblies in the bin folder of the project to the destination.
  • function: (Optional) AWS Lambda function name that you want to deploy.
  • 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.

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 calfunction --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 calfunction --environment EC2 --bucket testbucket
Configure Environment Variables for EC2 machine

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 inside the CLI installation path.

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 variables click here.

Provide Security Code

When you deploy into AWS, you can use custom-generated codes at the end of the Service URL and Execute URL instead of autogenerated code. This is an optional feature.

To use this , you need to have these parameters inside the deploy command.

--metadatacode <value>
--executioncode <value>

You can use your own value for these parameters or else you can generate keys using Security key generator in FlexRule CLI.

metadatacode : for service URI

executioncode : for execution URI

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.267" --accesskeyid YourAwsId --secret YourAwsSecret --region us-west-1 
--bucket testbucket 
--metadatacode "Mbblx2NaLzNmdGmvghqYTFtDmLGlSeAzlDUsrdJRgY2PZRadZX0mqfXFM3FKvugs0xiwcVc4GTE32RQ4pHxO/Q=="  
--executioncode "XBJCwm0xLYwqBVYzkAKP6iojqVd5U7BF6Lb2/xjst/c+O1AAZnIZ4nBVE3qZI/d2uLPQtwn8rBe2fd4m/N2i0w==" 

Once you run this, your Execute URL and Service URL will be as follows.

security code

This can be used in the EC2 instance as well.

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.267" --environment EC2 --bucket testbucket 
--metadatacode "Mbblx2NaLzNmdGmvghqYTFtDmLGlSeAzlDUsrdJRgY2PZRadZX0mqfXFM3FKvugs0xiwcVc4GTE32RQ4pHxO/Q=="  
--executioncode "XBJCwm0xLYwqBVYzkAKP6iojqVd5U7BF6Lb2/xjst/c+O1AAZnIZ4nBVE3qZI/d2uLPQtwn8rBe2fd4m/N2i0w==" 

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. In this instance, use AZURE.
  • 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: (Optional)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

Google Cloud Platform

To deploy a package on Google Cloud Platform; you can use the command syntax below.

fr.exe deploy --to Google --package <value> --license <value> --includeAssemblies <value> --runtime <value> --function <value> --bucket<value> --accountkey<value> --region<value>
  • to: This is the target environment to deploy the package to. In this instance, use Google.
  • 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: (Optional) The Google Cloud Function Name.
  • bucket: Google Cloud bucket name
  • accountkey: path to the file that contains credentials used to authenticate and authorize access to GCP resources.
  • region: Datacenter where the deployment is going to happen

Example

fr.exe deploy --to Google --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.1.102" --function CalcFunction --bucket xxxx --accountkey ""D:\GCP\gcloud2.json"" --region "us-central1"

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. For this instance FRS(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 May 9, 2023

Was this article helpful?

Related Articles