# Toa Command Line Interface
## Common Options
--env
- Path to the environment variables file (`.env` format)
## Development
### compose
Run composition.
toa compose [paths]
-
paths Glob patterns to look for components.
--kill Shutdown composition after it's started
--service Extension service to run in this composition, by shortcut or package
reference. Repeat for several.
--dock Run in Docker using current .env.
--context Path to the Context root (default .).
--bindnings Override bindings (obsolete).
> Note that your `localhost` it is accessible from a container as `host.docker.internal`.
`--service` starts the named extension services in the composition process, beside its
components:
```shell
$ toa compose ./components/* --service exposition --service configuration
```
The list is exact — unlike `mono`, nothing is discovered. A service the named ones talk to
answers over the network in a deployment; in one process it is named too, or nothing answers
it. Absent `--service`, the list is read from `TOA_SERVICES`, whitespace-separated, which is
what a deployment sets from a composition's `services`.
### types
Generate types for a Context and every component in it.
toa types
-
--path Path to the Context root (default .).
--environment Environment the Context is read for.
--quiet Print nothing.
Written are `types/` beside `context.toa.yaml` and a `types.ts` beside every component's
manifest. Both are Toa's: every run rewrites them, and each carries the `package.json` naming
it — `@components/` for a component, the Context's own `name` for the Context.
What a manifest does not state is not generated. An operation declaring no `output` returns
`unknown`, unless it is one Toa itself provides — the prototype's algorithms return the scope
they are given. An alias for something a schema does describe belongs in a file of your own:
```typescript
import type { Entity } from '@components/activities'
type Plugin = Entity['plugins'][number]
```
### mono
Run composition and extension services in one process.
Application components are found by `manifest.toa.yaml`, same as compose.
Extension services are started for each component extension whose `Factory` implements `service()`.
toa mono [paths...]
-
paths Glob patterns to look for components (default .).
--kill Shutdown after it's started.
Environment variables must be provided as with compose and serve
(typically via toa env / --env).
### call
Call endpoint.
toa call <endpont> [request]
-
endpoint endpoint to call.
request Request object.
```shell
$ toa call dummies.dummy.create "{ input: { name: 'foo' } }"
```
### env
Export environment to a `.env` file.
toa env [environment]
-
environment deployment environment name (default local).
--path path to a Context (default .)
--as output file path (default .env)
--interactive prompt for secret values
--dev / -d fill secrets with local/dev defaults; unresolved secrets throw unless --interactive is also set
Credentials specified in the output file are preserved.
> It is recommended to add `.env*` to `.gitignore`.
### export manifest
toa export manifest
- Print normalized manifest.
--path path to a component (default .)
--jsonpath JSONPath expression to filter the output
--error print errors only
--output output format (default yaml)
### export secrets
toa export secrets <environment>
- Print deployment secrets.
--path path to context (default .)
### export image tags
toa export tags <environment>
- Print image tags.
--path path to context (default .)
## Operations
> Some commands use current `kubectl` and `docker` context.
### build
Build Docker images.
toa build
-
--path path to a Context (default .)
--mono build a single image that runs toa mono
### deploy
Deploy a Context.
- Build Docker images.
- Push Docker images to the registry.
- Build a Helm chart.
- Apply the Helm chart to the current Kubernetes context.
toa deploy [environment]
-
environment deployment environment name (default default).
--path path to a Context (default .)
--namespace Kubernetes namespace to apply the Helm chat to
--wait wait until all
Pods [are ready](https://helm.sh/docs/intro/using_helm/#helpful-options-for-installupgraderollback)
--dry do not apply the Helm chart
--mono build one image and deploy it as a single Deployment
`toa build --mono` and `toa export deployment --mono` use the same layout.
Optional `mono:` in the context sets replicas and resources (environment-suffixed as `mono@dev`):
```yaml
mono:
replicas: 2
resources:
cpu: [200m, 2]
memory: [256Mi, 2Gi]
```
Without `mono:`, `--mono` defaults to 2 replicas and no resource requests or limits.
### conceal
Deploy a generic Kubernetes secret with the prefix `toa-`.
toa conceal <secret> <key-values...>
-
secret Secret name.
key-values List of keys and values of the secret as key=value.
--namespace Kubernetes namespace where the secret should be deployed.
--interactive prompt for secret values
--environment environment name for interactive mode
--path path to a context for interactive mode
> If a secret already exists, then given `key-values` will be added to it.
#### Example
```shell
$ toa conceal bindings-amqp-default username=developer password=secret
```
### reveal
Outputs keys and values of a secret.
-
toa reveal <secret>
### shell
Run interactive shell inside a disposable pod inside a Kubernetes cluster.
-
toa shell [image]
-
image Docker image to Run (default alpine).
#### Examples
```shell
$ toa shell mongo
$ toa shell -- ping 1.1 # extra arguments can be passed
```
### key
Generate a 256-bit base64url JWE encryption key. Use `--format paseto` only for
legacy PASETO-compatible keys.
```shell
toa key
toa key --format paseto
toa key --public
```
The default output can be used in an `identity.tokens.keys` entry with `format: jwe` or with the
format omitted. `--format paseto` generates a V3.local PASERK value for a transitional
`format: paseto` entry. `--public` generates a PASETO V3.public secret/public pair and ignores the
symmetric key format.
-
toa key
-
--public boolean generate a public/private key pair.
--format jwe | paseto secret key format (default: jwe).