|
| 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>` |
0 commit comments