Skip to content

Commit eb36bd4

Browse files
committed
Merge branch 'doc-editing'
I spent some time last month editing all of the documentation, as an excuse to try out Vale (for English prose linting). Neither of the rule sets I tried satisfied me, and on a second pass I found that I "fixed" some findings by introducing other, more obvious errors. I'm glad I know about Vale now, but I don't plan on trying too hard to integrate it into my workflow. Either way, I think this is a good changeset.
2 parents 2d0da8a + a734d5a commit eb36bd4

File tree

3 files changed

+50
-53
lines changed

3 files changed

+50
-53
lines changed

README.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ You'll need the [Go][go] toolchain installed to try the demo program.
2323
1. Build the demo: `go build ./cmd/randomizer-demo`
2424
1. See what to do next: `./randomizer-demo help`
2525

26-
The demo outputs the same text that would be sent to Slack, using proper
27-
[message formatting][format]. Groups are saved in a [bbolt][bbolt] database
28-
file in the current directory. This gives a rough taste of how the command
29-
works, and is helpful for testing.
26+
The demo saves groups in a [bbolt][bbolt] database in the current directory,
27+
and outputs responses using [Slack's "mrkdwn" format][format]. This gives a
28+
taste of how the command works, and helps with testing.
3029

3130
[go]: https://golang.org/
3231
[format]: https://api.slack.com/docs/message-formatting
@@ -37,11 +36,10 @@ works, and is helpful for testing.
3736
This repo provides two guides on deploying the randomizer API for use with
3837
Slack:
3938

40-
- `SERVERLESS.md` is a fairly detailed walkthrough for deployment on [AWS
39+
- `SERVERLESS.md` is a detailed walkthrough for deployment on [AWS
4140
Lambda][lambda], Amazon's managed function as a service platform.
42-
- `SERVERMORE.md` is a fairly high-level guide for setting up the
43-
`randomizer-server` HTTP server, that assumes more background knowledge
44-
and/or willingness to dive into details of both standard server management
45-
and the randomizer implementation.
41+
- `SERVERMORE.md` is a high-level guide for configuring the `randomizer-server`
42+
HTTP server. It assumes more background knowledge and/or willingness to dive
43+
into the details of server management and the randomizer implementation.
4644

4745
[lambda]: https://aws.amazon.com/lambda/

SERVERLESS.md

+24-24
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ IAM][iam].
3131

3232
## Create an S3 Bucket
3333

34-
When AWS Lambda starts up your function, it will download the compiled
35-
randomizer code from an [Amazon S3][s3] bucket. You can create a new S3 bucket
36-
using the AWS CLI:
34+
When AWS Lambda starts up your function, it downloads the compiled randomizer
35+
code from an [Amazon S3][s3] bucket. You can create a new S3 bucket using the
36+
AWS CLI:
3737

3838
```sh
3939
aws s3 mb s3://[name]
@@ -50,8 +50,8 @@ want a name that references yourself, your company, etc.
5050

5151
The randomizer validates that each HTTP request legitimately came from Slack by
5252
checking for a special Slack-provided token value in the request parameters.
53-
Since this token is a secret value, we'll store it in the [AWS Systems Manager
54-
Parameter Store][ssm parameter store] with encryption.
53+
Since this token is a secret value, you should store it in the [AWS Systems
54+
Manager Parameter Store][ssm parameter store] with encryption.
5555

5656
Note that the current version of the randomizer only supports the deprecated
5757
"Verification Token" to validate requests, and not the newer "Signing Secret"
@@ -66,19 +66,19 @@ aws ssm put-parameter --type SecureString --name /Randomizer/SlackToken --value
6666
```
6767

6868
The parameter name in the `aws ssm` command is unique within your AWS account,
69-
must start with a `/`, and can contain additional slash-separated parts to help
70-
you organize all of the SSM parameters in your account. While the parameter can
71-
be encrypted with the default AWS-managed SSM key, the CloudFormation template
72-
does not currently support encryption with a custom KMS key (which would cost
73-
$1/mo and require additional IAM and KMS setup).
69+
must start with a `/`, and can contain extra slash-separated parts to help
70+
organize all the SSM parameters in your account. While you can encrypt the
71+
parameter with the default AWS-managed SSM key, the CloudFormation template
72+
doesn't support encryption with a custom KMS key (which costs $1/mo and
73+
requires extra IAM and KMS setup).
7474

7575
[ssm parameter store]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html
7676

7777
## Run the Initial Deployment
7878

79-
Now, we're ready to use AWS [CloudFormation][CloudFormation] to deploy the
80-
randomizer into our account, with all necessary resources (e.g. the DynamoDB
81-
table for storing groups) automatically created and configured.
79+
Now, you'll use AWS [CloudFormation][CloudFormation] to deploy the randomizer
80+
into your account, with all necessary resources (like the DynamoDB table for
81+
storing groups) automatically created and configured.
8282

8383
Similar to how you picked S3 bucket and SSM parameter names, you'll also need
8484
to pick a name for your CloudFormation "stack." Like your repository name, this
@@ -107,10 +107,10 @@ deployment:
107107
./hfc build-deploy Randomizer # or whatever other stack name you chose
108108
```
109109

110-
This command will automatically compile the randomizer code for AWS Lambda,
111-
upload it to your S3 bucket, and set it up for use. After some time, the script
112-
will finish and print the webhook URL for Slack. Copy and paste this into the
113-
"URL" field of your Slack slash command configuration, and save it.
110+
This command automatically compiles the randomizer code for AWS Lambda, uploads
111+
it to your S3 bucket, sets it up for use, and prints a webhook URL for Slack.
112+
Copy and paste this into the "URL" field of your Slack slash command
113+
configuration, and save it.
114114

115115
At this point, you should be able to use the randomizer in your Slack
116116
workspace. Go ahead and try it out!
@@ -119,27 +119,27 @@ workspace. Go ahead and try it out!
119119

120120
## Upgrades and Maintenance
121121

122-
To upgrade the randomizer deployment in your AWS account, run the above command
123-
in a newer version of the randomizer repository.
122+
To upgrade the randomizer deployment in your AWS account, run
123+
`./hfc build-deploy Randomizer` in a newer version of the repository.
124124

125125
Run `./hfc help` to learn more about additional commands that might be useful.
126126

127127
## Notes
128128

129129
- The CloudFormation template (Template.yaml) uses the [AWS SAM][sam]
130130
transformation to simplify the setup of the Lambda function.
131-
- The DynamoDB table in the template is provisioned in On-Demand capacity mode.
132-
Note that this mode is not eligible for the AWS Free Tier. See the
133-
documentation for [Read/Write Capacity Mode][capacity mode] for more details.
131+
- The template provisions the DynamoDB table in On-Demand capacity mode, which
132+
isn't eligible for the AWS Free Tier. See the [Read/Write Capacity
133+
Mode][capacity mode] documentation for details.
134134
- The default configuration enables [AWS X-Ray][x-ray] tracing for the function
135135
and its requests to DynamoDB. X-Ray is free for up to 100,000 traces per month
136136
for every AWS account, and it's useful to see where each request is spending
137137
time. However, you can turn it off by passing `XRayTracingEnabled=false` to
138138
the deployment script.
139139
- My co-workers and I collectively make a little over 500 requests to the
140140
randomizer per month, and at that small of a volume it's essentially free to
141-
run on AWS even without the 12 month free tier. My _very rough_ estimate is
142-
that the randomizer probably costs less than $1 per million requests.
141+
run on AWS even without the 12 month free tier. My _rough_ estimate is that
142+
the randomizer costs less than $1 per million requests.
143143

144144
[sam]: https://github.com/awslabs/serverless-application-model
145145
[capacity mode]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html

SERVERMORE.md

+19-20
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@
33
`randomizer-server` is an HTTP server providing the Slack slash command API for
44
the randomizer. This section provides general pointers on setting it up.
55

6-
This guide does **not** cover:
6+
This guide **doesn't** cover:
77

88
- Proper server configuration and service management, whether directly on a
99
server (systemd, Docker, Podman, etc.) or through an orchestrator
1010
(Kubernetes, HashiCorp Nomad, Docker Swarm, etc.).
1111
- Setting up a reverse proxy to provide SSL termination for the randomizer API
12-
(as `randomizer-server` does not serve TLS out of the box).
12+
(as `randomizer-server` doesn't serve TLS out of the box).
1313
- The specifics of configuring cloud credentials and access policies, should
14-
you wish to use a cloud backend for group storage or secrets.
14+
you wish to use a cloud provider for group storage or secrets.
1515

16-
If you're uncomfortable with these topics or the level of detail provided
17-
below, and you aren't interested in self-study or trial and error to work
18-
through it all, the AWS Lambda setup might be preferable (see `SERVERLESS.md`).
16+
If you're uncomfortable with these topics or the rest of this guide, and you
17+
aren't interested in learning them, you might prefer the AWS Lambda setup in
18+
`SERVERLESS.md`.
1919

20-
In addition to the environment variables below, check `randomizer-server -help`
21-
for CLI flags that you may wish to set, e.g. the bind address for the server
20+
In addition to the environment variables below, see `randomizer-server -help`
21+
for CLI flags that you may wish to set, like the bind address for the server
2222
(defaults to ":7636").
2323

2424
## Slack Token
2525

2626
Regardless of the group storage backend, you'll need to configure one of the
2727
following environment variables to set the Slack slash command verification
28-
token (sorry, the newer signing secret configuration is not yet supported):
28+
token (the newer signing secret configuration isn't supported):
2929

3030
- `SLACK_TOKEN`: Set to the value of the token itself.
3131
- `SLACK_TOKEN_SSM_PATH`: The path to an AWS SSM Parameter Store parameter
3232
containing the value of the verification token. This requires appropriate AWS
3333
configuration in the environment. You can also set `SLACK_TOKEN_SSM_TTL` to a
34-
Go duration to control how long the SSM lookup is cached for (default 2m).
34+
Go duration to control how long the SSM lookup remains cached (default 2m).
3535

3636
## Storage Backends
3737

@@ -40,14 +40,13 @@ token (sorry, the newer signing secret configuration is not yet supported):
4040
[bbolt][bbolt] is the local key-value database engine behind systems like etcd,
4141
Consul, InfluxDB 2.x, and more.
4242

43-
The bbolt backend's only prerequisite is persistent disk storage. The database
44-
file will be locked by a single server process at a time, so note that this
45-
backend will not support things like high availability or zero-downtime
46-
deployment.
43+
The bbolt backend's only prerequisite is persistent disk storage. Since a
44+
single running server locks the database file, this backend won't support high
45+
availability or zero-downtime deployment.
4746

48-
The bbolt backend is activated by default if no other backends have environment
47+
The bbolt backend is active by default if no other backends have environment
4948
variables set. You can set `DB_PATH` to the desired location of the database on
50-
disk; it defaults to "randomizer.db" in the current directory.
49+
disk, otherwise it defaults to "randomizer.db" in the current directory.
5150

5251
[bbolt]: https://go.etcd.io/bbolt
5352

@@ -62,8 +61,7 @@ this up. You can also reference `GroupsTable` in `CloudFormation.yaml`.
6261
To activate the DynamoDB backend, set `DYNAMODB_TABLE` to the name of the
6362
table. You may also need to configure [environment variables for the AWS
6463
SDK][AWS vars]. (Note that other environment variables associated with DynamoDB
65-
in the code are unstable; they may be removed or their behavior may change in
66-
the future.)
64+
in the code are unstable, and are subject to removal or behavior changes.)
6765

6866
[AWS vars]: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
6967

@@ -72,7 +70,7 @@ the future.)
7270
Firestore is Google's fully managed document database. This mode is especially
7371
useful to run `randomizer-server` on [Cloud Run][Cloud Run], with a level of
7472
operational ease comparable to the AWS Lambda solution (though the randomizer
75-
does not provide infrastructure-as-code for it out of the box).
73+
doesn't include infrastructure-as-code for it out of the box).
7674

7775
The Firestore backend requires a pre-existing database in a Google Cloud
7876
project (only Native mode has been tested, but Datastore mode may work too).
@@ -83,7 +81,8 @@ free tier.
8381
To activate the Firestore backend, set both of the following variables:
8482

8583
- `FIRESTORE_PROJECT_ID`: The ID (not name) of your Google Cloud project.
86-
- `FIRESTORE_DATABASE_ID`: The ID of the database to use (e.g. "(default)").
84+
- `FIRESTORE_DATABASE_ID`: The ID of the database to use (for example,
85+
"(default)").
8786

8887
You may also need to configure [Application Default Credentials][ADC] for the
8988
Google Cloud SDK.

0 commit comments

Comments
 (0)