mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-09-30 08:53:15 +00:00
Clean up oss-index-creator: remove debug logging, update docs
- Remove verbose print statements from Lambda handler - Add dependabot pip entry for oss-index-creator - Update README with new Lambda and deployed stack state
This commit is contained in:
parent
7df81b4427
commit
ef8a3b5f48
3 changed files with 11 additions and 21 deletions
7
.github/dependabot.yml
vendored
7
.github/dependabot.yml
vendored
|
|
@ -56,6 +56,13 @@ updates:
|
||||||
open-pull-requests-limit: 3
|
open-pull-requests-limit: 3
|
||||||
|
|
||||||
|
|
||||||
|
- package-ecosystem: pip
|
||||||
|
directory: /lambdas/oss-index-creator
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
open-pull-requests-limit: 3
|
||||||
|
|
||||||
|
|
||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: /
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Monorepo with five primary services:
|
||||||
- **.NET 8 API** -- Clean Architecture REST API hosted on Lambda behind API Gateway
|
- **.NET 8 API** -- Clean Architecture REST API hosted on Lambda behind API Gateway
|
||||||
- **React 19 Web** -- MUI v7 admin/dispatcher workspace served via CloudFront + S3
|
- **React 19 Web** -- MUI v7 admin/dispatcher workspace served via CloudFront + S3
|
||||||
- **React Native Mobile** -- iOS-first field app for dispatchers (offline-capable)
|
- **React Native Mobile** -- iOS-first field app for dispatchers (offline-capable)
|
||||||
- **Python Lambdas** -- PDF extraction, PDF generation, library ingestion, AI suggestions
|
- **Python Lambdas** -- PDF extraction, PDF generation, library ingestion, AI suggestions, AOSS index provisioning
|
||||||
- **CDK Infrastructure** -- Three TypeScript stacks managing all AWS resources
|
- **CDK Infrastructure** -- Three TypeScript stacks managing all AWS resources
|
||||||
|
|
||||||
## Repository Structure
|
## Repository Structure
|
||||||
|
|
@ -41,12 +41,12 @@ proposal-system/
|
||||||
|
|
||||||
## AWS Resources
|
## AWS Resources
|
||||||
|
|
||||||
All resources are in **us-east-1** (account 328440206208). CDK stacks are defined but not yet deployed to AWS.
|
All resources are in **us-east-1** (account 328440206208).
|
||||||
|
|
||||||
| CDK Stack | Key Resources |
|
| CDK Stack | Key Resources |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `proposal-system-foundation` | RDS PostgreSQL 15 (t4g.small), S3 buckets, SQS queue + DLQ, Cognito user pool, Secrets Manager |
|
| `proposal-system-foundation` | RDS PostgreSQL 15 (t4g.small), S3 buckets, SQS queue + DLQ, Cognito user pool, Secrets Manager |
|
||||||
| `proposal-system-compute` | API Gateway HTTP API, .NET 8 API Lambda, Python Lambdas (pdf-extract, pdf-generate, library-ingest, suggestions), Bedrock KB |
|
| `proposal-system-compute` | API Gateway HTTP API, .NET 8 API Lambda, Python Lambdas (pdf-extract, pdf-generate, library-ingest, suggestions, oss-index-creator), OpenSearch Serverless collection, Bedrock KB |
|
||||||
| `proposal-system-frontend` | CloudFront distribution (S3 OAC) |
|
| `proposal-system-frontend` | CloudFront distribution (S3 OAC) |
|
||||||
|
|
||||||
| Resource Type | Names |
|
| Resource Type | Names |
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import json
|
|
||||||
import time
|
import time
|
||||||
import boto3
|
import boto3
|
||||||
from opensearchpy import OpenSearch, RequestsHttpConnection
|
from opensearchpy import OpenSearch, RequestsHttpConnection
|
||||||
|
|
@ -6,10 +5,7 @@ from requests_aws4auth import AWS4Auth
|
||||||
|
|
||||||
|
|
||||||
def handler(event, context):
|
def handler(event, context):
|
||||||
print(f"Event: {json.dumps(event, default=str)}")
|
|
||||||
|
|
||||||
if event["RequestType"] == "Delete":
|
if event["RequestType"] == "Delete":
|
||||||
print("Delete request, returning")
|
|
||||||
return {"PhysicalResourceId": event.get("PhysicalResourceId", "none")}
|
return {"PhysicalResourceId": event.get("PhysicalResourceId", "none")}
|
||||||
|
|
||||||
props = event["ResourceProperties"]
|
props = event["ResourceProperties"]
|
||||||
|
|
@ -19,13 +15,9 @@ def handler(event, context):
|
||||||
text_field = props["TextField"]
|
text_field = props["TextField"]
|
||||||
metadata_field = props["MetadataField"]
|
metadata_field = props["MetadataField"]
|
||||||
|
|
||||||
print(f"Endpoint: {endpoint}")
|
|
||||||
print(f"Index: {index_name}")
|
|
||||||
|
|
||||||
session = boto3.Session()
|
session = boto3.Session()
|
||||||
credentials = session.get_credentials().get_frozen_credentials()
|
credentials = session.get_credentials().get_frozen_credentials()
|
||||||
region = session.region_name
|
region = session.region_name
|
||||||
print(f"Region: {region}")
|
|
||||||
|
|
||||||
awsauth = AWS4Auth(
|
awsauth = AWS4Auth(
|
||||||
credentials.access_key,
|
credentials.access_key,
|
||||||
|
|
@ -67,24 +59,15 @@ def handler(event, context):
|
||||||
|
|
||||||
for attempt in range(30):
|
for attempt in range(30):
|
||||||
try:
|
try:
|
||||||
print(f"Attempt {attempt}: creating index...")
|
client.indices.create(index=index_name, body=index_body)
|
||||||
response = client.indices.create(index=index_name, body=index_body)
|
|
||||||
print(f"Index created successfully: {response}")
|
|
||||||
# Verify the index exists
|
|
||||||
exists = client.indices.exists(index=index_name)
|
|
||||||
print(f"Index exists check: {exists}")
|
|
||||||
return {"PhysicalResourceId": index_name}
|
return {"PhysicalResourceId": index_name}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_str = str(e)
|
error_str = str(e)
|
||||||
print(f"Attempt {attempt} error: {error_str}")
|
|
||||||
if "resource_already_exists_exception" in error_str:
|
if "resource_already_exists_exception" in error_str:
|
||||||
print("Index already exists, returning success")
|
|
||||||
return {"PhysicalResourceId": index_name}
|
return {"PhysicalResourceId": index_name}
|
||||||
if "403" in error_str and attempt < 29:
|
if "403" in error_str and attempt < 29:
|
||||||
print(f"403 error, retrying in 10s (attempt {attempt}/29)")
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
continue
|
continue
|
||||||
print(f"Fatal error on attempt {attempt}: {error_str}")
|
|
||||||
raise
|
raise
|
||||||
|
|
||||||
raise Exception("Timeout waiting for AOSS access policy propagation")
|
raise Exception("Timeout waiting for AOSS access policy propagation")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue