From 12613c156e1a20f79691c1ed83e926bce65c466c Mon Sep 17 00:00:00 2001 From: johnpccd Date: Sat, 24 May 2025 23:00:51 +0200 Subject: [PATCH] cp --- deployment/cloud-run/service.yaml | 77 -- deployment/cloudbuild.yaml | 53 - .../terraform/.terraform.tfstate.lock.info | 1 - deployment/terraform/main.tf | 2 +- deployment/terraform/terraform.tfstate | 1185 +---------------- deployment/terraform/terraform.tfstate.backup | 31 +- src/config/config.py | 3 + 7 files changed, 19 insertions(+), 1333 deletions(-) delete mode 100644 deployment/cloud-run/service.yaml delete mode 100644 deployment/cloudbuild.yaml delete mode 100644 deployment/terraform/.terraform.tfstate.lock.info diff --git a/deployment/cloud-run/service.yaml b/deployment/cloud-run/service.yaml deleted file mode 100644 index 7afdff5..0000000 --- a/deployment/cloud-run/service.yaml +++ /dev/null @@ -1,77 +0,0 @@ -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: sereact - annotations: - run.googleapis.com/ingress: all -spec: - template: - metadata: - annotations: - run.googleapis.com/ingress: all - spec: - containers: - - image: gcr.io/gen-lang-client-0424120530/sereact-api:latest - ports: - - containerPort: 8000 - resources: - limits: - cpu: "1" - memory: "1Gi" - env: - - name: FIRESTORE_PROJECT_ID - value: "gen-lang-client-0424120530" - - name: FIRESTORE_CREDENTIALS_FILE - value: "/var/secrets/google/key.json" - - name: GOOGLE_APPLICATION_CREDENTIALS - value: "/var/secrets/google/key.json" - - name: GCS_BUCKET_NAME - value: "gen-lang-client-0424120530-images" - - name: API_KEY_SECRET - valueFrom: - secretKeyRef: - name: sereact-api-key-secret - key: latest - - name: VECTOR_DB_API_KEY - valueFrom: - secretKeyRef: - name: sereact-vector-db-key - key: latest - - name: VECTOR_DB_ENVIRONMENT - value: "gcp-starter" - - name: VECTOR_DB_INDEX_NAME - value: "image-embeddings" - - name: LOG_LEVEL - value: "INFO" - - name: CORS_ORIGINS - value: "['*']" - - name: CORS_METHODS - value: "GET,POST,PUT,DELETE,OPTIONS" - - name: CORS_HEADERS - value: "Content-Type,Authorization,X-Requested-With" - - name: CORS_EXPOSE_HEADERS - value: "Content-Length,Content-Range" - - name: CORS_MAX_AGE - value: "3600" - - name: QDRANT_HTTPS - value: "false" - - name: QDRANT_PREFER_GRPC - value: "false" - volumeMounts: - - name: gcp-sa-key - mountPath: /var/secrets/google - readOnly: true - startupProbe: - httpGet: - path: / - port: 8000 - initialDelaySeconds: 20 - periodSeconds: 5 - failureThreshold: 10 - volumes: - - name: gcp-sa-key - secret: - secretName: sereact-gcp-sa-key - items: - - key: latest - path: key.json \ No newline at end of file diff --git a/deployment/cloudbuild.yaml b/deployment/cloudbuild.yaml deleted file mode 100644 index eb6918d..0000000 --- a/deployment/cloudbuild.yaml +++ /dev/null @@ -1,53 +0,0 @@ -steps: -# Build the container image -- name: 'gcr.io/cloud-builders/docker' - args: ['build', '-t', 'gcr.io/$PROJECT_ID/sereact-api:$COMMIT_SHA', '.'] - -# Push the container image to Container Registry -- name: 'gcr.io/cloud-builders/docker' - args: ['push', 'gcr.io/$PROJECT_ID/sereact-api:$COMMIT_SHA'] - -# Tag the image as latest -- name: 'gcr.io/cloud-builders/docker' - args: ['tag', 'gcr.io/$PROJECT_ID/sereact-api:$COMMIT_SHA', 'gcr.io/$PROJECT_ID/sereact-api:latest'] - -# Push the latest tag -- name: 'gcr.io/cloud-builders/docker' - args: ['push', 'gcr.io/$PROJECT_ID/sereact-api:latest'] - -# Deploy to Cloud Run -- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' - entrypoint: gcloud - args: - - 'run' - - 'deploy' - - 'sereact' - - '--image=gcr.io/$PROJECT_ID/sereact-api:$COMMIT_SHA' - - '--region=us-central1' - - '--platform=managed' - - '--allow-unauthenticated' - - '--set-env-vars=GCS_BUCKET_NAME=${_GCS_BUCKET_NAME},FIRESTORE_PROJECT_ID=${PROJECT_ID},VECTOR_DB_ENVIRONMENT=${_VECTOR_DB_ENVIRONMENT},VECTOR_DB_INDEX_NAME=${_VECTOR_DB_INDEX_NAME},LOG_LEVEL=INFO' - - '--set-secrets=API_KEY_SECRET=sereact-api-key-secret:latest,VECTOR_DB_API_KEY=sereact-vector-db-key:latest' - -# Optional: Run tests after deployment -# - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' -# entrypoint: /bin/bash -# args: -# - '-c' -# - | -# SERVICE_URL=$(gcloud run services describe sereact --region=us-central1 --format='value(status.url)') -# curl -s -o /dev/null -w "%{http_code}" $${SERVICE_URL}/health | grep 200 - -# Store images in Container Registry -images: - - 'gcr.io/$PROJECT_ID/sereact-api:$COMMIT_SHA' - - 'gcr.io/$PROJECT_ID/sereact-api:latest' - -# Substitution variables to be set in the Cloud Build trigger -substitutions: - _GCS_BUCKET_NAME: 'your-app-storage-bucket' - _VECTOR_DB_ENVIRONMENT: 'your-pinecone-env' - _VECTOR_DB_INDEX_NAME: 'image-embeddings' - -# Increase timeout to 30 minutes -timeout: '1800s' \ No newline at end of file diff --git a/deployment/terraform/.terraform.tfstate.lock.info b/deployment/terraform/.terraform.tfstate.lock.info deleted file mode 100644 index f1ec83a..0000000 --- a/deployment/terraform/.terraform.tfstate.lock.info +++ /dev/null @@ -1 +0,0 @@ -{"ID":"5f252024-676f-4920-f829-cb47c30360a4","Operation":"OperationTypeApply","Info":"","Who":"DESKTOP\\habal@Desktop","Version":"1.10.1","Created":"2025-05-24T20:52:18.4005055Z","Path":"terraform.tfstate"} \ No newline at end of file diff --git a/deployment/terraform/main.tf b/deployment/terraform/main.tf index 6be2a5a..64e4fa2 100644 --- a/deployment/terraform/main.tf +++ b/deployment/terraform/main.tf @@ -133,7 +133,7 @@ resource "google_cloud_run_service" "sereact" { # CORS Configuration - These were missing! env { name = "CORS_ORIGINS" - value = "['*']" + value = "*" } env { diff --git a/deployment/terraform/terraform.tfstate b/deployment/terraform/terraform.tfstate index 654ebe7..69af557 100644 --- a/deployment/terraform/terraform.tfstate +++ b/deployment/terraform/terraform.tfstate @@ -1,1188 +1,9 @@ { "version": 4, "terraform_version": "1.10.1", - "serial": 269, + "serial": 294, "lineage": "a183cd95-f987-8698-c6dd-84e933c394a5", - "outputs": { - "cloud_run_qdrant_host": { - "value": "34.71.6.1", - "type": "string" - }, - "cloud_run_qdrant_host_internal": { - "value": "10.128.0.4", - "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" - }, - "pubsub_dlq_topic_name": { - "value": "image-processing-topic-dlq", - "type": "string" - }, - "pubsub_subscription_name": { - "value": "image-processing-topic-subscription", - "type": "string" - }, - "pubsub_topic_name": { - "value": "image-processing-topic", - "type": "string" - }, - "qdrant_grpc_endpoint": { - "value": "http://34.71.6.1:6334", - "type": "string" - }, - "qdrant_http_endpoint": { - "value": "http://34.71.6.1:6333", - "type": "string" - }, - "storage_bucket_name": { - "value": "sereact-images", - "type": "string" - }, - "vector_db_vm_external_ip": { - "value": "34.71.6.1", - "type": "string" - }, - "vector_db_vm_internal_ip": { - "value": "10.128.0.4", - "type": "string" - }, - "vector_db_vm_name": { - "value": "sereact-vector-db", - "type": "string" - } - }, - "resources": [ - { - "mode": "data", - "type": "google_project", - "name": "current", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "auto_create_network": null, - "billing_account": "00CA97-62E5BD-4A62B5", - "deletion_policy": "PREVENT", - "effective_labels": { - "generative-language": "enabled" - }, - "folder_id": null, - "id": "projects/gen-lang-client-0424120530", - "labels": { - "generative-language": "enabled" - }, - "name": "Gemini API", - "number": "761163285547", - "org_id": null, - "project_id": "gen-lang-client-0424120530", - "tags": null, - "terraform_labels": { - "generative-language": "enabled" - } - }, - "sensitive_attributes": [] - } - ] - }, - { - "mode": "managed", - "type": "google_cloud_run_service", - "name": "sereact", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 2, - "attributes": { - "autogenerate_revision_name": false, - "id": "locations/us-central1/namespaces/gen-lang-client-0424120530/services/sereact", - "location": "us-central1", - "metadata": [ - { - "annotations": { - "run.googleapis.com/ingress": "all" - }, - "effective_annotations": { - "run.googleapis.com/ingress": "all", - "run.googleapis.com/ingress-status": "all", - "run.googleapis.com/operation-id": "a36b6733-8ef6-4151-a609-3f89a8666953", - "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": 4, - "labels": {}, - "namespace": "gen-lang-client-0424120530", - "resource_version": "AAY159zQkzU", - "self_link": "/apis/serving.knative.dev/v1/namespaces/761163285547/services/sereact", - "terraform_labels": { - "goog-terraform-provisioned": "true" - }, - "uid": "f67eed78-59c9-4bb6-a118-fb940f206d09" - } - ], - "name": "sereact", - "project": "gen-lang-client-0424120530", - "status": [ - { - "conditions": [ - { - "message": "Revision 'sereact-00004-45z' is not ready and cannot serve traffic. The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00004-45z\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00004-45z%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", - "reason": "HealthCheckContainerError", - "status": "False", - "type": "Ready" - }, - { - "message": "The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00003-2fs\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00003-2fs%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", - "reason": "", - "status": "True", - "type": "ConfigurationsReady" - }, - { - "message": "Revision 'sereact-00004-45z' is not ready and cannot serve traffic. The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00004-45z\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00004-45z%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", - "reason": "HealthCheckContainerError", - "status": "False", - "type": "RoutesReady" - } - ], - "latest_created_revision_name": "sereact-00004-45z", - "latest_ready_revision_name": "sereact-00001-rsq", - "observed_generation": 4, - "traffic": [ - { - "latest_revision": true, - "percent": 100, - "revision_name": "sereact-00001-rsq", - "tag": "", - "url": "" - } - ], - "url": "https://sereact-p64zpdtkta-uc.a.run.app" - } - ], - "template": [ - { - "metadata": [ - { - "annotations": { - "autoscaling.knative.dev/maxScale": "10" - }, - "generation": 0, - "labels": { - "run.googleapis.com/startupProbeType": "Custom" - }, - "name": "", - "namespace": "", - "resource_version": "", - "self_link": "", - "uid": "" - } - ], - "spec": [ - { - "container_concurrency": 80, - "containers": [ - { - "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": "CORS_ORIGINS", - "value": "['*']", - "value_from": [] - }, - { - "name": "FIRESTORE_DATABASE_NAME", - "value": "sereact-imagedb", - "value_from": [] - }, - { - "name": "FIRESTORE_PROJECT_ID", - "value": "gen-lang-client-0424120530", - "value_from": [] - }, - { - "name": "GCS_BUCKET_NAME", - "value": "sereact-images", - "value_from": [] - }, - { - "name": "LOG_LEVEL", - "value": "INFO", - "value_from": [] - }, - { - "name": "QDRANT_API_KEY", - "value": "", - "value_from": [] - }, - { - "name": "QDRANT_HOST", - "value": "34.71.6.1", - "value_from": [] - }, - { - "name": "QDRANT_HTTPS", - "value": "false", - "value_from": [] - }, - { - "name": "QDRANT_PORT", - "value": "6333", - "value_from": [] - }, - { - "name": "QDRANT_PREFER_GRPC", - "value": "false", - "value_from": [] - }, - { - "name": "VECTOR_DB_ENVIRONMENT", - "value": "gcp-starter", - "value_from": [] - }, - { - "name": "VECTOR_DB_INDEX_NAME", - "value": "image-embeddings", - "value_from": [] - } - ], - "env_from": [], - "image": "gcr.io/gen-lang-client-0424120530/sereact-api:latest", - "liveness_probe": [], - "name": "", - "ports": [ - { - "container_port": 8000, - "name": "http1", - "protocol": "" - } - ], - "resources": [ - { - "limits": { - "cpu": "1", - "memory": "1Gi" - }, - "requests": {} - } - ], - "startup_probe": [ - { - "failure_threshold": 6, - "grpc": [], - "http_get": [ - { - "http_headers": [], - "path": "/health", - "port": 8000 - } - ], - "initial_delay_seconds": 30, - "period_seconds": 10, - "tcp_socket": [], - "timeout_seconds": 5 - } - ], - "volume_mounts": [], - "working_dir": "" - } - ], - "node_selector": {}, - "service_account_name": "761163285547-compute@developer.gserviceaccount.com", - "serving_state": "", - "timeout_seconds": 300, - "volumes": [] - } - ] - } - ], - "timeouts": null, - "traffic": [ - { - "latest_revision": true, - "percent": 100, - "revision_name": "", - "tag": "", - "url": "" - } - ] - }, - "sensitive_attributes": [ - [ - { - "type": "get_attr", - "value": "template" - }, - { - "type": "index", - "value": { - "value": 0, - "type": "number" - } - }, - { - "type": "get_attr", - "value": "spec" - }, - { - "type": "index", - "value": { - "value": 0, - "type": "number" - } - }, - { - "type": "get_attr", - "value": "containers" - }, - { - "type": "index", - "value": { - "value": 0, - "type": "number" - } - }, - { - "type": "get_attr", - "value": "env" - } - ] - ], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMiJ9", - "dependencies": [ - "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", - "type": "google_cloud_run_service_iam_member", - "name": "public_access", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwY15bNaQMM=", - "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", - "type": "google_compute_firewall", - "name": "qdrant_firewall", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 1, - "attributes": { - "allow": [ - { - "ports": [ - "6333", - "6334" - ], - "protocol": "tcp" - } - ], - "creation_timestamp": "2025-05-24T10:57:27.640-07:00", - "deny": [], - "description": "", - "destination_ranges": [], - "direction": "INGRESS", - "disabled": false, - "enable_logging": null, - "id": "projects/gen-lang-client-0424120530/global/firewalls/allow-qdrant", - "log_config": [], - "name": "allow-qdrant", - "network": "https://www.googleapis.com/compute/v1/projects/gen-lang-client-0424120530/global/networks/default", - "priority": 1000, - "project": "gen-lang-client-0424120530", - "self_link": "https://www.googleapis.com/compute/v1/projects/gen-lang-client-0424120530/global/firewalls/allow-qdrant", - "source_ranges": [ - "0.0.0.0/0", - "10.0.0.0/8" - ], - "source_service_accounts": [], - "source_tags": [], - "target_service_accounts": [], - "target_tags": [ - "qdrant" - ], - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" - } - ] - }, - { - "mode": "managed", - "type": "google_compute_instance", - "name": "vector_db_vm", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 6, - "attributes": { - "advanced_machine_features": [], - "allow_stopping_for_update": null, - "attached_disk": [], - "boot_disk": [ - { - "auto_delete": true, - "device_name": "persistent-disk-0", - "disk_encryption_key_raw": "", - "disk_encryption_key_rsa": "", - "disk_encryption_key_sha256": "", - "disk_encryption_service_account": "", - "force_attach": false, - "guest_os_features": [ - "VIRTIO_SCSI_MULTIQUEUE", - "SEV_CAPABLE", - "SEV_SNP_CAPABLE", - "SEV_LIVE_MIGRATABLE", - "SEV_LIVE_MIGRATABLE_V2", - "IDPF", - "TDX_CAPABLE", - "UEFI_COMPATIBLE", - "GVNIC" - ], - "initialize_params": [ - { - "architecture": "X86_64", - "enable_confidential_compute": false, - "image": "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2204-jammy-v20250523", - "labels": {}, - "provisioned_iops": 0, - "provisioned_throughput": 0, - "resource_manager_tags": {}, - "resource_policies": [], - "size": 50, - "snapshot": "", - "source_image_encryption_key": [], - "source_snapshot_encryption_key": [], - "storage_pool": "", - "type": "pd-standard" - } - ], - "interface": "", - "kms_key_self_link": "", - "mode": "READ_WRITE", - "source": "https://www.googleapis.com/compute/v1/projects/gen-lang-client-0424120530/zones/us-central1-a/disks/sereact-vector-db" - } - ], - "can_ip_forward": false, - "confidential_instance_config": [], - "cpu_platform": "Intel Broadwell", - "creation_timestamp": "2025-05-24T10:57:41.174-07:00", - "current_status": "RUNNING", - "deletion_protection": false, - "description": "", - "desired_status": null, - "effective_labels": { - "goog-terraform-provisioned": "true" - }, - "enable_display": false, - "guest_accelerator": [], - "hostname": "", - "id": "projects/gen-lang-client-0424120530/zones/us-central1-a/instances/sereact-vector-db", - "instance_encryption_key": [], - "instance_id": "8076617322369889915", - "key_revocation_action_type": "", - "label_fingerprint": "vezUS-42LLM=", - "labels": {}, - "machine_type": "e2-standard-2", - "metadata": {}, - "metadata_fingerprint": "cE8FbgySELs=", - "metadata_startup_script": "#!/bin/bash\n\n# Qdrant Vector Database Installation Script\n# This script installs and configures Qdrant on Ubuntu 22.04\n\nset -e\n\n# Update system packages\napt-get update\napt-get upgrade -y\n\n# Install required packages\napt-get install -y curl wget gnupg2 software-properties-common apt-transport-https ca-certificates\n\n# Install Docker\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg\necho \"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\" | tee /etc/apt/sources.list.d/docker.list \u003e /dev/null\napt-get update\napt-get install -y docker-ce docker-ce-cli containerd.io\n\n# Start and enable Docker\nsystemctl start docker\nsystemctl enable docker\n\n# Create qdrant user and directories\nuseradd -r -s /bin/false qdrant || true\nmkdir -p /opt/qdrant/storage\nmkdir -p /opt/qdrant/config\nchown -R qdrant:qdrant /opt/qdrant\n\n# Create Qdrant configuration file\ncat \u003e /opt/qdrant/config/config.yaml \u003c\u003c EOF\nservice:\n host: 0.0.0.0\n http_port: 6333\n grpc_port: 6334\n enable_cors: true\n\nstorage:\n storage_path: /qdrant/storage\n snapshots_path: /qdrant/snapshots\n on_disk_payload: true\n\ncluster:\n enabled: false\n\ntelemetry:\n disabled: true\n\nlog_level: INFO\nEOF\n\n# Create API key configuration if provided\nif [ -n \"\" ] \u0026\u0026 [ \"\" != \"\" ]; then\ncat \u003e\u003e /opt/qdrant/config/config.yaml \u003c\u003c EOF\n\nservice:\n api_key: \"\"\nEOF\nfi\n\n# Create systemd service for Qdrant\ncat \u003e /etc/systemd/system/qdrant.service \u003c\u003c EOF\n[Unit]\nDescription=Qdrant Vector Database\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nType=simple\nUser=root\nExecStartPre=-/usr/bin/docker stop qdrant\nExecStartPre=-/usr/bin/docker rm qdrant\nExecStart=/usr/bin/docker run --name qdrant \\\n -p 6333:6333 \\\n -p 6334:6334 \\\n -v /opt/qdrant/storage:/qdrant/storage:z \\\n -v /opt/qdrant/config/config.yaml:/qdrant/config/production.yaml:z \\\n qdrant/qdrant:latest\nExecStop=/usr/bin/docker stop qdrant\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\n# Pull Qdrant Docker image\ndocker pull qdrant/qdrant:latest\n\n# Enable and start Qdrant service\nsystemctl daemon-reload\nsystemctl enable qdrant\nsystemctl start qdrant\n\n# Install monitoring tools\napt-get install -y htop iotop nethogs\n\n# Create a simple health check script\ncat \u003e /opt/qdrant/health_check.sh \u003c\u003c 'EOF'\n#!/bin/bash\nresponse=$(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:6333/health)\nif [ \"$response\" = \"200\" ]; then\n echo \"Qdrant is healthy\"\n exit 0\nelse\n echo \"Qdrant is not responding properly (HTTP $response)\"\n exit 1\nfi\nEOF\n\nchmod +x /opt/qdrant/health_check.sh\n\n# Set up log rotation for Docker logs\ncat \u003e /etc/logrotate.d/docker \u003c\u003c EOF\n/var/lib/docker/containers/*/*.log {\n rotate 7\n daily\n compress\n size=1M\n missingok\n delaycompress\n copytruncate\n}\nEOF\n\n# Configure firewall (ufw)\nufw --force enable\nufw allow ssh\nufw allow 6333/tcp # Qdrant HTTP API\nufw allow 6334/tcp # Qdrant gRPC API\n\n# Create a simple backup script\ncat \u003e /opt/qdrant/backup.sh \u003c\u003c 'EOF'\n#!/bin/bash\nBACKUP_DIR=\"/opt/qdrant/backups\"\nDATE=$(date +%Y%m%d_%H%M%S)\nmkdir -p $BACKUP_DIR\n\n# Create snapshot via API\ncurl -X POST \"http://localhost:6333/snapshots\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"snapshot_name\": \"backup_'$DATE'\"}'\n\n# Copy storage directory\ntar -czf $BACKUP_DIR/qdrant_storage_$DATE.tar.gz -C /opt/qdrant storage/\n\n# Keep only last 7 backups\nfind $BACKUP_DIR -name \"*.tar.gz\" -mtime +7 -delete\n\necho \"Backup completed: $DATE\"\nEOF\n\nchmod +x /opt/qdrant/backup.sh\n\n# Set up daily backup cron job\necho \"0 2 * * * root /opt/qdrant/backup.sh \u003e\u003e /var/log/qdrant_backup.log 2\u003e\u00261\" \u003e\u003e /etc/crontab\n\n# Wait for Qdrant to be ready\necho \"Waiting for Qdrant to start...\"\nfor i in {1..30}; do\n if curl -s http://localhost:6333/health \u003e /dev/null; then\n echo \"Qdrant is ready!\"\n break\n fi\n echo \"Waiting... ($i/30)\"\n sleep 10\ndone\n\n# Create a default collection for image vectors\ncurl -X PUT \"http://localhost:6333/collections/image_vectors\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 512,\n \"distance\": \"Cosine\"\n },\n \"optimizers_config\": {\n \"default_segment_number\": 2\n },\n \"replication_factor\": 1\n }'\n\necho \"Qdrant installation and configuration completed!\"\necho \"Qdrant is accessible at:\"\necho \" HTTP API: http://$(curl -s ifconfig.me):6333\"\necho \" gRPC API: http://$(curl -s ifconfig.me):6334\"\necho \"Health check: /opt/qdrant/health_check.sh\"\necho \"Backup script: /opt/qdrant/backup.sh\" ", - "min_cpu_platform": "", - "name": "sereact-vector-db", - "network_interface": [ - { - "access_config": [ - { - "nat_ip": "34.71.6.1", - "network_tier": "PREMIUM", - "public_ptr_domain_name": "" - } - ], - "alias_ip_range": [], - "internal_ipv6_prefix_length": 0, - "ipv6_access_config": [], - "ipv6_access_type": "", - "ipv6_address": "", - "name": "nic0", - "network": "https://www.googleapis.com/compute/v1/projects/gen-lang-client-0424120530/global/networks/default", - "network_attachment": "", - "network_ip": "10.128.0.4", - "nic_type": "", - "queue_count": 0, - "stack_type": "IPV4_ONLY", - "subnetwork": "https://www.googleapis.com/compute/v1/projects/gen-lang-client-0424120530/regions/us-central1/subnetworks/default", - "subnetwork_project": "gen-lang-client-0424120530" - } - ], - "network_performance_config": [], - "params": [], - "project": "gen-lang-client-0424120530", - "reservation_affinity": [], - "resource_policies": [], - "scheduling": [ - { - "automatic_restart": true, - "availability_domain": 0, - "instance_termination_action": "", - "local_ssd_recovery_timeout": [], - "max_run_duration": [], - "min_node_cpus": 0, - "node_affinities": [], - "on_host_maintenance": "MIGRATE", - "on_instance_stop_action": [], - "preemptible": false, - "provisioning_model": "STANDARD", - "termination_time": "" - } - ], - "scratch_disk": [], - "self_link": "https://www.googleapis.com/compute/v1/projects/gen-lang-client-0424120530/zones/us-central1-a/instances/sereact-vector-db", - "service_account": [ - { - "email": "vector-db-sa@gen-lang-client-0424120530.iam.gserviceaccount.com", - "scopes": [ - "https://www.googleapis.com/auth/cloud-platform" - ] - } - ], - "shielded_instance_config": [ - { - "enable_integrity_monitoring": true, - "enable_secure_boot": false, - "enable_vtpm": true - } - ], - "tags": [ - "qdrant", - "vector-db" - ], - "tags_fingerprint": "SoSixaaHMG4=", - "terraform_labels": { - "goog-terraform-provisioned": "true" - }, - "timeouts": null, - "zone": "us-central1-a" - }, - "sensitive_attributes": [ - [ - { - "type": "get_attr", - "value": "metadata_startup_script" - } - ], - [ - { - "type": "get_attr", - "value": "boot_disk" - }, - { - "type": "index", - "value": { - "value": 0, - "type": "number" - } - }, - { - "type": "get_attr", - "value": "disk_encryption_key_raw" - } - ], - [ - { - "type": "get_attr", - "value": "boot_disk" - }, - { - "type": "index", - "value": { - "value": 0, - "type": "number" - } - }, - { - "type": "get_attr", - "value": "disk_encryption_key_rsa" - } - ] - ], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiNiJ9", - "dependencies": [ - "google_compute_address.vector_db_static_ip", - "google_project_service.services", - "google_service_account.vector_db_sa" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_firestore_database", - "name": "database", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "app_engine_integration_mode": "DISABLED", - "cmek_config": [], - "concurrency_mode": "PESSIMISTIC", - "create_time": "", - "database_edition": "STANDARD", - "delete_protection_state": "DELETE_PROTECTION_DISABLED", - "deletion_policy": "ABANDON", - "earliest_version_time": "2025-05-24T19:50:39.508594Z", - "etag": "ILqLvPD9vI0DMLa2lbPIvI0D", - "id": "projects/gen-lang-client-0424120530/databases/sereact-imagedb", - "key_prefix": "", - "location_id": "us-central1", - "name": "sereact-imagedb", - "point_in_time_recovery_enablement": "POINT_IN_TIME_RECOVERY_DISABLED", - "project": "gen-lang-client-0424120530", - "timeouts": null, - "type": "FIRESTORE_NATIVE", - "uid": "30634721-c8c7-4673-b605-c1a91dff3eab", - "update_time": "", - "version_retention_period": "3600s" - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMCJ9", - "dependencies": [ - "google_project_service.services" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_service", - "name": "services", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "index_key": "cloudresourcemanager.googleapis.com", - "schema_version": 0, - "attributes": { - "disable_dependent_services": null, - "disable_on_destroy": false, - "id": "gen-lang-client-0424120530/cloudresourcemanager.googleapis.com", - "project": "gen-lang-client-0424120530", - "service": "cloudresourcemanager.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": "compute.googleapis.com", - "schema_version": 0, - "attributes": { - "disable_dependent_services": null, - "disable_on_destroy": false, - "id": "gen-lang-client-0424120530/compute.googleapis.com", - "project": "gen-lang-client-0424120530", - "service": "compute.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": "containerregistry.googleapis.com", - "schema_version": 0, - "attributes": { - "disable_dependent_services": null, - "disable_on_destroy": false, - "id": "gen-lang-client-0424120530/containerregistry.googleapis.com", - "project": "gen-lang-client-0424120530", - "service": "containerregistry.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": "firestore.googleapis.com", - "schema_version": 0, - "attributes": { - "disable_dependent_services": null, - "disable_on_destroy": false, - "id": "gen-lang-client-0424120530/firestore.googleapis.com", - "project": "gen-lang-client-0424120530", - "service": "firestore.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": "run.googleapis.com", - "schema_version": 0, - "attributes": { - "disable_dependent_services": null, - "disable_on_destroy": false, - "id": "gen-lang-client-0424120530/run.googleapis.com", - "project": "gen-lang-client-0424120530", - "service": "run.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": "storage.googleapis.com", - "schema_version": 0, - "attributes": { - "disable_dependent_services": null, - "disable_on_destroy": false, - "id": "gen-lang-client-0424120530/storage.googleapis.com", - "project": "gen-lang-client-0424120530", - "service": "storage.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - } - ] - }, - { - "mode": "managed", - "type": "google_pubsub_subscription", - "name": "image_processing", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "ack_deadline_seconds": 600, - "bigquery_config": [], - "cloud_storage_config": [], - "dead_letter_policy": [ - { - "dead_letter_topic": "projects/gen-lang-client-0424120530/topics/image-processing-topic-dlq", - "max_delivery_attempts": 5 - } - ], - "effective_labels": { - "component": "image-processing", - "environment": "dev", - "goog-terraform-provisioned": "true", - "service": "sereact" - }, - "enable_exactly_once_delivery": false, - "enable_message_ordering": false, - "expiration_policy": [ - { - "ttl": "2678400s" - } - ], - "filter": "", - "id": "projects/gen-lang-client-0424120530/subscriptions/image-processing-topic-subscription", - "labels": { - "component": "image-processing", - "environment": "dev", - "service": "sereact" - }, - "message_retention_duration": "604800s", - "name": "image-processing-topic-subscription", - "project": "gen-lang-client-0424120530", - "push_config": [], - "retain_acked_messages": false, - "retry_policy": [ - { - "maximum_backoff": "600s", - "minimum_backoff": "10s" - } - ], - "terraform_labels": { - "component": "image-processing", - "environment": "dev", - "goog-terraform-provisioned": "true", - "service": "sereact" - }, - "timeouts": null, - "topic": "projects/gen-lang-client-0424120530/topics/image-processing-topic" - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19", - "dependencies": [ - "google_pubsub_topic.image_processing", - "google_pubsub_topic.image_processing_dlq" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_pubsub_subscription", - "name": "image_processing_dlq", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "ack_deadline_seconds": 10, - "bigquery_config": [], - "cloud_storage_config": [], - "dead_letter_policy": [], - "effective_labels": { - "component": "image-processing-dlq", - "environment": "dev", - "goog-terraform-provisioned": "true", - "service": "sereact" - }, - "enable_exactly_once_delivery": false, - "enable_message_ordering": false, - "expiration_policy": [ - { - "ttl": "2678400s" - } - ], - "filter": "", - "id": "projects/gen-lang-client-0424120530/subscriptions/image-processing-topic-dlq-subscription", - "labels": { - "component": "image-processing-dlq", - "environment": "dev", - "service": "sereact" - }, - "message_retention_duration": "2592000s", - "name": "image-processing-topic-dlq-subscription", - "project": "gen-lang-client-0424120530", - "push_config": [], - "retain_acked_messages": true, - "retry_policy": [], - "terraform_labels": { - "component": "image-processing-dlq", - "environment": "dev", - "goog-terraform-provisioned": "true", - "service": "sereact" - }, - "timeouts": null, - "topic": "projects/gen-lang-client-0424120530/topics/image-processing-topic-dlq" - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19", - "dependencies": [ - "google_pubsub_topic.image_processing_dlq" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_pubsub_subscription_iam_binding", - "name": "image_processing_subscriber", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwY15XOdN50=", - "id": "projects/gen-lang-client-0424120530/subscriptions/image-processing-topic-subscription/roles/pubsub.subscriber", - "members": [ - "serviceAccount:761163285547-compute@developer.gserviceaccount.com" - ], - "project": null, - "role": "roles/pubsub.subscriber", - "subscription": "image-processing-topic-subscription" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "data.google_project.current", - "google_pubsub_subscription.image_processing", - "google_pubsub_topic.image_processing", - "google_pubsub_topic.image_processing_dlq" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_pubsub_topic", - "name": "image_processing", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "effective_labels": { - "component": "image-processing", - "environment": "dev", - "goog-terraform-provisioned": "true", - "service": "sereact" - }, - "id": "projects/gen-lang-client-0424120530/topics/image-processing-topic", - "ingestion_data_source_settings": [], - "kms_key_name": "", - "labels": { - "component": "image-processing", - "environment": "dev", - "service": "sereact" - }, - "message_retention_duration": "", - "message_storage_policy": [], - "name": "image-processing-topic", - "project": "gen-lang-client-0424120530", - "schema_settings": [], - "terraform_labels": { - "component": "image-processing", - "environment": "dev", - "goog-terraform-provisioned": "true", - "service": "sereact" - }, - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19" - } - ] - }, - { - "mode": "managed", - "type": "google_pubsub_topic", - "name": "image_processing_dlq", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "effective_labels": { - "component": "image-processing-dlq", - "environment": "dev", - "goog-terraform-provisioned": "true", - "service": "sereact" - }, - "id": "projects/gen-lang-client-0424120530/topics/image-processing-topic-dlq", - "ingestion_data_source_settings": [], - "kms_key_name": "", - "labels": { - "component": "image-processing-dlq", - "environment": "dev", - "service": "sereact" - }, - "message_retention_duration": "", - "message_storage_policy": [], - "name": "image-processing-topic-dlq", - "project": "gen-lang-client-0424120530", - "schema_settings": [], - "terraform_labels": { - "component": "image-processing-dlq", - "environment": "dev", - "goog-terraform-provisioned": "true", - "service": "sereact" - }, - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19" - } - ] - }, - { - "mode": "managed", - "type": "google_pubsub_topic_iam_binding", - "name": "image_processing_publisher", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwY15XMktMU=", - "id": "projects/gen-lang-client-0424120530/topics/image-processing-topic/roles/pubsub.publisher", - "members": [ - "serviceAccount:761163285547-compute@developer.gserviceaccount.com" - ], - "project": "gen-lang-client-0424120530", - "role": "roles/pubsub.publisher", - "topic": "projects/gen-lang-client-0424120530/topics/image-processing-topic" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "data.google_project.current", - "google_pubsub_topic.image_processing" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_service_account", - "name": "vector_db_sa", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": "vector-db-sa", - "create_ignore_already_exists": null, - "description": "Service account for the vector database VM", - "disabled": false, - "display_name": "Vector Database Service Account", - "email": "vector-db-sa@gen-lang-client-0424120530.iam.gserviceaccount.com", - "id": "projects/gen-lang-client-0424120530/serviceAccounts/vector-db-sa@gen-lang-client-0424120530.iam.gserviceaccount.com", - "member": "serviceAccount:vector-db-sa@gen-lang-client-0424120530.iam.gserviceaccount.com", - "name": "projects/gen-lang-client-0424120530/serviceAccounts/vector-db-sa@gen-lang-client-0424120530.iam.gserviceaccount.com", - "project": "gen-lang-client-0424120530", - "timeouts": null, - "unique_id": "108486040628486621877" - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==" - } - ] - }, - { - "mode": "managed", - "type": "google_storage_bucket", - "name": "app_bucket", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 3, - "attributes": { - "autoclass": [], - "cors": [], - "custom_placement_config": [], - "default_event_based_hold": false, - "effective_labels": { - "goog-terraform-provisioned": "true" - }, - "enable_object_retention": false, - "encryption": [], - "force_destroy": false, - "hierarchical_namespace": [ - { - "enabled": false - } - ], - "id": "sereact-images", - "labels": {}, - "lifecycle_rule": [], - "location": "US-CENTRAL1", - "logging": [], - "name": "sereact-images", - "project": "gen-lang-client-0424120530", - "project_number": 761163285547, - "public_access_prevention": "inherited", - "requester_pays": false, - "retention_policy": [], - "rpo": null, - "self_link": "https://www.googleapis.com/storage/v1/b/sereact-images", - "soft_delete_policy": [ - { - "effective_time": "2025-05-24T17:57:31.611Z", - "retention_duration_seconds": 604800 - } - ], - "storage_class": "STANDARD", - "terraform_labels": { - "goog-terraform-provisioned": "true" - }, - "time_created": "2025-05-24T17:57:31.611Z", - "timeouts": null, - "uniform_bucket_level_access": true, - "updated": "2025-05-24T17:57:31.611Z", - "url": "gs://sereact-images", - "versioning": [], - "website": [] - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsInJlYWQiOjI0MDAwMDAwMDAwMCwidXBkYXRlIjoyNDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjMifQ==", - "dependencies": [ - "google_project_service.services" - ] - } - ] - } - ], + "outputs": {}, + "resources": [], "check_results": null } diff --git a/deployment/terraform/terraform.tfstate.backup b/deployment/terraform/terraform.tfstate.backup index c7d47b1..50926f9 100644 --- a/deployment/terraform/terraform.tfstate.backup +++ b/deployment/terraform/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.10.1", - "serial": 268, + "serial": 273, "lineage": "a183cd95-f987-8698-c6dd-84e933c394a5", "outputs": { "cloud_run_qdrant_host": { @@ -136,7 +136,7 @@ "effective_annotations": { "run.googleapis.com/ingress": "all", "run.googleapis.com/ingress-status": "all", - "run.googleapis.com/operation-id": "25c8aa08-3810-4d26-82c7-5fa64300fdf9", + "run.googleapis.com/operation-id": "8e5e22cf-c77d-4cb8-8587-5cf9d409193c", "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" @@ -145,10 +145,10 @@ "cloud.googleapis.com/location": "us-central1", "goog-terraform-provisioned": "true" }, - "generation": 3, + "generation": 5, "labels": {}, "namespace": "gen-lang-client-0424120530", - "resource_version": "AAY15dY3+48", + "resource_version": "AAY15+pAZzs", "self_link": "/apis/serving.knative.dev/v1/namespaces/761163285547/services/sereact", "terraform_labels": { "goog-terraform-provisioned": "true" @@ -162,27 +162,27 @@ { "conditions": [ { - "message": "Revision 'sereact-00003-2fs' is not ready and cannot serve traffic. The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00003-2fs\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00003-2fs%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", + "message": "Revision 'sereact-00005-5n6' is not ready and cannot serve traffic. The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00005-5n6\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00005-5n6%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", "reason": "HealthCheckContainerError", "status": "False", "type": "Ready" }, { - "message": "The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00003-2fs\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00003-2fs%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", + "message": "The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00005-5n6\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00005-5n6%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", "reason": "", "status": "True", "type": "ConfigurationsReady" }, { - "message": "Revision 'sereact-00003-2fs' is not ready and cannot serve traffic. The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00003-2fs\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00003-2fs%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", + "message": "Revision 'sereact-00005-5n6' is not ready and cannot serve traffic. The user-provided container failed the configured startup probe checks. Logs for this revision might contain more information.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=gen-lang-client-0424120530\u0026resource=cloud_run_revision/service_name/sereact/revision_name/sereact-00005-5n6\u0026advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22sereact%22%0Aresource.labels.revision_name%3D%22sereact-00005-5n6%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start", "reason": "HealthCheckContainerError", "status": "False", "type": "RoutesReady" } ], - "latest_created_revision_name": "sereact-00003-2fs", + "latest_created_revision_name": "sereact-00005-5n6", "latest_ready_revision_name": "sereact-00001-rsq", - "observed_generation": 3, + "observed_generation": 5, "traffic": [ { "latest_revision": true, @@ -243,7 +243,7 @@ }, { "name": "CORS_ORIGINS", - "value": "['*']", + "value": "*", "value_from": [] }, { @@ -444,13 +444,6 @@ } ] }, - { - "mode": "managed", - "type": "google_compute_address", - "name": "vector_db_static_ip", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, { "mode": "managed", "type": "google_compute_firewall", @@ -723,8 +716,8 @@ "database_edition": "STANDARD", "delete_protection_state": "DELETE_PROTECTION_DISABLED", "deletion_policy": "ABANDON", - "earliest_version_time": "2025-05-24T19:50:07.050995Z", - "etag": "IKWD/+D9vI0DMLa2lbPIvI0D", + "earliest_version_time": "2025-05-24T19:55:31.455016Z", + "etag": "IM+J1/v+vI0DMLa2lbPIvI0D", "id": "projects/gen-lang-client-0424120530/databases/sereact-imagedb", "key_prefix": "", "location_id": "us-central1", diff --git a/src/config/config.py b/src/config/config.py index d9342a8..2f141fa 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -23,6 +23,9 @@ class Settings(BaseSettings): # Read from environment variable first env_origins = os.getenv("CORS_ORIGINS") if env_origins: + # Handle wildcard case + if env_origins.strip() == "*": + return ["*"] if env_origins.startswith("[") and env_origins.endswith("]"): # Handle list format like "['*']" import ast