Skip to content

Commit 86e7d8e

Browse files
authored
docs: updating/maintenance of CLI command, runtime and local preferences docs (#765)
* chore: clean up runtime docs, spring cleaning of `init` CLI docs * chore: spring cleaning of `deploy` CLI docs * chore: updating destroy, env, logs and sandbox help text based on recent architect 11.2.1 updates to help text * chore: scrub cli help text and local preference docs
1 parent c550c56 commit 86e7d8e

File tree

10 files changed

+235
-183
lines changed

10 files changed

+235
-183
lines changed

scripts/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ LEANX
2323
Namecheap
2424
ParcelJS
2525
treeshaking
26+
scaffolded

src/views/docs/en/reference/cli/deploy.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ sections:
88
- Flags
99
---
1010

11-
Deploy an Architect project to AWS by creating or updating a [CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html) stack with resources declared in [the project manifest](../../get-started/project-manifest).
11+
Deploy an Architect project to AWS by creating or updating a [CloudFormation][cfn] Stack with resources declared in [the project manifest][manifest].
1212

13-
CloudFormation stack names are created from the name specified in the `@app` pragma and are unique to an AWS region. Changing the project name or region will create a new CF stack.
13+
[CloudFormation][cfn] Stack names are created from the name specified in [the `@app` pragma][app] and are unique to an AWS region. Changing the project name or region will create a new [CloudFormation][cfn] Stack.
1414

1515
## Usage
1616

1717
```bash
18-
arc deploy [--production|--static|--direct]
18+
arc deploy [flags]
1919
```
2020

2121
## Flags
2222

23-
- `[--debug, -d]` Displays debug (and verbose) logging.
24-
- `[--direct path/to/function]` Overwrite staging Lambda with local source. A faster way to deploy and test small changes to individual functions without redeploying an entire stack.
25-
- `[--dry-run]` Creates a CloudFormation template but does not deploy it. A dry-run allows you to check the CloudFormation and SAM output before deploying the actual stack.
26-
- `[--fast, -f]` Deploy the stack, but do not hold the process open to determine whether the deployment succeeded or failed within AWS
27-
- `[--name, -n]` Deploy a custom named staging stack.
28-
- `[--no-hydrate]` Do not automatically run `npm`, `bundle`, or `pip`
29-
- `[--production, -p]` Deploys a CloudFormation stack to a production stack.
30-
- `[--prune]` Remove assets not present in the local static folder.
31-
- `[--static, -s]` Deploys only the files in the static folder.
32-
- `[--tags, -t]` Adds resource tags to the CloudFormation stack.
33-
- The required tag format is `key=value`, e.g. `--tags key1=value1 key2=value2`
34-
- `[--verbose, -v]` Displays verbose logging.
23+
- `--direct path/to/function`: Directly deploy the specified Lambda. A faster way to deploy and test small changes to individual functions without redeploying an entire Stack.
24+
- `--dry-run`: Generate a [CloudFormation][cfn] template but do not deploy it. A dry run allows you to check the [CloudFormation][cfn] and SAM output before deploying the actual stack.
25+
- `--eject`: Generate a [CloudFormation][cfn] template but do not deploy it. Instead, print out the `aws cloudformation` CLI invocation to execute the deployment.
26+
- `--fast`, `-f`: Deploy the stack, but do not block the process until deployment completed.
27+
- `--name`, `-n`: Deploy a custom named staging Stack. E.g. `--name CI` will deploy a `AppnameStagingCI` [CloudFormation][cfn] Stack.
28+
- `--no-hydrate`: Do not automatically [`hydrate`](hydrate) functions prior to deployment.
29+
- `--production`, `-p`: Deploys a [CloudFormation][cfn] Stack to a production Stack. If not specified, will default to deploy to a staging Stack.
30+
- `--prune`: Remove static assets deployed to S3 bucket not present in the local [`@static`][static] folder.
31+
- `--static`, `-s`: Deploys only the files in the [`@static`][static] folder.
32+
- `--tags`, `-t`: Adds resource tags to the CloudFormation stack. The required tag format is `key=value`, e.g. `--tags key1=value1 key2=value2`
33+
- `--verbose`, `-v`: Displays verbose logging.
34+
- `--debug`, `-d`: Displays debug (and verbose) logging.
3535

3636
## Local preferences: `@create`
3737

38-
When deploying, Architect can automatically scaffold resources (via [`arc init`](./init)) found in the [application's manifest](../../get-started/project-manifest) that do not yet exist. Options are set with [`@create` in local preferences](../configuration/local-preferences#%40create).
38+
When deploying, Architect can automatically scaffold resources (via [`init`](init)) found in the [application's manifest][manifest] that do not yet exist. Options are set with [`@create` in local preferences](../configuration/local-preferences#%40create).
3939

4040
- `autocreate` - Set to `true` to enable automatic creation of boilerplate Lambda handlers and static assets if they do not exist.
4141
- `templates` - Specify templates for automatic resource scaffolding.
@@ -52,42 +52,48 @@ templates
5252

5353
## Examples
5454

55-
### Deploy a staging stack
55+
### Deploy a staging Stack
5656

5757
```bash
5858
arc deploy
5959
```
6060

61-
### Deploy a production stack
61+
### Deploy a production Stack
6262

6363
```bash
6464
arc deploy --production
6565
```
6666

67-
### Deploy a named environment
67+
### Deploy a named staging Stack
6868

6969
```bash
7070
arc deploy --name my-stack
7171
```
7272

73-
> 💁 Named stacks use `staging` environment variables [set with `arc env -e staging --add`](./env).
73+
> 💁 Named stacks use `staging` environment variables [set with the `env` command](env).
7474
7575
### Deploy static assets to S3
7676

7777
```bash
7878
arc deploy --static
7979
```
8080

81-
### Deploy code directly to the staging Lambda
81+
### Deploy the index route directly to staging
8282

8383
```bash
8484
arc deploy --direct src/http/get-index
8585
```
8686

8787
### Run deploy without deploying
8888

89-
This is useful for testing `@macros`; it will still generate `sam.json`.
89+
This is useful for testing [`@plugins`][plugins]; it will still generate `sam.json`.
9090

9191
```bash
9292
arc deploy --dry-run
9393
```
94+
95+
[cfn]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html
96+
[manifest]: ../../get-started/project-manifest
97+
[static]: ../project-manifest/static
98+
[app]: ../project-manifest/app
99+
[plugins]: ../project-manifest/plugins

src/views/docs/en/reference/cli/destroy.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,63 @@
22
title: arc destroy
33
category: CLI
44
description: CLI destroy command for removing Architect application
5+
sections:
6+
- Usage
7+
- Flags
8+
- Examples
59
---
610

7-
Remove the CloudFormation stack and all related assets (S3 buckets, CloudWatch Log Groups, SSM environment variable parameters) for the current project from AWS completely. By default, removes the staging stack.
11+
Completely removes your Architect application from AWS. This command deletes all resources associated with your application, including the [CloudFormation][cfn] Stack, SSM environment variables, CloudWatch Logs, deployment S3 bucket, and static S3 bucket (if applicable).
812

9-
Large applications may take several minutes to delete and by default this command times out after 150 seconds. Even if this command times out, deletion may still complete successfully as removal completes asynchronously in the background at AWS. To have this process block until all application resources are removed, use the `--no-timeout` flag (see below for more information).
13+
By default, this command destroys your staging environment. Use the `--production` flag to target the production environment instead. For custom environments created with [`deploy --name`][deploy], use the `--name` flag to specify the environment to destroy.
14+
15+
Large applications may take several minutes to delete and by default this command times out after 150 seconds. Even if this command times out, deletion may still complete successfully as removal completes asynchronously in the background. To have this process block until all application resources are removed, use the `--no-timeout` flag.
1016

1117
## Usage
1218

1319
```bash
14-
arc destroy <--app MyAppName> [--production] [--name NamedEnvironment] [--force]
20+
arc destroy [flags]
1521
```
1622

1723
## Flags
1824

19-
- `[--app MyAppName]` Required. Specify the app name, located under `@app` in your Architect manifest, to delete the app from AWS.
20-
- `[--name NamedEnvironment]` If you ran [`arc deploy`][deploy] with the `--name` flag to specify a custom named environment to deploy your application to, use this flag to destroy that same named application environment.
21-
- `[--production]` Destroy the production stack of your application. By default, without this flag, the staging stack is removed.
22-
- `[--force, -f]` Force deletion of the application even if it contains DynamoDB tables ([`@tables`][tables]) or S3 bucket containing static assets ([`@static`][static]).
23-
- `[--no-timeout]` Do not exit the process until all application resources are deleted.
25+
- `--app`: App name as specified by your application's [`@app` pragma][app] (required for confirmation).
26+
- `--force`, `-f`: Destroy an app that has database [`@tables`][tables] and/or [`@static`][static] assets.
27+
- `--name`: Target a custom named environment created with [`deploy --name`][deploy].
28+
- `--now`: Skip the 5-second safety delay before destroying resources.
29+
- `--no-timeout`: Wait indefinitely for all application resources to be removed (by default times out after ~150 seconds).
30+
- `--production`, `-p`: Destroy the production environment instead of staging.
31+
- `--verbose`, `-v`: Print more detailed information during the destroy process.
32+
- `--debug`, `-d`: Print even more detailed information for debugging purposes.
2433

2534
## Examples
2635

27-
### Destroy the staging stack
36+
### Destroy the staging Stack
2837

2938
```bash
3039
arc destroy --app my-app
3140
```
3241

33-
### Destroy the production stack
42+
### Destroy the production Stack
3443

3544
```bash
3645
arc destroy --app my-app --production
3746
```
3847

39-
### Destroy staging stack with S3 bucket and/or Dynamo tables
48+
### Destroy staging Stack with S3 bucket and/or Dynamo tables
4049

4150
```bash
4251
arc destroy --app my-app --force
4352
```
4453

45-
### Destroy custom named stack
54+
### Destroy custom named Stack
4655

4756
```bash
48-
arc destroy --app my-app --name Dev --force
57+
arc destroy --app my-app --name Dev
4958
```
5059

5160
[deploy]: deploy
61+
[app]: ../project-manifest/app
5262
[tables]: ../project-manifest/tables
5363
[static]: ../project-manifest/static
64+
[cfn]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html

src/views/docs/en/reference/cli/env.md

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,54 @@
22
title: arc env
33
category: CLI
44
description: Read and write environment variables for Lambda functions.
5+
sections:
6+
- Usage
7+
- Flags
8+
- Security
9+
- Examples
10+
- Reserved names
11+
- Specific function opt-out
512
---
613

7-
Read and write environment variables. This allows apps to centrally store sensitive configuration data, such as API keys, outside of the codebase in revision control.
14+
Manage environment variables for your Architect application across different environments. This command allows you to read, add, and remove environment variables that will be available to your Lambda functions at runtime.
815

9-
> `arc env` will **not** upload variables from a project's [local preferences file](../configuration/local-preferences#%40env); however, it will download variables from AWS and overwrite local preference entries.
16+
When run without any flags, this command will print out all environment variables and their values, across all environments.
17+
18+
Environment variables are stored in AWS SSM Parameter Store for staging and production environments. For local development (testing environment), variables are stored in your project's [`preferences.arc` file][prefs] or `.env` file if one exists.
19+
20+
> `arc env` will **not** upload variables from a project's [local preferences file][env-prefs]; however, it will download variables from AWS and overwrite local preference entries.
21+
22+
> 💁 `staging` environment variables are also used in named deployments [created with `arc deploy --name <name>`](./deploy).
1023
1124
## Usage
1225

1326
```bash
14-
arc env [-e environment] [--add|--remove] VARIABLE_NAME VARIABLE_VALUE
27+
arc env [flags] [VARIABLE_NAME] [VARIABLE_VALUE]
1528
```
1629

17-
1830
## Flags
1931

20-
- `[-e [testing|staging|production]]` Displays all environment variables for the specified environment
21-
- `<--add, -a> -e <testing|staging|production> NAME value` Assigns a value to the specified variable name in the specified environment
22-
- `<--remove, -r> -e <testing|staging|production> NAME` Removes the specified variable from the specified environment
23-
32+
- `-e`, `--env <environment>`: Specify environment (`testing`, `staging`, or `production`)
33+
- `-a`, `--add`: Add a new environment variable
34+
- `-r`, `--remove`: Remove an environment variable
35+
- `-v`, `--verbose`: Print more detailed output
36+
- `-d`, `--debug`: Print even more detailed information for debugging
2437

2538
## Security
2639

27-
It is imperative that the `ARC_APP_SECRET` environment variable be set to
28-
a strong secret - especially in your production environment! It should have a minimum length of 16 bytes. This secret is
29-
used to encode HTTP sessions if you use the [`@architect/functions` runtime helpers](../runtime-helpers/node.js#arc.http.session).
40+
It is imperative that the `ARC_APP_SECRET` environment variable be set to a strong secret - especially in your production environment! **It must have a minimum length of 32 bytes**. This secret is used to encode HTTP sessions if you use the [`@architect/functions` runtime helpers](../runtime-helpers/node.js#arc.http.session).
41+
42+
## Reserved names
43+
44+
The following environment variable names are reserved for Architect use and cannot be set in an app:
3045

46+
- `ARC_ENV`
47+
- `ARC_APP_NAME`
48+
- `ARC_SESSION_TABLE_NAME`
49+
50+
## Specific function opt-out
51+
52+
A function can be [configured with a `config.arc`](../configuration/function-config#%40arc) to not load local environment variables.
3153

3254
## Examples
3355

@@ -37,32 +59,25 @@ used to encode HTTP sessions if you use the [`@architect/functions` runtime help
3759
arc env
3860
```
3961

62+
### Display variables for a specific environment
63+
64+
```bash
65+
arc env --env staging
66+
```
4067

4168
### Save an environment variable to the staging environment
4269

4370
Variable values that contain special characters like email addresses should be wrapped in double quotes
4471

4572
```bash
46-
arc env -e staging --add SECRET_API_PASSWORD "p@s5w0rd!"
73+
arc env --add --env staging SECRET_API_PASSWORD "p@s5w0rd!"
4774
```
4875

49-
> 💁 `staging` env variables are also used in named deployments [created with `arc deploy --name <name>`](./deploy).
50-
51-
5276
### Remove an environment variable
5377

5478
```bash
55-
arc env -e staging --remove SECRET_API_PASSWORD
79+
arc env --remove --env staging SECRET_API_PASSWORD
5680
```
5781

58-
59-
## Reserved names
60-
61-
- `ARC_ENV`
62-
- `ARC_APP_NAME`
63-
- `ARC_SESSION_TABLE_NAME`
64-
65-
66-
## Specific function opt-out
67-
68-
A function can be [configured with a `config.arc`](../configuration/function-config#%40arc) to not load local environment variables.
82+
[prefs]: ../configuration/local-preferences
83+
[env-prefs]: ../configuration/local-preferences#%40env

src/views/docs/en/reference/cli/hydrate.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: hydrate
2+
title: arc hydrate
33
category: CLI
44
description: Install and update dependencies for all functions in a project.
55
---
66

7-
Ensure that all functions managed by Architect have their dependencies installed. Functions containing all its required dependencies are considered to be "hydrated" - thus the name!
7+
Ensure that all functions managed by Architect have their dependencies installed. Functions containing all their required dependencies are considered to be "hydrated" - thus the name!
88

9-
Importantly, `arc hydrate` will also copy shared code from `src/shared` into all functions and `src/views` into `@http` GET functions.
9+
Importantly, `arc hydrate` will also copy [shared code][sharing] from `src/shared` into all functions and `src/views` into [`@http`][http] GET functions.
1010

11-
When developing locally with Sandbox, it is not necessary to manually run `hydrate` since Sandbox handles this automatically. However, it can be helpful to ensure hydration happens prior to a process like `npm test`.
11+
When [developing locally with Sandbox][local-dev], it is not necessary to manually run `hydrate` since Sandbox handles this automatically. However, it can be helpful to ensure hydration happens prior to a process like `npm test`.
1212

1313
## Usage
1414

@@ -18,9 +18,9 @@ arc hydrate [--shared|--update]
1818

1919
## Flags
2020

21-
- `[--shared, -s]` Hydrates and copies shared files only
22-
- `[--update, -u]` Updates each function's dependencies
23-
- `[--verbose, -v]` Prints additional output to the console
21+
- `--shared`, `-s`: Hydrates and copies [shared files][sharing] only
22+
- `--update` `-u`: Updates each function's dependencies to latest versions
23+
- `--verbose`, `-v`: Prints additional output to the console
2424

2525
## Notes
2626

@@ -37,3 +37,7 @@ Hydrate uses the following commands under the hood, depending on project's or fu
3737
- **node.js**: `npm update`
3838
- **python**: `pip3 install -U --upgrade-strategy eager`
3939
- **ruby**: `bundle update`
40+
41+
[local-dev]: ../../guides/developer-experience/local-development
42+
[sharing]: ../../guides/developer-experience/sharing-code
43+
[http]: ../project-manifest/http

src/views/docs/en/reference/cli/init.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@ category: CLI
44
description: Scaffold new resources found in the app.arc file
55
---
66

7-
Bootstrap new Architect project code. Running `arc init` in an empty directory creates a default `app.arc` manifest file named after that directory with one default function `src/http/get-index`. Edit `app.arc` adding functions and re-run `arc init` to generate further code. This command is intended to be run and re-run; it will only generate files if they do not already exist.
7+
Bootstrap new Architect project code. Running `arc init` in an empty directory creates a default [`app.arc` manifest file][manifest] named after that directory with one default [`@http` function][http] at `src/http/get-index`. Pass a directory name as a final positional argument to create a project in the specified directory. Edit `app.arc`, expanding the [manifest][manifest], adding functions and re-running `arc init` to generate further code. This command is idempotent: intended to be run and re-run; it will only generate files if they do not already exist.
8+
9+
If you run this command with the `--plugin` flag, a scaffolded [Architect plugin][plugins] will be created instead.
810

911
## Usage
1012

1113
```bash
12-
arc init [--static|--runtime]
14+
arc init [flags] [path/to/project-directory]
1315
```
1416

1517
## Flags
1618

17-
- `[--static, -s]` Create a new project with `@static` folder set to `public`
18-
- `[--runtime, -r]` Create a new project with a specified runtime, options are node, deno, python, or ruby
19-
- `[--verbose, -v]` Even more output
19+
- `-n`, `--name`: Set the [`@app` namespace][app] for the created app
20+
- `--no-install`: Do not automatically install `@architect/architect` as a dependency in the project
21+
- `-p`, `--plugin`: Create a new scaffolded [Architect plugin][plugins] instead of a new Architect project
22+
- `--runtime`, `-r`: Create a new project with the specified runtime. Defaults to `node`. See the [`runtime` configuration documentation][runtimes] for available options.
23+
- `--verbose`, `-v`: Even more output
2024

2125
## Local preferences: `@create`
2226

@@ -67,3 +71,9 @@ npm init "@architect" myapp
6771
</arc-tab>
6872
</div>
6973
</arc-viewer>
74+
75+
[app]: ../project-manifest/app
76+
[http]: ../project-manifest/http
77+
[manifest]: ../../get-started/project-manifest
78+
[plugins]: ../../guides/plugins/overview
79+
[runtimes]: ../project-manifest/aws#runtime

0 commit comments

Comments
 (0)