diff --git a/README.md b/README.md index 4724f85..715eb00 100644 --- a/README.md +++ b/README.md @@ -340,13 +340,54 @@ results = vector_db.search_similar_images( ## API Endpoints -The API provides the following main endpoints: +The API provides the following main endpoints with their pagination support: +### Authentication & Authorization - `/api/v1/auth/*` - Authentication and API key management + - `GET /api/v1/auth/api-keys` - List API keys (no pagination - returns all keys for user) + +### Team Management - `/api/v1/teams/*` - Team management -- `/api/v1/users/*` - User management + - `GET /api/v1/teams` - List teams (no pagination - admin only, returns all teams) + +### User Management +- `/api/v1/users/*` - User management + - `GET /api/v1/users` - List users (no pagination - returns all users in team/organization) + +### Image Management ✅ **Fully Paginated** - `/api/v1/images/*` - **Image upload, download, and management (with async processing)** + - `GET /api/v1/images` - List images with **full pagination support** + - **Query Parameters:** + - `skip` (default: 0, min: 0) - Number of items to skip + - `limit` (default: 50, min: 1, max: 100) - Number of items per page + - `collection_id` (optional) - Filter by collection + - `tags` (optional) - Filter by comma-separated tags + - **Response includes:** `images`, `total`, `skip`, `limit` + +### Search Functionality ✅ **Fully Paginated** - `/api/v1/search/*` - **Image search functionality (semantic search via Qdrant)** + - `GET /api/v1/search` - Search images with **pagination support** + - **Query Parameters:** + - `q` (required) - Search query + - `limit` (default: 10, min: 1, max: 50) - Number of results + - `threshold` (default: 0.7, min: 0.0, max: 1.0) - Similarity threshold + - `collection_id` (optional) - Filter by collection + - `tags` (optional) - Filter by comma-separated tags + - **Response includes:** `results`, `total`, `limit`, `threshold`, `query` + - `POST /api/v1/search` - Advanced search with same pagination + - `GET /api/v1/search/similar/{image_id}` - Find similar images with pagination + +### Pagination Implementation Status + +| Endpoint | Pagination Status | Notes | +|----------|------------------|-------| +| `GET /api/v1/images` | ✅ **Fully Implemented** | `skip`, `limit`, `total` with proper validation | +| `GET /api/v1/search` | ✅ **Fully Implemented** | `limit`, `total` with similarity scoring | +| `GET /api/v1/users` | ❌ **Not Implemented** | Returns all users (typically small datasets) | +| `GET /api/v1/teams` | ❌ **Not Implemented** | Returns all teams (typically small datasets) | +| `GET /api/v1/auth/api-keys` | ❌ **Not Implemented** | Returns all keys for user (typically small datasets) | + +**Note:** The endpoints without pagination (users, teams, API keys) typically return small datasets and are designed for admin/management use cases where full data visibility is preferred. ### **Image Processing Status** @@ -538,26 +579,31 @@ This modular architecture provides several benefits: - **Reusability**: Common functionality is centralized for consistent implementation - **Security**: Authentication and authorization are handled consistently - - ## TODO ### High Priority - [ ] Remove Pinecone integration and complete Qdrant migration - [ ] Test and validate vector search functionality with Qdrant -- [ ] Implement proper pagination for search results and all endpoints +- [x] ~~Implement proper pagination for search results and all endpoints~~ **COMPLETED** - Images and Search APIs have full pagination - [ ] Test Cloud Function image processing pipeline - [ ] Validate VM setup for self-hosted Qdrant instance ### Medium Priority - [ ] Add comprehensive logging for vector search operations - [ ] Implement caching layer for frequently accessed embeddings -- [ ] Implement caching for frequently accessed data +- [ ] Implement caching for frequently accessed data - [ ] Add monitoring and alerting for vector database performance - [ ] Document vector search API endpoints - [ ] Set up Qdrant cluster with multiple nodes +- [ ] Consider adding pagination to admin endpoints (users, teams, API keys) if datasets grow large ### Low Priority +- [ ] Terraform dependencies + +### Pagination Status ✅ +- **✅ Images API**: Fully implemented with `skip`, `limit`, `total` parameters +- **✅ Search API**: Fully implemented with `limit`, `total`, similarity scoring +- **ℹ️ Users/Teams/API Keys**: No pagination (small datasets, admin use cases) ## Recent Changes - Migrated from Pinecone to self-hosted Qdrant diff --git a/deployment/terraform/main.tf b/deployment/terraform/main.tf index 64e4fa2..c884962 100644 --- a/deployment/terraform/main.tf +++ b/deployment/terraform/main.tf @@ -130,31 +130,31 @@ resource "google_cloud_run_service" "sereact" { value = "INFO" } - # CORS Configuration - These were missing! - env { - name = "CORS_ORIGINS" - value = "*" - } + # # CORS Configuration - These were missing! + # env { + # name = "CORS_ORIGINS" + # value = "[\"*\"]" + # } - env { - name = "CORS_METHODS" - value = "GET,POST,PUT,DELETE,OPTIONS" - } + # env { + # name = "CORS_METHODS" + # value = "GET,POST,PUT,DELETE,OPTIONS" + # } - env { - name = "CORS_HEADERS" - value = "Content-Type,Authorization,X-Requested-With" - } + # env { + # name = "CORS_HEADERS" + # value = "Content-Type,Authorization,X-Requested-With" + # } - env { - name = "CORS_EXPOSE_HEADERS" - value = "Content-Length,Content-Range" - } + # env { + # name = "CORS_EXPOSE_HEADERS" + # value = "Content-Length,Content-Range" + # } - env { - name = "CORS_MAX_AGE" - value = "3600" - } + # env { + # name = "CORS_MAX_AGE" + # value = "3600" + # } } } diff --git a/deployment/terraform/terraform.tfstate b/deployment/terraform/terraform.tfstate index 69af557..f4de5ec 100644 --- a/deployment/terraform/terraform.tfstate +++ b/deployment/terraform/terraform.tfstate @@ -1,9 +1,1161 @@ { "version": 4, "terraform_version": "1.10.1", - "serial": 294, + "serial": 367, "lineage": "a183cd95-f987-8698-c6dd-84e933c394a5", - "outputs": {}, - "resources": [], + "outputs": { + "cloud_run_qdrant_host": { + "value": "34.71.6.1", + "type": "string" + }, + "cloud_run_qdrant_host_internal": { + "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" + }, + "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.6", + "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": "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": 1, + "labels": null, + "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": "c67276c9-0c25-4a6c-8f39-4ea942599769" + } + ], + "name": "sereact", + "project": "gen-lang-client-0424120530", + "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": [ + { + "annotations": { + "autoscaling.knative.dev/maxScale": "10" + }, + "generation": 0, + "labels": { + "run.googleapis.com/startupProbeType": "Default" + }, + "name": "", + "namespace": "", + "resource_version": "", + "self_link": "", + "uid": "" + } + ], + "spec": [ + { + "container_concurrency": 80, + "containers": [ + { + "args": null, + "command": null, + "env": [ + { + "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": null + } + ], + "startup_probe": [ + { + "failure_threshold": 1, + "grpc": [], + "http_get": [], + "initial_delay_seconds": 0, + "period_seconds": 240, + "tcp_socket": [ + { + "port": 8000 + } + ], + "timeout_seconds": 240 + } + ], + "volume_mounts": [], + "working_dir": "" + } + ], + "node_selector": null, + "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": "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", + "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-24T14:09:17.159-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-24T14:09:30.477-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": "1246596410843827045", + "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.6", + "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": "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" + } + ], + [ + { + "type": "get_attr", + "value": "metadata_startup_script" + } + ] + ], + "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-24T21:09:24.677010Z", + "etag": "IMTG8tCEvY0DMJL7/oiCvY0D", + "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": "f4aa945b-2205-4f94-b903-57815519f2fc", + "update_time": "", + "version_retention_period": "3600s" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19", + "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": "BwY16CF7/Zw=", + "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": "BwY16CEHGDA=", + "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": "115648202672357296665" + }, + "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-24T21:09:21.315Z", + "retention_duration_seconds": 604800 + } + ], + "storage_class": "STANDARD", + "terraform_labels": { + "goog-terraform-provisioned": "true" + }, + "time_created": "2025-05-24T21:09:21.315Z", + "timeouts": null, + "uniform_bucket_level_access": true, + "updated": "2025-05-24T21:09:21.315Z", + "url": "gs://sereact-images", + "versioning": [], + "website": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsInJlYWQiOjI0MDAwMDAwMDAwMCwidXBkYXRlIjoyNDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjMifQ==", + "dependencies": [ + "google_project_service.services" + ] + } + ] + } + ], "check_results": null } diff --git a/deployment/terraform/terraform.tfstate.backup b/deployment/terraform/terraform.tfstate.backup index 50926f9..021e1d3 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": 273, + "serial": 363, "lineage": "a183cd95-f987-8698-c6dd-84e933c394a5", "outputs": { "cloud_run_qdrant_host": { @@ -9,38 +9,13 @@ "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", + "value": "10.128.0.6", "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" @@ -74,7 +49,7 @@ "type": "string" }, "vector_db_vm_internal_ip": { - "value": "10.128.0.4", + "value": "10.128.0.6", "type": "string" }, "vector_db_vm_name": { @@ -123,6 +98,7 @@ "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", "instances": [ { + "status": "tainted", "schema_version": 2, "attributes": { "autogenerate_revision_name": false, @@ -134,67 +110,25 @@ "run.googleapis.com/ingress": "all" }, "effective_annotations": { - "run.googleapis.com/ingress": "all", - "run.googleapis.com/ingress-status": "all", - "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" + "run.googleapis.com/ingress": "all" }, "effective_labels": { - "cloud.googleapis.com/location": "us-central1", "goog-terraform-provisioned": "true" }, - "generation": 5, - "labels": {}, - "namespace": "gen-lang-client-0424120530", - "resource_version": "AAY15+pAZzs", - "self_link": "/apis/serving.knative.dev/v1/namespaces/761163285547/services/sereact", + "generation": 0, + "labels": null, + "namespace": "", + "resource_version": "", + "self_link": "", "terraform_labels": { "goog-terraform-provisioned": "true" }, - "uid": "f67eed78-59c9-4bb6-a118-fb940f206d09" + "uid": "" } ], "name": "sereact", "project": "gen-lang-client-0424120530", - "status": [ - { - "conditions": [ - { - "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-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-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-00005-5n6", - "latest_ready_revision_name": "sereact-00001-rsq", - "observed_generation": 5, - "traffic": [ - { - "latest_revision": true, - "percent": 100, - "revision_name": "sereact-00001-rsq", - "tag": "", - "url": "" - } - ], - "url": "https://sereact-p64zpdtkta-uc.a.run.app" - } - ], + "status": null, "template": [ { "metadata": [ @@ -203,9 +137,7 @@ "autoscaling.knative.dev/maxScale": "10" }, "generation": 0, - "labels": { - "run.googleapis.com/startupProbeType": "Custom" - }, + "labels": {}, "name": "", "namespace": "", "resource_version": "", @@ -215,11 +147,11 @@ ], "spec": [ { - "container_concurrency": 80, + "container_concurrency": 0, "containers": [ { - "args": [], - "command": [], + "args": null, + "command": null, "env": [ { "name": "CORS_EXPOSE_HEADERS", @@ -241,11 +173,6 @@ "value": "GET,POST,PUT,DELETE,OPTIONS", "value_from": [] }, - { - "name": "CORS_ORIGINS", - "value": "*", - "value_from": [] - }, { "name": "FIRESTORE_DATABASE_NAME", "value": "sereact-imagedb", @@ -309,7 +236,7 @@ "ports": [ { "container_port": 8000, - "name": "http1", + "name": "", "protocol": "" } ], @@ -319,34 +246,18 @@ "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 + "requests": null } ], + "startup_probe": [], "volume_mounts": [], "working_dir": "" } ], - "node_selector": {}, - "service_account_name": "761163285547-compute@developer.gserviceaccount.com", + "node_selector": null, + "service_account_name": "", "serving_state": "", - "timeout_seconds": 300, + "timeout_seconds": 0, "volumes": [] } ] @@ -416,33 +327,10 @@ }, { "mode": "managed", - "type": "google_cloud_run_service_iam_member", - "name": "public_access", + "type": "google_compute_address", + "name": "vector_db_static_ip", "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" - ] - } - ] + "instances": [] }, { "mode": "managed", @@ -462,7 +350,7 @@ "protocol": "tcp" } ], - "creation_timestamp": "2025-05-24T10:57:27.640-07:00", + "creation_timestamp": "2025-05-24T14:09:17.159-07:00", "deny": [], "description": "", "destination_ranges": [], @@ -552,7 +440,7 @@ "can_ip_forward": false, "confidential_instance_config": [], "cpu_platform": "Intel Broadwell", - "creation_timestamp": "2025-05-24T10:57:41.174-07:00", + "creation_timestamp": "2025-05-24T14:09:30.477-07:00", "current_status": "RUNNING", "deletion_protection": false, "description": "", @@ -565,7 +453,7 @@ "hostname": "", "id": "projects/gen-lang-client-0424120530/zones/us-central1-a/instances/sereact-vector-db", "instance_encryption_key": [], - "instance_id": "8076617322369889915", + "instance_id": "1246596410843827045", "key_revocation_action_type": "", "label_fingerprint": "vezUS-42LLM=", "labels": {}, @@ -592,7 +480,7 @@ "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", + "network_ip": "10.128.0.6", "nic_type": "", "queue_count": 0, "stack_type": "IPV4_ONLY", @@ -653,7 +541,18 @@ [ { "type": "get_attr", - "value": "metadata_startup_script" + "value": "boot_disk" + }, + { + "type": "index", + "value": { + "value": 0, + "type": "number" + } + }, + { + "type": "get_attr", + "value": "disk_encryption_key_rsa" } ], [ @@ -676,18 +575,7 @@ [ { "type": "get_attr", - "value": "boot_disk" - }, - { - "type": "index", - "value": { - "value": 0, - "type": "number" - } - }, - { - "type": "get_attr", - "value": "disk_encryption_key_rsa" + "value": "metadata_startup_script" } ] ], @@ -716,8 +604,8 @@ "database_edition": "STANDARD", "delete_protection_state": "DELETE_PROTECTION_DISABLED", "deletion_policy": "ABANDON", - "earliest_version_time": "2025-05-24T19:55:31.455016Z", - "etag": "IM+J1/v+vI0DMLa2lbPIvI0D", + "earliest_version_time": "2025-05-24T21:09:24.677010Z", + "etag": "IOyxoJSEvY0DMJL7/oiCvY0D", "id": "projects/gen-lang-client-0424120530/databases/sereact-imagedb", "key_prefix": "", "location_id": "us-central1", @@ -726,12 +614,12 @@ "project": "gen-lang-client-0424120530", "timeouts": null, "type": "FIRESTORE_NATIVE", - "uid": "30634721-c8c7-4673-b605-c1a91dff3eab", + "uid": "f4aa945b-2205-4f94-b903-57815519f2fc", "update_time": "", "version_retention_period": "3600s" }, "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMCJ9", + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19", "dependencies": [ "google_project_service.services" ] @@ -963,7 +851,7 @@ "schema_version": 0, "attributes": { "condition": [], - "etag": "BwY15XOdN50=", + "etag": "BwY16CF7/Zw=", "id": "projects/gen-lang-client-0424120530/subscriptions/image-processing-topic-subscription/roles/pubsub.subscriber", "members": [ "serviceAccount:761163285547-compute@developer.gserviceaccount.com" @@ -1075,7 +963,7 @@ "schema_version": 0, "attributes": { "condition": [], - "etag": "BwY15XMktMU=", + "etag": "BwY16CEHGDA=", "id": "projects/gen-lang-client-0424120530/topics/image-processing-topic/roles/pubsub.publisher", "members": [ "serviceAccount:761163285547-compute@developer.gserviceaccount.com" @@ -1113,7 +1001,7 @@ "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" + "unique_id": "115648202672357296665" }, "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==" @@ -1159,7 +1047,7 @@ "self_link": "https://www.googleapis.com/storage/v1/b/sereact-images", "soft_delete_policy": [ { - "effective_time": "2025-05-24T17:57:31.611Z", + "effective_time": "2025-05-24T21:09:21.315Z", "retention_duration_seconds": 604800 } ], @@ -1167,10 +1055,10 @@ "terraform_labels": { "goog-terraform-provisioned": "true" }, - "time_created": "2025-05-24T17:57:31.611Z", + "time_created": "2025-05-24T21:09:21.315Z", "timeouts": null, "uniform_bucket_level_access": true, - "updated": "2025-05-24T17:57:31.611Z", + "updated": "2025-05-24T21:09:21.315Z", "url": "gs://sereact-images", "versioning": [], "website": [] diff --git a/src/config/config.py b/src/config/config.py index 2f141fa..d9342a8 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -23,9 +23,6 @@ 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