This commit is contained in:
johnpccd 2025-05-24 23:31:39 +02:00
parent 6265ac534a
commit 87e330161b
3 changed files with 146 additions and 65 deletions

View File

@ -1,7 +1,7 @@
{
"version": 4,
"terraform_version": "1.10.1",
"serial": 367,
"serial": 369,
"lineage": "a183cd95-f987-8698-c6dd-84e933c394a5",
"outputs": {
"cloud_run_qdrant_host": {
@ -146,7 +146,7 @@
"goog-terraform-provisioned": "true"
},
"generation": 1,
"labels": null,
"labels": {},
"namespace": "gen-lang-client-0424120530",
"resource_version": "AAY16EtYS9U",
"self_link": "/apis/serving.knative.dev/v1/namespaces/761163285547/services/sereact",
@ -218,8 +218,8 @@
"container_concurrency": 80,
"containers": [
{
"args": null,
"command": null,
"args": [],
"command": [],
"env": [
{
"name": "FIRESTORE_DATABASE_NAME",
@ -294,7 +294,7 @@
"cpu": "1",
"memory": "1Gi"
},
"requests": null
"requests": {}
}
],
"startup_probe": [
@ -316,7 +316,7 @@
"working_dir": ""
}
],
"node_selector": null,
"node_selector": {},
"service_account_name": "761163285547-compute@developer.gserviceaccount.com",
"serving_state": "",
"timeout_seconds": 300,
@ -623,6 +623,12 @@
"zone": "us-central1-a"
},
"sensitive_attributes": [
[
{
"type": "get_attr",
"value": "metadata_startup_script"
}
],
[
{
"type": "get_attr",
@ -656,12 +662,6 @@
"type": "get_attr",
"value": "disk_encryption_key_rsa"
}
],
[
{
"type": "get_attr",
"value": "metadata_startup_script"
}
]
],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiNiJ9",
@ -690,7 +690,7 @@
"delete_protection_state": "DELETE_PROTECTION_DISABLED",
"deletion_policy": "ABANDON",
"earliest_version_time": "2025-05-24T21:09:24.677010Z",
"etag": "IMTG8tCEvY0DMJL7/oiCvY0D",
"etag": "IJCLh6eGvY0DMKrW4vCEvY0D",
"id": "projects/gen-lang-client-0424120530/databases/sereact-imagedb",
"key_prefix": "",
"location_id": "us-central1",

View File

@ -1,7 +1,7 @@
{
"version": 4,
"terraform_version": "1.10.1",
"serial": 363,
"serial": 368,
"lineage": "a183cd95-f987-8698-c6dd-84e933c394a5",
"outputs": {
"cloud_run_qdrant_host": {
@ -12,10 +12,35 @@
"value": "10.128.0.6",
"type": "string"
},
"cloud_run_url": {
"value": "https://sereact-p64zpdtkta-uc.a.run.app",
"type": "string"
},
"container_registry_url": {
"value": "gcr.io/gen-lang-client-0424120530/sereact",
"type": "string"
},
"deployment_summary": {
"value": {
"cloud_run_url": "https://sereact-p64zpdtkta-uc.a.run.app",
"firestore_database": "sereact-imagedb",
"qdrant_endpoint": "http://34.71.6.1:6333",
"qdrant_host_ip": "34.71.6.1",
"static_ip_enabled": false,
"storage_bucket": "sereact-images"
},
"type": [
"object",
{
"cloud_run_url": "string",
"firestore_database": "string",
"qdrant_endpoint": "string",
"qdrant_host_ip": "string",
"static_ip_enabled": "bool",
"storage_bucket": "string"
}
]
},
"firestore_database_id": {
"value": "projects/gen-lang-client-0424120530/databases/sereact-imagedb",
"type": "string"
@ -98,7 +123,6 @@
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]",
"instances": [
{
"status": "tainted",
"schema_version": 2,
"attributes": {
"autogenerate_revision_name": false,
@ -110,25 +134,67 @@
"run.googleapis.com/ingress": "all"
},
"effective_annotations": {
"run.googleapis.com/ingress": "all"
"run.googleapis.com/ingress": "all",
"run.googleapis.com/ingress-status": "all",
"run.googleapis.com/operation-id": "3653c984-38f6-42b8-b3c1-9a6814773095",
"run.googleapis.com/urls": "[\"https://sereact-761163285547.us-central1.run.app\",\"https://sereact-p64zpdtkta-uc.a.run.app\"]",
"serving.knative.dev/creator": "johnpccd3@gmail.com",
"serving.knative.dev/lastModifier": "johnpccd3@gmail.com"
},
"effective_labels": {
"cloud.googleapis.com/location": "us-central1",
"goog-terraform-provisioned": "true"
},
"generation": 0,
"labels": null,
"namespace": "",
"resource_version": "",
"self_link": "",
"generation": 1,
"labels": {},
"namespace": "gen-lang-client-0424120530",
"resource_version": "AAY16EtYS9U",
"self_link": "/apis/serving.knative.dev/v1/namespaces/761163285547/services/sereact",
"terraform_labels": {
"goog-terraform-provisioned": "true"
},
"uid": ""
"uid": "c67276c9-0c25-4a6c-8f39-4ea942599769"
}
],
"name": "sereact",
"project": "gen-lang-client-0424120530",
"status": null,
"status": [
{
"conditions": [
{
"message": "",
"reason": "",
"status": "True",
"type": "Ready"
},
{
"message": "",
"reason": "",
"status": "True",
"type": "ConfigurationsReady"
},
{
"message": "",
"reason": "",
"status": "True",
"type": "RoutesReady"
}
],
"latest_created_revision_name": "sereact-00001-hw9",
"latest_ready_revision_name": "sereact-00001-hw9",
"observed_generation": 1,
"traffic": [
{
"latest_revision": true,
"percent": 100,
"revision_name": "sereact-00001-hw9",
"tag": "",
"url": ""
}
],
"url": "https://sereact-p64zpdtkta-uc.a.run.app"
}
],
"template": [
{
"metadata": [
@ -137,7 +203,9 @@
"autoscaling.knative.dev/maxScale": "10"
},
"generation": 0,
"labels": {},
"labels": {
"run.googleapis.com/startupProbeType": "Default"
},
"name": "",
"namespace": "",
"resource_version": "",
@ -147,32 +215,12 @@
],
"spec": [
{
"container_concurrency": 0,
"container_concurrency": 80,
"containers": [
{
"args": null,
"command": null,
"args": [],
"command": [],
"env": [
{
"name": "CORS_EXPOSE_HEADERS",
"value": "Content-Length,Content-Range",
"value_from": []
},
{
"name": "CORS_HEADERS",
"value": "Content-Type,Authorization,X-Requested-With",
"value_from": []
},
{
"name": "CORS_MAX_AGE",
"value": "3600",
"value_from": []
},
{
"name": "CORS_METHODS",
"value": "GET,POST,PUT,DELETE,OPTIONS",
"value_from": []
},
{
"name": "FIRESTORE_DATABASE_NAME",
"value": "sereact-imagedb",
@ -236,7 +284,7 @@
"ports": [
{
"container_port": 8000,
"name": "",
"name": "http1",
"protocol": ""
}
],
@ -246,18 +294,32 @@
"cpu": "1",
"memory": "1Gi"
},
"requests": null
"requests": {}
}
],
"startup_probe": [
{
"failure_threshold": 1,
"grpc": [],
"http_get": [],
"initial_delay_seconds": 0,
"period_seconds": 240,
"tcp_socket": [
{
"port": 8000
}
],
"timeout_seconds": 240
}
],
"startup_probe": [],
"volume_mounts": [],
"working_dir": ""
}
],
"node_selector": null,
"service_account_name": "",
"node_selector": {},
"service_account_name": "761163285547-compute@developer.gserviceaccount.com",
"serving_state": "",
"timeout_seconds": 0,
"timeout_seconds": 300,
"volumes": []
}
]
@ -327,10 +389,33 @@
},
{
"mode": "managed",
"type": "google_compute_address",
"name": "vector_db_static_ip",
"type": "google_cloud_run_service_iam_member",
"name": "public_access",
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]",
"instances": []
"instances": [
{
"schema_version": 0,
"attributes": {
"condition": [],
"etag": "BwY16Etxb+g=",
"id": "v1/projects/gen-lang-client-0424120530/locations/us-central1/services/sereact/roles/run.invoker/allUsers",
"location": "us-central1",
"member": "allUsers",
"project": "gen-lang-client-0424120530",
"role": "roles/run.invoker",
"service": "v1/projects/gen-lang-client-0424120530/locations/us-central1/services/sereact"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"google_cloud_run_service.sereact",
"google_compute_address.vector_db_static_ip",
"google_compute_instance.vector_db_vm",
"google_project_service.services",
"google_service_account.vector_db_sa"
]
}
]
},
{
"mode": "managed",
@ -605,7 +690,7 @@
"delete_protection_state": "DELETE_PROTECTION_DISABLED",
"deletion_policy": "ABANDON",
"earliest_version_time": "2025-05-24T21:09:24.677010Z",
"etag": "IOyxoJSEvY0DMJL7/oiCvY0D",
"etag": "IIa6rZSGvY0DMKrW4vCEvY0D",
"id": "projects/gen-lang-client-0424120530/databases/sereact-imagedb",
"key_prefix": "",
"location_id": "us-central1",

View File

@ -14,7 +14,7 @@ class Settings(BaseSettings):
# CORS settings
CORS_ORIGINS: List[str] = ["*"]
CORS_METHODS: List[str] = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
CORS_HEADERS: List[str] = ["Content-Type", "Authorization", "X-Requested-With"]
CORS_HEADERS: List[str] = ["Content-Type", "Authorization", "X-Requested-With", "X-API-Key", "Accept", "Origin"]
CORS_EXPOSE_HEADERS: List[str] = ["Content-Length", "Content-Range"]
CORS_MAX_AGE: int = 3600
@ -33,12 +33,8 @@ class Settings(BaseSettings):
# Handle comma-separated format
return [i.strip().strip("'\"") for i in env_origins.split(",")]
# Fallback to default if no env var
if isinstance(v, str) and not v.startswith("["):
return [i.strip() for i in v.split(",")]
elif not v: # If empty list, use defaults
return ["http://localhost:3000", "http://localhost:8000", "http://127.0.0.1:8000", "http://127.0.0.1:3000", "https://localhost:3000", "https://localhost:8000"]
return v
# Use the default value if no env var is set
return v or ["*"]
@field_validator("CORS_METHODS", mode="before")
def assemble_cors_methods(cls, v):
@ -52,7 +48,7 @@ class Settings(BaseSettings):
env_headers = os.getenv("CORS_HEADERS")
if env_headers:
return [i.strip() for i in env_headers.split(",")]
return v or ["Content-Type", "Authorization", "X-Requested-With"]
return v or ["Content-Type", "Authorization", "X-Requested-With", "X-API-Key", "Accept", "Origin"]
@field_validator("CORS_EXPOSE_HEADERS", mode="before")
def assemble_cors_expose_headers(cls, v):