Skip to content

Commit

Permalink
docs(examples): Simplified Terraform Deployments (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
jshlbrd authored Apr 9, 2024
1 parent 62f6bbd commit 42677df
Show file tree
Hide file tree
Showing 49 changed files with 240 additions and 370 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ examples
.gitignore
.golangci.yml
CODEOWNERS
LICENSE
Makefile
**/*.md
212 changes: 0 additions & 212 deletions Makefile

This file was deleted.

42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,43 @@ You can run Substation on these platforms:
- [macOS / Linux](https://substation.readme.io/v1.0.0/docs/try-substation-on-macos-linux)
- [AWS](https://substation.readme.io/v1.0.0/docs/try-substation-on-aws)

The project includes a Makefile that simplifies local development and test deployments. To test the system in AWS, run this from the project root:
### Development

[VS Code](https://code.visualstudio.com/docs/devcontainers/containers) is the recommended development environment for Substation. The project includes a [development container](.devcontainer/Dockerfile) that can be used to develop and test the system. Refer to the [development guide](CONTRIBUTING.md) for more information.

### Testing

The development container can be used to test the system locally and in the cloud. If you're not using VS Code, then you should run the development container from the command line:

```sh
git clone https://github.com/brexhq/substation.git && cd substation && \
docker build -t substation-dev .devcontainer/ && \
docker run -v $(pwd):/workspaces/substation/ -w /workspaces/substation -v /var/run/docker.sock:/var/run/docker.sock -it substation-dev
```

To try the system locally, run this from the [examples](examples) directory:
```sh
# Checks that dependencies are installed and environment variables are set.
make check
# Deploys Substation to AWS. This deploys the Kinesis Time Travel example
# and writes data to the Kinesis stream.
make test-aws
git config --global --add safe.directory /workspaces/substation && \
cd examples && \
make -s quickstart
```

The [AWS examples](examples/terraform/aws) folder contains reusable deployment patterns that demonstrate best practices for managing the system using [Terraform](https://www.terraform.io/) and [Jsonnet](https://jsonnet.org/). Deploy them using these commands:
To try the system in the cloud, choose an [AWS example](examples/terraform/aws) to deploy:
```sh
git config --global --add safe.directory /workspaces/substation && \
cd examples && \
aws configure && \
make -s check && \
make -s build && \
make -s deploy EXAMPLE=terraform/aws/dynamodb/cdc
```

After testing is complete, the cloud deployment should be destroyed:
```sh
make check
# Builds dependencies required for AWS deployments.
make build-aws
# Deploys the DynamoDB Change Data Capture example.
make deploy-aws DEPLOYMENT_DIR=examples/terraform/aws/dynamodb/cdc AWS_APPCONFIG_ENV=example
make -s destroy EXAMPLE=terraform/aws/dynamodb/cdc
```

**We do not recommend managing cloud deployments from a local machine using the Makefile. Production deployments should use a CI/CD pipeline with a remote state backend to manage infrastructure.**
**We do not recommend managing cloud deployments from a local machine using the examples Makefile. Production deployments should use a CI/CD pipeline with a remote state backend to manage infrastructure.**

## Transforming Event Logs

Expand Down
5 changes: 2 additions & 3 deletions build/scripts/aws/lambda/get_appconfig_extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ else
exit 1
fi

aws lambda get-layer-version-by-arn \
--region $AWS_REGION --arn $AWS_ARN \
aws lambda get-layer-version-by-arn --region $AWS_REGION --arn $AWS_ARN --output json \
| jq -r '.Content.Location' \
| xargs curl -s -o $DIR/extension.zip
| xargs curl -s -o $DIR/extension.zip
3 changes: 2 additions & 1 deletion build/terraform/aws/cloudwatch/destination/_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ variable "kms" {
arn = string
id = string
})
description = "KMS key used to encrypt the resources."
default = null
description = "KMS key used to encrypt the resources. This is not required if the config.destination_arn does not use customer-managed encryption."
}

variable "config" {
Expand Down
Loading

0 comments on commit 42677df

Please sign in to comment.