-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
67 lines (46 loc) · 2.48 KB
/
Copy pathREADME
File metadata and controls
67 lines (46 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Test Python Servers: Sender & Consumer
A Python-based server architecture for processing images with metadata. This repository contains the configurations required to run local databases, execute database migrations, and configure Google Cloud Logging infrastructure for failed image routing.
---
## 🗂️ Project Documentation
For specific details regarding local testing and database schema changes, refer to the sub-directory documentation:
* **Testing Guidelines:** See [tests/README](tests/README) for running test suites.
* **Database Migrations:** See [migrations/README.md](migrations/README.md) for full migration workflows.
---
## 🚀 Quick Start: Local DB Setup
### 1. Make the Migration Script Executable
Before Docker can execute the orchestration script, the host operating system must grant it execution permissions.
Run the following commands in your terminal:
```bash
# Grant execution permissions
chmod +x ./migrations/orchestrator.sh
# Verify the permissions were successfully updated
ls -l ./migrations/orchestrator.sh
```
---
## ☁️ Google Cloud Platform (GCP) Infrastructure Setup
Follow these steps to set up automated logging. This system monitors container terminal outputs and automatically routes specific image processing errors to a secure bucket.
### Step 1: Create a Cloud Storage Bucket
Define a destination folder in Google Cloud Storage to store your failed route logs.
1. Open the [Google Cloud Console](https://google.com).
2. Search for and navigate to **Cloud Storage** > **Buckets**.
3. Click **Create**.
4. Enter a globally unique **Bucket Name** (e.g., `failed-image-logs`).
5. Leave all other settings at their default values.
6. Click **Create**.
### Step 2: Create the Log Router Sink
Configure a connector to watch your container's terminal output, filter for specific errors, and push them to your newly created bucket.
1. In the console search bar, search for **Logging** and select **Log Router**.
2. Click **Create Sink**.
3. Complete the configuration steps using the following parameters:
| Configuration Field | Value / Action |
| :--- | :--- |
| **Sink Name** | `route-failed-images-to-gcs` |
| **Sink Service** | Choose **Cloud Storage bucket** |
| **Sink Destination** | Select your bucket (e.g., `my-project-failed-image-logs`) |
4. Scroll down to the **Build inclusion filter** box.
5. Paste the exact query below to target specific failed events:
```query
jsonPayload.event_type="image_processing_failed"
severity="ERROR"
```
6. Click **Create Sink**.