Skip to content

Commit ee0718e

Browse files
committed
feat: add bucket
1 parent 190a9f3 commit ee0718e

File tree

9 files changed

+157
-8
lines changed

9 files changed

+157
-8
lines changed

blobs/arch.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
```mermaid
2+
flowchart TD
3+
subgraph Client
4+
A[Client]
5+
end
6+
7+
subgraph Media
8+
B1[LiveKit SFU]
9+
B2[CoTURN]
10+
end
11+
12+
subgraph Backend
13+
C1[Central Server]
14+
C2[Captioning Worker]
15+
C3[OCR Worker]
16+
C4[Postgres]
17+
C5[(MinIO Bucket)]
18+
end
19+
20+
A <--> B1
21+
B1 <--> B2
22+
B1 --> C2
23+
C2 -->|Captions| A
24+
A -->|Snapshots| C3
25+
A -->|Raw Screenshots| C5
26+
C3 --> C4
27+
C3 -->|Processed Images| C5
28+
C2 --> C4
29+
C1 --> C4
30+
A --> C1
31+
```

blobs/arch.png

5.2 KB
Loading

crates/config/src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl DatabaseConfig {
3232
self.username, self.password, self.host, self.port, self.database
3333
)
3434
}
35-
35+
3636
pub fn from_env() -> anyhow::Result<Self> {
3737
Ok(Self {
3838
host: std::env::var("DB_HOST").unwrap_or_else(|_| "localhost".to_string()),
@@ -52,4 +52,4 @@ impl DatabaseConfig {
5252
.unwrap_or(30),
5353
})
5454
}
55-
}
55+
}

crates/config/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
pub mod db;
2-
pub mod ollama;
32
pub mod redis;
3+
pub mod ollama;
4+
pub mod minio;
45

56
pub use db::*;
6-
pub use ollama::*;
77
pub use redis::*;
8+
pub use ollama::*;
9+
pub use minio::*;
810

911
use serde::{Deserialize, Serialize};
1012

crates/config/src/minio.rs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
use serde::{Deserialize, Serialize};
2+
3+
#[derive(Debug, Clone, Serialize, Deserialize)]
4+
pub struct MinioConfig {
5+
pub endpoint: String,
6+
pub access_key: String,
7+
pub secret_key: String,
8+
pub region: Option<String>,
9+
pub secure: bool,
10+
pub buckets: MinioBuckets,
11+
}
12+
13+
#[derive(Debug, Clone, Serialize, Deserialize)]
14+
pub struct MinioBuckets {
15+
pub uploads: String,
16+
pub processed: String,
17+
pub thumbnails: String,
18+
pub temp: String,
19+
}
20+
21+
impl Default for MinioConfig {
22+
fn default() -> Self {
23+
Self {
24+
endpoint: "localhost:9000".to_string(),
25+
access_key: "minioadmin".to_string(),
26+
secret_key: "minioadmin123".to_string(),
27+
region: Some("us-east-1".to_string()),
28+
secure: false,
29+
buckets: MinioBuckets::default(),
30+
}
31+
}
32+
}
33+
34+
impl Default for MinioBuckets {
35+
fn default() -> Self {
36+
Self {
37+
uploads: "uploads".to_string(),
38+
processed: "processed".to_string(),
39+
thumbnails: "thumbnails".to_string(),
40+
temp: "temp".to_string(),
41+
}
42+
}
43+
}
44+
45+
impl MinioConfig {
46+
pub fn from_env() -> Self {
47+
Self {
48+
endpoint: std::env::var("MINIO_ENDPOINT").unwrap_or_else(|_| "localhost:9000".to_string()),
49+
access_key: std::env::var("MINIO_ACCESS_KEY").unwrap_or_else(|_| "minioadmin".to_string()),
50+
secret_key: std::env::var("MINIO_SECRET_KEY").unwrap_or_else(|_| "minioadmin123".to_string()),
51+
region: std::env::var("MINIO_REGION").ok(),
52+
secure: std::env::var("MINIO_SECURE").unwrap_or_else(|_| "false".to_string()).parse().unwrap_or(false),
53+
buckets: MinioBuckets {
54+
uploads: std::env::var("MINIO_BUCKET_UPLOADS").unwrap_or_else(|_| "uploads".to_string()),
55+
processed: std::env::var("MINIO_BUCKET_PROCESSED").unwrap_or_else(|_| "processed".to_string()),
56+
thumbnails: std::env::var("MINIO_BUCKET_THUMBNAILS").unwrap_or_else(|_| "thumbnails".to_string()),
57+
temp: std::env::var("MINIO_BUCKET_TEMP").unwrap_or_else(|_| "temp".to_string()),
58+
},
59+
}
60+
}
61+
}

crates/config/src/ollama.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ impl OllamaConfig {
2525
pub fn api_url(&self) -> String {
2626
format!("{}/api", self.base_url)
2727
}
28-
28+
2929
pub fn generate_url(&self) -> String {
3030
format!("{}/api/generate", self.base_url)
3131
}
32-
32+
3333
pub fn chat_url(&self) -> String {
3434
format!("{}/api/chat", self.base_url)
3535
}
36-
36+
3737
pub fn from_env() -> anyhow::Result<Self> {
3838
Ok(Self {
3939
base_url: std::env::var("OLLAMA_BASE_URL")
@@ -70,4 +70,4 @@ pub struct OllamaResponse {
7070
pub created_at: String,
7171
pub response: String,
7272
pub done: bool,
73-
}
73+
}

docker/compose/minio/compose.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
services:
2+
minio:
3+
image: minio/minio:latest
4+
container_name: verse-minio
5+
ports:
6+
- "9000:9000"
7+
- "9001:9001"
8+
volumes:
9+
- ./minio_data:/data
10+
environment:
11+
MINIO_ROOT_USER: minioadmin
12+
MINIO_ROOT_PASSWORD: minioadmin123
13+
MINIO_CONSOLE_ADDRESS: ":9001"
14+
command: server /data --console-address ":9001"
15+
healthcheck:
16+
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
17+
interval: 30s
18+
timeout: 20s
19+
retries: 3
20+
networks:
21+
- verse-network
22+
23+
minio-setup:
24+
image: minio/mc:latest
25+
container_name: verse-minio-setup
26+
depends_on:
27+
minio:
28+
condition: service_healthy
29+
environment:
30+
MINIO_ENDPOINT: http://minio:9000
31+
MINIO_ROOT_USER: minioadmin
32+
MINIO_ROOT_PASSWORD: minioadmin123
33+
entrypoint: |
34+
/bin/sh -c "
35+
echo 'Waiting for MinIO to be ready...'
36+
sleep 10
37+
38+
echo 'Setting up MinIO alias...'
39+
mc alias set myminio http://minio:9000 minioadmin minioadmin123
40+
41+
echo 'Creating buckets...'
42+
mc mb myminio/uploads --ignore-existing
43+
mc mb myminio/processed --ignore-existing
44+
mc mb myminio/thumbnails --ignore-existing
45+
mc mb myminio/temp --ignore-existing
46+
47+
echo 'Setting bucket policies...'
48+
mc anonymous set public myminio/processed
49+
mc anonymous set public myminio/thumbnails
50+
51+
echo 'MinIO setup complete!'
52+
"
53+
networks:
54+
- verse-network

docker/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include:
22
- ./compose/coturn/compose.yaml
33
- ./compose/livekit/compose.yaml
4+
- ./compose/minio/compose.yaml
45
- ./compose/postgres/compose.yaml
56

67
networks:

0 commit comments

Comments
 (0)