Skip to content

Commit 09db5e4

Browse files
authored
chore: AWS deployment for benchmarking (#376)
* build: EKS Terraform * build: Deployment scripts for Outpost & monitoring into AWS EKS * chore: Updated loadtest setup & tests * chore: Outpost config example * chore: Example AWS loadtest env config * build: Outpost Helm values for AWS EKS * chore: .gitignore * chore: k8s service port forwarding * docs: AWS infra docs
1 parent fa0b9ce commit 09db5e4

File tree

16 files changed

+1509
-34
lines changed

16 files changed

+1509
-34
lines changed

.air.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ tmp_dir = "tmp"
55
cmd = "go build -o tmp/main cmd/outpost/main.go"
66
bin = "tmp/main"
77
delay = 100
8-
exclude_dir = ["examples", "dist", "docs", "website", "internal/portal/node_modules", "internal/portal/src"]
8+
exclude_dir = ["examples", "dist", "docs", "website", "loadtest", "internal/portal/node_modules", "internal/portal/src"]
99
include_ext = ["go"]
1010
include_file = ["go.mod", "go.sum", ".env"]

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,21 @@
1010
# Golang test coverage
1111
/*.out
1212

13+
# Node.js
14+
node_modules
15+
16+
# Terraform
17+
.terraform/
18+
terraform.tfstate
19+
terraform.tfstate.*
20+
.terraform.tfstate.lock.info
21+
.terraform.lock.hcl
22+
*.tf.backup
23+
1324
# Misc
1425
.DS_Store
26+
*.log
27+
cmd/dev
28+
.bruno/
29+
.cursor/
30+
.ai/

.outpost.yaml.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ destinations:
8989
# disable_default_signature_header
9090
# disable_default_timestamp_header
9191
# disable_default_topic_header
92-
# signature_content_template: {{.Timestamp.Unix}}.{{.Body}}
93-
# signature_header_template: t={{.Timestamp.Unix}},v0={{.Signatures | join ","}}
92+
# signature_content_template: {{.Timestamp.UnixMilli}}.{{.Body}}
93+
# signature_header_template: t={{.Timestamp.UnixMilli}},v0={{.Signatures | join ","}}
9494
# signature_encoding: hex
9595
# signature_algorithm: hmac-sha256
9696

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "local",
3+
"api": {
4+
"baseUrl": "<URL>",
5+
"timeout": "30s"
6+
},
7+
"mockWebhook": {
8+
"url": "<URL>",
9+
"destinationUrl": "<URL>",
10+
"verificationPollTimeout": "5s"
11+
},
12+
"redis": "redis://localhost:46379"
13+
}

loadtest/docs/infra-aws.md

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
# AWS Infrastructure for Outpost Load Testing
2+
3+
## Overview
4+
5+
This guide helps set up a complete AWS infrastructure for load testing Outpost. We'll deploy a managed Kubernetes cluster with database and caching services.
6+
7+
Components:
8+
- Amazon EKS: Managed Kubernetes cluster to run Outpost services
9+
- Amazon RDS: PostgreSQL database for persistent storage
10+
- Amazon ElastiCache: Redis instance for caching and queues
11+
- Kubernetes add-ons: Dashboard, Prometheus, Grafana for monitoring
12+
13+
## Steps
14+
15+
### 1. Configure AWS CLI
16+
17+
Set up your AWS credentials with the `outpost-loadtest` profile:
18+
19+
```sh
20+
aws configure --profile outpost-loadtest
21+
```
22+
23+
All Terraform configurations and scripts in this repository assume the use of this specific profile. Make sure your credentials have sufficient permissions to create EKS clusters, RDS instances, and other AWS resources.
24+
25+
### 2. Run Terraform
26+
27+
Navigate to the terraform directory and initialize the Terraform modules:
28+
29+
```sh
30+
cd loadtest/infra/aws/terraform
31+
terraform init
32+
```
33+
34+
Then apply the configuration to create all AWS resources:
35+
36+
```sh
37+
terraform apply
38+
```
39+
40+
This will provision:
41+
- EKS cluster with worker nodes
42+
- RDS PostgreSQL instance
43+
- ElastiCache Redis cluster
44+
- Kubernetes Dashboard
45+
- Required networking components (VPC, subnets, security groups)
46+
47+
The process takes approximately 15-20 minutes to complete. You'll be prompted to confirm before resources are created.
48+
49+
### 3. Deploy Monitoring
50+
51+
After Terraform has successfully provisioned the infrastructure, deploy the monitoring stack:
52+
53+
```sh
54+
cd loadtest/infra/aws
55+
chmod +x scripts/deploy-monitoring.sh
56+
./scripts/deploy-monitoring.sh
57+
```
58+
59+
This script installs Prometheus and Grafana on the EKS cluster for comprehensive monitoring of Outpost performance and resource usage.
60+
61+
### 4. Deploy Outpost
62+
63+
Deploy the Outpost application using the Helm chart:
64+
65+
```sh
66+
cd loadtest/infra/aws
67+
chmod +x scripts/deploy-outpost.sh
68+
./scripts/deploy-outpost.sh
69+
```
70+
71+
This script uses Helm to deploy Outpost with the configuration defined in `infra/aws/values/outpost/values.yaml`. The values file contains settings for image repository, resource limits, environment variables, and service configuration.
72+
73+
You can customize the deployment by modifying the values file before running the script.
74+
75+
### 5. Confirm Setup
76+
77+
#### 5.1 Access Kubernetes Dashboard
78+
79+
Access the Kubernetes Dashboard by port-forwarding to your local machine:
80+
81+
```sh
82+
kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8443:443
83+
```
84+
85+
Then open in your browser:
86+
- URL: https://localhost:8443
87+
88+
Generate a token for dashboard authentication:
89+
90+
```sh
91+
kubectl -n kubernetes-dashboard create token admin-user
92+
```
93+
94+
#### 5.2 Access Grafana
95+
96+
Get the Grafana URL:
97+
98+
```sh
99+
kubectl get svc -n monitoring monitoring-grafana -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
100+
```
101+
102+
Grafana credentials:
103+
- Username: admin
104+
- Password: prom-operator
105+
106+
#### 5.3 Verify Outpost
107+
108+
Get the Outpost API URL:
109+
110+
```sh
111+
export API_URL=$(kubectl get svc -n outpost-loadtest-1 outpost -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
112+
echo $API_URL
113+
```
114+
115+
Get the API key:
116+
117+
```sh
118+
export API_KEY=$(kubectl get secret -n outpost-loadtest-1 outpost-secrets -o jsonpath='{.data.API_KEY}' | base64 --decode)
119+
echo $API_KEY
120+
```
121+
122+
Check the health endpoint:
123+
124+
```sh
125+
curl $API_URL/api/v1/healthz
126+
```
127+
128+
A successful health check will return a positive response indicating that Outpost is up and running correctly.
129+
130+
#### 5.4 Create New Tenant
131+
132+
Once Outpost is running, you can create a new tenant with:
133+
134+
```sh
135+
curl -v --location --request PUT "$API_URL/api/v1/123" \
136+
--header "Authorization: Bearer $API_KEY"
137+
```
138+
139+
This creates a tenant with ID `123` which can be used for testing.
140+
141+
## Other Configuration
142+
143+
### Outpost Release / Customize Environment
144+
145+
You can customize the Outpost deployment by modifying the values in `loadtest/infra/aws/values/outpost/values.yaml`:
146+
147+
- Change resource limits and requests
148+
- Adjust replica counts for services
149+
- Modify environment variables
150+
- Configure LoadBalancer settings
151+
- Customize Outpost configuration (publish/delivery concurrency, retry limits, etc.)
152+
153+
After making changes to the values file, redeploy Outpost using the following command:
154+
155+
```sh
156+
cd loadtest/infra/aws
157+
helm upgrade --install outpost ../../../deployments/kubernetes/charts/outpost \
158+
--namespace outpost-loadtest-1 \
159+
-f ./values/outpost/values.yaml
160+
```
161+
162+
For configuration or environment variable changes without image updates, you'll need to manually restart the deployments:
163+
164+
```sh
165+
kubectl rollout restart deployment -n outpost-loadtest-1
166+
```
167+
168+
Note: This manual restart will be handled in future versions of the Helm chart, but is required for now.
169+
170+
### Custom Image / ECR
171+
172+
For testing with custom builds, you can use your own Docker image instead of the public Hookdeck image:
173+
174+
#### 1. Build the Docker image
175+
176+
Build your Outpost image (example using goreleaser):
177+
178+
```sh
179+
goreleaser release -f ./build/.goreleaser.yaml --snapshot --clean
180+
```
181+
182+
This should create an image tagged as `hookdeck/outpost:latest-amd64`.
183+
184+
#### 2. Create an ECR repository
185+
186+
```sh
187+
aws ecr create-repository --repository-name outpost --profile outpost-loadtest
188+
```
189+
190+
#### 3. Tag and push the image to ECR
191+
192+
First, authenticate to ECR:
193+
194+
```sh
195+
aws ecr get-login-password --profile outpost-loadtest | docker login --username AWS --password-stdin $(aws sts get-caller-identity --profile outpost-loadtest --query Account --output text).dkr.ecr.$(aws configure get region --profile outpost-loadtest).amazonaws.com
196+
```
197+
198+
Then, tag and push the image:
199+
200+
```sh
201+
ACCOUNT_ID=$(aws sts get-caller-identity --profile outpost-loadtest --query Account --output text)
202+
REGION=$(aws configure get region --profile outpost-loadtest)
203+
ECR_URI=${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/outpost
204+
205+
docker tag hookdeck/outpost:latest-amd64 ${ECR_URI}:latest
206+
docker push ${ECR_URI}:latest
207+
```
208+
209+
#### 4. Update the Helm values
210+
211+
Get the full ECR URI for your values file:
212+
213+
```sh
214+
echo "ECR URI: ${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/outpost"
215+
```
216+
217+
Update the image repository and tag in `loadtest/infra/aws/values/outpost/values.yaml`:
218+
219+
```yaml
220+
outpost:
221+
image:
222+
repository: 442042537672.dkr.ecr.us-east-1.amazonaws.com/outpost # Replace with your ECR URI
223+
tag: latest
224+
```
225+
226+
Then deploy a new Outpost release following the instructions in [Outpost Release / Customize Environment](#outpost-release--customize-environment).
227+
228+
## Cleanup
229+
230+
To remove all resources:
231+
232+
```sh
233+
cd loadtest/infra/aws
234+
chmod +x scripts/cleanup.sh
235+
./scripts/cleanup.sh
236+
```
237+
238+
This will:
239+
1. Remove all Kubernetes resources (Outpost and monitoring)
240+
2. Optionally destroy AWS infrastructure with Terraform
241+
242+
## Troubleshooting
243+
244+
If you encounter issues during deployment or operation, try these troubleshooting steps:
245+
246+
- Check EKS cluster status: `aws eks describe-cluster --name outpost-loadtest --profile outpost-loadtest`
247+
- Check Kubernetes pods: `kubectl get pods -A`
248+
- Check Helm releases: `helm list -A`
249+
- View pod logs: `kubectl logs -n outpost-loadtest-1 <pod-name>`
250+
- Describe failing pods: `kubectl describe pod -n outpost-loadtest-1 <pod-name>`

loadtest/docs/loadtest.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ export API_KEY=your_api_key_here
104104
export TESTID=$(date +%s)
105105
106106
# Run the throughput test
107-
API_KEY=$API_KEY TESTID=$TESTID ./run-test.sh events-throughput
107+
API_KEY=$API_KEY TESTID=$TESTID ./run-test.sh events-throughput --environment local
108108
109109
# Run the verification test
110-
API_KEY=$API_KEY TESTID=$TESTID MAX_ITERATIONS=1000 ./run-test.sh events-verify
110+
API_KEY=$API_KEY TESTID=$TESTID MAX_ITERATIONS=1000 ./run-test.sh events-verify --environment local
111111
```
112112

113113
The `TESTID` variable is used to correlate the tests, allowing the verification test to check the results of a specific throughput test run.

0 commit comments

Comments
 (0)