This service simulates AWS S3 (Presigned POST and PutObject) and AWS CloudFront (CDN) for the Plant-DB system. It provides high-fidelity AWS parity to ensure the Django backend can transition to production without code changes while strictly decoupling storage from compute.
- S3 Presigned POST Parity: Handles
POST /{bucket}withmultipart/form-dataandx-amz-meta-*headers. - S3 PutObject Parity: Supports
PUT /{bucket}/{key}for direct worker write-backs. - Dumb Storage: No image processing, no internal webhooks, no compute dependencies.
- Multi-tenant Hierarchy: Strictly enforces
company_X/plant_Y/directory structures. - CloudFront Parity: Serves processed images via a simulated CDN structure.
POST /{bucket_name}
- Supports standard S3 metadata headers.
- Response:
201 Createdwith S3-standard XML payload.
PUT /{bucket_name}/{key:path}
- Used by the Image Worker to store processed variants.
- Authentication: Requires valid AWS SigV4 signatures (verified against
AWS_S3_SECRET_ACCESS_KEY). - Owner Verification: Optionally verifies
x-amz-expected-bucket-ownerheader ifAWS_ACCOUNT_IDis configured. - Enforces strict multi-tenant pathing.
GET /cdn/{path:path}: Access images in thes3_longterm/directory.
The service is a "Dumb Store," meaning it only provides storage and retrieval. All compute (resizing, processing) is handled by the external Image Worker.
- Emulates the S3 API Layer.
- Responsible for the initial
POSTlanding intos3_inbox/.
- Defines the AWS Physical Boundaries (S3 Buckets/Storage Tiers).
- Provides the entry mapping for static asset delivery via
s3_longterm. - Implements
PUTandGEThandlers for worker parity.
- Configure Environment: Ensure
PORTandBASE_URLare set in.env. - Start Service (Docker - Recommended):
./starter.sh start --build
- Storage Access:
- Raw Uploads (Inbox):
s3_inbox/ - Processed Photos (CDN):
s3_longterm/ - Public CDN URL:
http://localhost:8001/cdn/
- Raw Uploads (Inbox):
- Clear Storage:
docker compose exec mock-cdn find /app/s3_inbox /app/s3_longterm -mindepth 1 -delete - Security Scan:
./starter.sh scan - Archived Logic: Legacy image processing code is preserved in
archived_processors/for reference but is not used in the runtime.