|
| 1 | +# Infrastructure |
| 2 | + |
| 3 | +This directory contains Terraform configurations for deploying agent-eval-harness to various cloud providers. |
| 4 | + |
| 5 | +## Directory Structure |
| 6 | + |
| 7 | +``` |
| 8 | +infra/ |
| 9 | +├── modules/ # Reusable Terraform modules |
| 10 | +│ ├── aws-ecs/ # AWS ECS Fargate compute |
| 11 | +│ ├── aws-rds/ # AWS RDS PostgreSQL database |
| 12 | +│ ├── aws-redis/ # AWS ElastiCache Redis |
| 13 | +│ ├── aws-s3/ # AWS S3 storage |
| 14 | +│ ├── aws-secrets/ # AWS Secrets Manager |
| 15 | +│ ├── azure-container-apps/ # Azure Container Apps |
| 16 | +│ ├── cloud-run/ # GCP Cloud Run |
| 17 | +│ ├── netlify/ # Netlify deployment |
| 18 | +│ ├── oci-oke/ # Oracle Container Engine (OKE) |
| 19 | +│ └── vercel/ # Vercel deployment |
| 20 | +└── environments/ # Environment-specific configurations |
| 21 | + ├── aws/ # AWS deployment |
| 22 | + ├── azure/ # Azure deployment |
| 23 | + ├── dev/ # GCP development |
| 24 | + ├── netlify/ # Netlify deployment |
| 25 | + ├── oci/ # Oracle Cloud deployment |
| 26 | + ├── prod/ # GCP production |
| 27 | + └── vercel/ # Vercel deployment |
| 28 | +``` |
| 29 | + |
| 30 | +## Supported Platforms |
| 31 | + |
| 32 | +| Platform | Compute | Database | Cache | Storage | Status | |
| 33 | +|----------|---------|----------|-------|---------|--------| |
| 34 | +| **AWS** | ECS Fargate | RDS PostgreSQL | ElastiCache Redis | S3 | ✅ Complete | |
| 35 | +| **Azure** | Container Apps | PostgreSQL | Redis Cache | Blob Storage | ✅ Complete | |
| 36 | +| **GCP** | Cloud Run | Cloud SQL | Memorystore | Cloud Storage | ✅ Complete | |
| 37 | +| **OCI** | OKE (Kubernetes) | Autonomous DB | Redis | Object Storage | ✅ Complete | |
| 38 | +| **Netlify** | Serverless Functions | External | External | External | ✅ Complete | |
| 39 | +| **Vercel** | Serverless Functions | External | External | External | ✅ Complete | |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## AWS Deployment |
| 44 | + |
| 45 | +### Prerequisites |
| 46 | + |
| 47 | +- AWS CLI configured with appropriate credentials |
| 48 | +- Terraform >= 1.0 |
| 49 | +- A VPC with private and public subnets |
| 50 | +- Docker image built and pushed to ECR or public registry |
| 51 | + |
| 52 | +### Quick Start |
| 53 | + |
| 54 | +1. Navigate to the AWS environment: |
| 55 | + ```bash |
| 56 | + cd environments/aws |
| 57 | + ``` |
| 58 | + |
| 59 | +2. Copy and configure the terraform.tfvars file: |
| 60 | + ```bash |
| 61 | + cp terraform.tfvars.example terraform.tfvars |
| 62 | + # Edit terraform.tfvars with your values |
| 63 | + ``` |
| 64 | + |
| 65 | +3. Required variables: |
| 66 | + - `vpc_id` - ID of your VPC |
| 67 | + - `image_url` - Docker image URL |
| 68 | + - `db_password` - Secure password for the database |
| 69 | + |
| 70 | +4. Initialize and deploy: |
| 71 | + ```bash |
| 72 | + terraform init |
| 73 | + terraform plan |
| 74 | + terraform apply |
| 75 | + ``` |
| 76 | + |
| 77 | +### Architecture |
| 78 | + |
| 79 | +``` |
| 80 | +┌─────────────────────────────────────────────────────────────┐ |
| 81 | +│ VPC │ |
| 82 | +│ ┌─────────────────────────────────────────────────────┐ │ |
| 83 | +│ │ Private Subnets │ │ |
| 84 | +│ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ │ │ |
| 85 | +│ │ │ RDS │ │ Redis │ │ ECS │ │ │ |
| 86 | +│ │ │ PostgreSQL│ │ElastiCache│ │ Fargate │ │ │ |
| 87 | +│ │ └───────────┘ └───────────┘ └───────────┘ │ │ |
| 88 | +│ │ │ │ │ |
| 89 | +│ │ ┌───────────┐ │ │ │ |
| 90 | +│ │ │ S3 │◄─────────────────────────┘ │ │ |
| 91 | +│ │ └───────────┘ │ │ |
| 92 | +│ └─────────────────────────────────────────────────────┘ │ |
| 93 | +│ ┌─────────────────────────────────────────────────────┐ │ |
| 94 | +│ │ Secrets Manager │ │ |
| 95 | +│ └─────────────────────────────────────────────────────┘ │ |
| 96 | +└─────────────────────────────────────────────────────────────┘ |
| 97 | +``` |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## Azure Deployment |
| 102 | + |
| 103 | +### Prerequisites |
| 104 | + |
| 105 | +- Azure CLI configured with appropriate credentials |
| 106 | +- Terraform >= 1.0 |
| 107 | +- Docker image pushed to Azure Container Registry |
| 108 | + |
| 109 | +### Quick Start |
| 110 | + |
| 111 | +1. Navigate to the Azure environment: |
| 112 | + ```bash |
| 113 | + cd environments/azure |
| 114 | + ``` |
| 115 | + |
| 116 | +2. Configure terraform.tfvars: |
| 117 | + - `resource_group_name` - Name of resource group |
| 118 | + - `location` - Azure region |
| 119 | + - `image_url` - ACR image URL |
| 120 | + - `db_admin_username` - PostgreSQL admin |
| 121 | + - `db_admin_password` - PostgreSQL password |
| 122 | + |
| 123 | +3. Initialize and deploy: |
| 124 | + ```bash |
| 125 | + terraform init |
| 126 | + terraform plan |
| 127 | + terraform apply |
| 128 | + ``` |
| 129 | + |
| 130 | +### Architecture |
| 131 | + |
| 132 | +- **Compute**: Azure Container Apps with auto-scaling |
| 133 | +- **Database**: Azure Database for PostgreSQL |
| 134 | +- **Cache**: Azure Cache for Redis |
| 135 | +- **Storage**: Azure Blob Storage |
| 136 | +- **Monitoring**: Application Insights + Log Analytics |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## GCP Deployment |
| 141 | + |
| 142 | +### Prerequisites |
| 143 | + |
| 144 | +- GCP CLI (gcloud) configured |
| 145 | +- Terraform >= 1.0 |
| 146 | +- Docker image pushed to GCR or Artifact Registry |
| 147 | + |
| 148 | +### Quick Start |
| 149 | + |
| 150 | +1. Navigate to the GCP environment: |
| 151 | + ```bash |
| 152 | + cd environments/dev # or environments/prod |
| 153 | + ``` |
| 154 | + |
| 155 | +2. Configure terraform.tfvars: |
| 156 | + - `project_id` - GCP project ID |
| 157 | + - `region` - GCP region |
| 158 | + - `image_url` - Container image URL |
| 159 | + |
| 160 | +3. Initialize and deploy: |
| 161 | + ```bash |
| 162 | + terraform init |
| 163 | + terraform plan |
| 164 | + terraform apply |
| 165 | + ``` |
| 166 | + |
| 167 | +### Architecture |
| 168 | + |
| 169 | +- **Compute**: Cloud Run (serverless containers) |
| 170 | +- **Secrets**: Secret Manager |
| 171 | +- **Storage**: Cloud Storage |
| 172 | +- **Monitoring**: Cloud Monitoring + Cloud Trace |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +## OCI Deployment |
| 177 | + |
| 178 | +### Prerequisites |
| 179 | + |
| 180 | +- OCI CLI configured with API signing keys |
| 181 | +- Terraform >= 1.0 |
| 182 | +- Docker image pushed to OCI Registry |
| 183 | + |
| 184 | +### Quick Start |
| 185 | + |
| 186 | +1. Navigate to the OCI environment: |
| 187 | + ```bash |
| 188 | + cd environments/oci |
| 189 | + ``` |
| 190 | + |
| 191 | +2. Configure terraform.tfvars: |
| 192 | + - `compartment_id` - OCI compartment |
| 193 | + - `region` - OCI region |
| 194 | + - `tenancy_ocid`, `user_ocid`, `fingerprint` - API credentials |
| 195 | + - `image_url` - Container image URL |
| 196 | + |
| 197 | +3. Initialize and deploy: |
| 198 | + ```bash |
| 199 | + terraform init |
| 200 | + terraform plan |
| 201 | + terraform apply |
| 202 | + ``` |
| 203 | + |
| 204 | +### Architecture |
| 205 | + |
| 206 | +- **Compute**: Oracle Container Engine for Kubernetes (OKE) |
| 207 | +- **Network**: VCN with public/private subnets |
| 208 | +- **Storage**: Object Storage |
| 209 | +- **Monitoring**: OCI Monitoring + Logging |
| 210 | + |
| 211 | +--- |
| 212 | + |
| 213 | +## Netlify Deployment |
| 214 | + |
| 215 | +### Prerequisites |
| 216 | + |
| 217 | +- Netlify account with API token |
| 218 | +- Terraform >= 1.0 |
| 219 | +- Frontend build artifacts |
| 220 | + |
| 221 | +### Quick Start |
| 222 | + |
| 223 | +1. Navigate to the Netlify environment: |
| 224 | + ```bash |
| 225 | + cd environments/netlify |
| 226 | + ``` |
| 227 | + |
| 228 | +2. Configure terraform.tfvars: |
| 229 | + - `netlify_token` - Netlify API token |
| 230 | + - `site_name` - Site name |
| 231 | + - `account_slug` - Account slug |
| 232 | + |
| 233 | +3. Initialize and deploy: |
| 234 | + ```bash |
| 235 | + terraform init |
| 236 | + terraform plan |
| 237 | + terraform apply |
| 238 | + ``` |
| 239 | + |
| 240 | +### Features |
| 241 | + |
| 242 | +- Automatic HTTPS |
| 243 | +- CDN distribution |
| 244 | +- Serverless functions |
| 245 | +- Preview deployments |
| 246 | +- Custom headers and redirects |
| 247 | + |
| 248 | +--- |
| 249 | + |
| 250 | +## Vercel Deployment |
| 251 | + |
| 252 | +### Prerequisites |
| 253 | + |
| 254 | +- Vercel account with API token |
| 255 | +- Terraform >= 1.0 |
| 256 | +- GitHub repository connected to Vercel |
| 257 | + |
| 258 | +### Quick Start |
| 259 | + |
| 260 | +1. Navigate to the Vercel environment: |
| 261 | + ```bash |
| 262 | + cd environments/vercel |
| 263 | + ``` |
| 264 | + |
| 265 | +2. Configure terraform.tfvars: |
| 266 | + - `vercel_token` - Vercel API token |
| 267 | + - `project_name` - Project name |
| 268 | + - `repo` - GitHub repository (owner/repo) |
| 269 | + |
| 270 | +3. Initialize and deploy: |
| 271 | + ```bash |
| 272 | + terraform init |
| 273 | + terraform plan |
| 274 | + terraform apply |
| 275 | + ``` |
| 276 | + |
| 277 | +### Features |
| 278 | + |
| 279 | +- Automatic preview deployments for PRs |
| 280 | +- Edge functions |
| 281 | +- Serverless functions |
| 282 | +- Custom domains |
| 283 | +- Analytics integration |
| 284 | + |
| 285 | +--- |
| 286 | + |
| 287 | +## Development |
| 288 | + |
| 289 | +### Running Locally |
| 290 | + |
| 291 | +For local development, use Docker Compose: |
| 292 | + |
| 293 | +```bash |
| 294 | +cd ../.. # Project root |
| 295 | +docker-compose up |
| 296 | +``` |
| 297 | + |
| 298 | +### Module Development |
| 299 | + |
| 300 | +When creating new modules: |
| 301 | + |
| 302 | +1. Create directory: `modules/<provider>-<service>/` |
| 303 | +2. Add `main.tf`, `variables.tf`, `outputs.tf` |
| 304 | +3. Follow naming conventions |
| 305 | +4. Document all variables and outputs |
| 306 | + |
| 307 | +### Testing Changes |
| 308 | + |
| 309 | +1. Run `terraform fmt -recursive` to format all files |
| 310 | +2. Run `terraform validate` in each environment |
| 311 | +3. Run `terraform plan` to preview changes |
| 312 | +4. Test in dev environment first |
| 313 | + |
| 314 | +--- |
| 315 | + |
| 316 | +## Troubleshooting |
| 317 | + |
| 318 | +### Common Issues |
| 319 | + |
| 320 | +1. **VPC Subnet Discovery (AWS)**: Ensure your VPC has subnets tagged appropriately |
| 321 | +2. **Image Pull Errors**: Verify the image URL is accessible from your account |
| 322 | +3. **Database Connection**: Check security group rules and network connectivity |
| 323 | +4. **Permissions**: Ensure your credentials have sufficient permissions |
| 324 | + |
| 325 | +### Getting Help |
| 326 | + |
| 327 | +- Check the specific environment's README for detailed documentation |
| 328 | +- Review the module's variables.tf for configuration options |
| 329 | +- Check CloudWatch/Cloud Monitoring logs for runtime issues |
0 commit comments