logoStacktape docs


cw:run-local

Overview and basic usage

Starts the specified container locally on your system.


  • This should be used when developing/debugging or running integrations tests.
  • All of the container ports specified in the events section will be mapped to the host.
  • Stacktape emulates the workload as closely to the deployed version as possible:
    • Container's environment variables referenced by $ResourceParam and $Secret directives are automatically downloaded and injected to the workload.
    • Temporary credentials of the container's assumed role are injected to the workload. This means that your locally running container will have the exact same IAM permissions as the deployed version.
  • The local emulation requires a deployed stack. Use the --disableEmulation flag if you want to locally run a workload that has not yet been deployed.
  • The container is rebuilt and restarted, when you either
    • use the --watch flag and one of your source code files changes
    • type rs + enter to the terminal

Copy

stacktape cw:run-local --stage <<stage>> --region <<region>> --container <<container>> --resourceName <<resourceName>>

API reference

Options

container (--cnt)
Required

Name of the container (as specified in the container workload configuration).

Type: string

region (--r)
Required

AWS region to use for the current operation.

Type: string ENUM

Possible values: af-south-1ap-east-1ap-northeast-1ap-northeast-2ap-northeast-3ap-south-1ap-southeast-1ap-southeast-2ca-central-1eu-central-1eu-north-1eu-south-1eu-west-1eu-west-2eu-west-3me-south-1sa-east-1us-east-1us-east-2us-west-1us-west-2

resourceName (--rn)
Required

No description

Type: string

stage (--s)
Required

Stage used for the operation.

Type: string

  • Example stages are production, staging, 'testing' or 'dev-john'.
  • You can configure the default stage used with every Stacktape command using the defaults:configure command.
  • Maximum allowed length is 12 characters.
configPath (--cp)

Path to your stacktape configuration file.

Type: string

  • Relative to CWD (current working directory).
currentWorkingDirectory (--cwd)

Current working directory for the current operation.

Type: string

  • Every file path in your config will be resolved relatively to specified cwd.
  • By default, directory containing the configuration file is used.
disableEmulation (--de)

Disables automatic injection of parameters and assumed role credentials

Type: boolean

  • Stacktape's local emulation requires a deployed stack. Use this flag if you want to locally run a workload that has not yet been deployed.
dockerArgs (--da)

Additional arguments to pass to Docker run or Docker build commands

Type: array

help (--h)

Shows help for the command

Type: string

  • If specified, the command won't perform any action besides printing help.
logFormat (--lf)

Format of logs printed to your console.

Type: string ENUM

Possible values: basicfancyjsonnormal

Available options:

  • fancy: Logs are colorized and dynamically re-rendered.
  • normal: Logs are colorized but not dynamically re-rendered.
  • basic: Simple text only
  • json: Logs are printed as JSON objects
logLevel (--ll)

Level of logs that are being printed to the console.

Type: string ENUM

Possible values: debugerrorinfo

Available options:

  • info: Prints basic information about everything that's happening.
  • error: Prints only errors.
  • debug: Prints detailed information about everything that's happening.
preserveTempFiles (--ptf)

Preserves temporary files that stacktape generates using the operation.

Type: boolean

  • Temp folder includes CloudFormation template, packaged workloads and other files.
  • By default, these changes are saved to .stacktape/[invocation-id].
  • Temp folder location is also printed to the console.
profile (--p)

AWS profile to use with the command

Type: string

  • You can manage AWS profiles on your system using aws-profile:create, aws-profile:update or aws-profile:delete command.
  • You can configure the default profile used with every Stacktape command using the defaults:configure command.
watch (--w)

Watch for changes made to your source files and re-execute workload when they change.

Type: boolean

Need help? Ask a question on SlackDiscord or info@stacktape.com.