|
9 | 9 | - [Local Development Tools](#local-development-tools) |
10 | 10 | - [Production Deployment](#production-deployment) |
11 | 11 | - [Configuration](#configuration) |
| 12 | +- [S3 Upload (optional)](#s3-upload-optional) |
12 | 13 | - [Simulator](#simulator) |
13 | 14 | - [Troubleshooting](#troubleshooting) |
14 | 15 |
|
@@ -242,6 +243,65 @@ The `.env` file holds only infrastructure and connection settings: |
242 | 243 |
|
243 | 244 | --- |
244 | 245 |
|
| 246 | +## S3 Upload (optional) |
| 247 | + |
| 248 | +Recordings can be uploaded to Amazon S3 (or any S3-compatible endpoint). The feature stays disabled until both `S3_BUCKET` and `S3_KEY_TEMPLATE` are set in `.env`. |
| 249 | + |
| 250 | +| Variable | Required | Description | |
| 251 | +|------|------|------| |
| 252 | +| `S3_BUCKET` | yes | Destination bucket name | |
| 253 | +| `S3_KEY_TEMPLATE` | yes | Object-key template. Supports `{recording_name}` and `{yyyymmddhhmmss}` placeholders | |
| 254 | +| `AWS_REGION` | yes\* | AWS region | |
| 255 | +| `AWS_ACCESS_KEY_ID` | \*\* | Access key (env-var auth) | |
| 256 | +| `AWS_SECRET_ACCESS_KEY` | \*\* | Secret key (env-var auth) | |
| 257 | +| `AWS_PROFILE` | \*\* | Named profile (profile auth; mutually exclusive with the access-key pair) | |
| 258 | +| `AWS_ENDPOINT_URL` | no | Custom S3 endpoint (MinIO / R2 / LocalStack) | |
| 259 | +| `S3_MULTIPART_THRESHOLD_MB` | no | `boto3` TransferConfig override (default 8 MB) | |
| 260 | +| `S3_MULTIPART_CHUNKSIZE_MB` | no | `boto3` TransferConfig override (default 8 MB) | |
| 261 | +| `S3_MAX_CONCURRENCY` | no | `boto3` TransferConfig override (default 10) | |
| 262 | + |
| 263 | +\* `AWS_REGION` may be resolved from the profile when using `AWS_PROFILE`. |
| 264 | +\*\* Exactly one of the two auth paths (env-var keys **or** profile) must be configured. |
| 265 | + |
| 266 | +Example `.env` snippet (env-var auth): |
| 267 | + |
| 268 | +```env |
| 269 | +S3_BUCKET=lutra-recordings |
| 270 | +S3_KEY_TEMPLATE=lutra-recordings/operation-files/{yyyymmddhhmmss}/{recording_name}.zip |
| 271 | +AWS_REGION=ap-northeast-1 |
| 272 | +AWS_ACCESS_KEY_ID=... |
| 273 | +AWS_SECRET_ACCESS_KEY=... |
| 274 | +``` |
| 275 | + |
| 276 | +### Local Testing with MinIO |
| 277 | + |
| 278 | +A `pgsty/minio` container is wired into `docker-compose.yml` behind the `s3` profile so the upload feature can be tested without touching real AWS. A one-shot `minio-init` container auto-creates the bucket on startup. |
| 279 | + |
| 280 | +```bash |
| 281 | +make minio-up # Start MinIO + create the bucket defined by S3_BUCKET |
| 282 | +make minio-down # Stop MinIO |
| 283 | +``` |
| 284 | + |
| 285 | +| Endpoint | URL | Default credentials | |
| 286 | +|---|---|---| |
| 287 | +| S3 API | http://localhost:9000 | `minioadmin` / `minioadmin` | |
| 288 | +| Web console | http://localhost:9001 | `minioadmin` / `minioadmin` | |
| 289 | + |
| 290 | +`.env` snippet to point the backend at the local MinIO (used alongside `make up`): |
| 291 | + |
| 292 | +```env |
| 293 | +S3_BUCKET=lutra-recordings |
| 294 | +S3_KEY_TEMPLATE=lutra-recordings/operation-files/{yyyymmddhhmmss}/{recording_name}.zip |
| 295 | +AWS_REGION=us-east-1 |
| 296 | +AWS_ACCESS_KEY_ID=minioadmin |
| 297 | +AWS_SECRET_ACCESS_KEY=minioadmin |
| 298 | +AWS_ENDPOINT_URL=http://minio:9000 |
| 299 | +``` |
| 300 | + |
| 301 | +The backend reaches MinIO via the compose-internal hostname `minio:9000`. From the host (browser, `aws s3` CLI), use `http://localhost:9000` instead. The bucket name and the root credentials are configurable via `S3_BUCKET`, `MINIO_ROOT_USER`, and `MINIO_ROOT_PASSWORD` in `.env`. |
| 302 | + |
| 303 | +--- |
| 304 | + |
245 | 305 | ## Simulator |
246 | 306 |
|
247 | 307 | In the development environment, the simulator publishes dummy data in place of a real robot. |
|
0 commit comments