2.0.1 • Published 2 years ago

slappforge-sigma-cli v2.0.1

Weekly downloads
23
License
MIT
Repository
-
Last release
2 years ago

SLAppForge Sigma CLI

 ██████╗██╗ ██████╗ ███╗   ███╗ █████╗      ██████╗██╗     ██╗
██╔════╝██║██╔════╝ ████╗ ████║██╔══██╗    ██╔════╝██║     ██║
███████╗██║██║  ███╗██╔████╔██║███████║    ██║     ██║     ██║
╚════██║██║██║   ██║██║╚██╔╝██║██╔══██║    ██║     ██║     ██║
███████║██║╚██████╔╝██║ ╚═╝ ██║██║  ██║    ╚██████╗███████╗██║
╚══════╝╚═╝ ╚═════╝ ╚═╝     ╚═╝╚═╝  ╚═╝     ╚═════╝╚══════╝╚═╝

SLAppForge Sigma CLI is a command line based toolkit that can be used to,

  • Validate
  • Build
  • Deploy

a serverless application project created using SLAppForge Sigma Serverless IDE.

⚠️ This toolkit is still in beta and hence not recommended for any production critical use cases.

ℹ️ This toolkit only supports AWS based deployments at the moment. GCP based deployments will be supported in the future.

Installation

Prerequisites

Following should be installed in the system where this toolkit is executed

  • NodeJS (version 10 or newer)

    Currently installed node version can be checked using the below command.

    node -v
  • NPM

    Currently installed npm version can be checked using the below command.

    npm -v

In case NodeJS and NPM are not installed, you can follow this guide to install them on your system.

🔧 Installing Sigma CLI

Sigma CLI can be installed as a global node module using the below command.

npm install slappforge-sigma-cli -g

Once installed, the sigma command will be available system-wide.

Usage

This toolkit can be used to validate, build or deploy a SLAppForge Sigma generated project. In each case, the toolkit should be invoked from the root directory of the Sigma project (i.e. the directory that contains the appState.json file).

All the operation logs will be written to the stderr of the console, while the final operation output will be written to the stdout of the console.

📖 help command

sigma help

This command lists all the available commands of this toolkit.

AWS Commands

🔍 validate command

sigma aws validate

This command validates whether the current directory has a valid AWS based Sigma serverless project and also if it is a version supported by this Sigma CLI.

Sigma CLI only supports building and deploying projects created by Sigma 1.4.0 or newer versions. If your project was created using an older Sigma version, please open the project using a newer Sigma version and re-save it into your VCS repository.

Command Options

This command does not have any options

Command Output stdout

This command does not output any value upon the successful completion

🔨 build command

sigma aws build [-opts]

This command builds the project in the current directory and generates the deployment package as a zip file into a given location on the local file system. The name of the generated zip file will be of the following format.

build_projectName_version_buildTimestamp.zip (e.g.: build_MyProject_1.0.0_1593063620507.zip)

Optionally this command can upload the generated deployment package into a given S3 bucket as well.

Command Options

OptionRequiredDescriptionDefault Value
--buildDir:x:File system location to save the generated deployment package./sigma-builds
--s3Bucket:x:S3 bucket to upload the generated deployment package. If this is not provided, S3 upload will not be attempted.-
--s3Prefix:x:S3 prefix to be added for the generated deployment package name-
--awsProfile:x:AWS profile to be used for uploading the generated deployment package to S3default
--awsKey:x:AWS access key to be used for uploading the generated deployment package to S3. This will be ignored if the --awsProfile option is provided.-
--awsSecret:x:AWS access secret to be used for uploading the generated deployment package to S3. This is required if --awsKey is provided.-

Command Output stdout

  • If only the local build was executed (without attempting S3 upload), relative file path of the generated deployment artifact will be the output. e.g.: ./sigma_builds/build_MyProject_1.0.0_1593063620507.zip

  • If S3 upload was also successful, S3 URL of the generated deployment artifact will be the output. e.g.: s3://myBucket/my-sigma-builds/build_MyProject_1.0.0_1593063620507.zip

🚀 deploy command

sigma aws deploy [-opts]

This command deploys the project in the current directory to the given AWS account. Prior to the deployment step, this will automatically invoke the build step as well.

Command Options

OptionRequiredDescriptionDefault Value
--depPackage:x:S3 URL of a pre-built deployment package. e.g.: s3://myBucket/my-sigma-builds/build_MyProject_1.0.0_1593063620507.zip If this is provided, project build stage will be skipped and --buildDir, --s3Bucket, --s3Prefix options will be ignored.-
--buildDir:x:File system location to save the generated deployment package./sigma-builds
--s3Bucket:x:S3 bucket to upload the generated deployment package and to upload the CloudFormation template if it is larger than 50kB. This is required if --depPackage is not provided or the CloudFormation template is larger than 50kB.-
--s3Prefix:x:S3 prefix to be added for the generated deployment package name and to the CloudFormation template file name if the template is larger than 50kB.-
--awsProfile:x:AWS profile to be used for uploading the generated deployment package to S3default
--awsKey:x:AWS access key to be used for uploading the generated deployment package to S3. This will be ignored if the --awsProfile option is provided.-
--awsSecret:x:AWS access secret to be used for uploading the generated deployment package to S3. This is required if --awsKey is provided.-
--stackName:x:Name of the CloudFormation stack to be created. This can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 128 characters.Will be of the format ProjectName-ProjectVersion-Stack (e.g.: MyProject-1-0-0-Stack)
--autoDepMode:x:Whether to automatically carry out the deployment without waiting for any user confirmation. If this is set to true, CLI will not prompt for user confirmation in any of the deployment steps. Instead it will take the following actions, unless any of them were overridden by specific command line arguments. - Change set deployment will start automatically, just after the generation. - In case the stack is in an unrecoverable (non-updatable) state, deployment will be aborted. (This can be overridden by providing the --deleteUnrecoverable option.)false
--deleteUnrecoverable:x:In case the stack is in an unrecoverable (non-updatable) state, whether to delete the existing stack and retry the deployment.false
--templateParam:x:A CloudFormation template parameter to be used during the deployment. The value of this option should be in the format paramKey:paramValue. This option can be provided multiple times for multiple parameters.-
--templateParamFile:x:A path to a JSON file containing the CloudFormation template parameters to be used during the deployment. Parameters provided from this file will be overridden by parameters provided as --templateParam, if the key is same.-

Command Output stdout

The final status of the CloudFormation stack, followed by the list of CloudFormation outputs of the stack. e.g.:

CREATE_COMPLETE
 MyLambda                             arn:aws:lambda:us-east-1:123456789123:function:MyLambda               ARN of Lambda function MyLambda
 httpApigMyEventAPIRoutePOSTnotify    https://abcd123efg.execute-api.us-east-1.amazonaws.com/prod/notify    POST endpoint for route /notify on API MyEventAPI
 snsusEast1MyNotificationTopic        arn:aws:sns:us-east-1:123456789123:MyNotificationTopic                ARN of SNS topic MyNotificationTopic