Scalable and distributed custom feed generator, ott - on that topic

Add rust services to skaffold config

Changed files
+77 -13
crates
ott-embed
src
ott-xrpc
docker
rust-service
helm
+3
crates/Cargo.lock
··· 2819 2819 "anyhow", 2820 2820 "async-trait", 2821 2821 "atproto-identity", 2822 + "atproto-oauth", 2823 + "atproto-record", 2822 2824 "atproto-xrpcs", 2823 2825 "axum", 2824 2826 "clap", 2827 + "elliptic-curve", 2825 2828 "http", 2826 2829 "reqwest", 2827 2830 "serde",
+1 -1
crates/ott-embed/src/main.rs
··· 14 14 use fluvio::{consumer::ConsumerConfigExtBuilder, Fluvio, Offset}; 15 15 use ott_types::{Embedding, Post}; 16 16 17 - const TEI_URL: &str = "http://localhost:8080"; 17 + const TEI_URL: &str = "http://tei-host-service:8080"; 18 18 const TOPIC: &str = "posts"; 19 19 const PARTITION: u32 = 0; 20 20
+3 -7
crates/ott-xrpc/Cargo.toml
··· 3 3 version = "0.1.0" 4 4 edition = "2024" 5 5 6 - [[bin]] 7 - name = "atproto-xrpcs-helloworld" 8 - path = "src/main.rs" 9 - test = false 10 - bench = false 11 - doc = true 12 - 13 6 [dependencies] 14 7 anyhow = "1.0.100" 15 8 async-trait = "0.1.89" 16 9 atproto-identity = "0.13.0" 10 + atproto-oauth = "0.13.0" 11 + atproto-record = "0.13.0" 17 12 atproto-xrpcs = "0.13.0" 18 13 axum = "0.8.6" 19 14 clap = { version = "4.5.48", features = ["derive", "env"] } 15 + elliptic-curve = "0.13.8" 20 16 http = "1.3.1" 21 17 reqwest = "0.12.23" 22 18 serde = { version = "1.0.228", features = ["derive"] }
+3 -3
crates/ott-xrpc/src/main.rs
··· 147 147 ) -> Json<serde_json::Value> { 148 148 println!("headers {headers:?}"); 149 149 let subject = parameters.subject.as_deref().unwrap_or("World"); 150 - let message = if authorization.is_none() { 151 - format!("Hello, {subject}!") 150 + let message = if let Some(auth) = authorization { 151 + format!("Hello, authenticated {}! (caller: {})", subject, auth.3) 152 152 } else { 153 - format!("Hello, authenticated {subject}!") 153 + format!("Hello, {}!", subject) 154 154 }; 155 155 Json(json!({ "message": message })) 156 156 }
+10 -2
docker/rust-service/Dockerfile
··· 19 19 RUN cargo build --release --bin ${CRATE_NAME} 20 20 21 21 # We do not need the Rust toolchain to run the binary! 22 - FROM debian:bookworm-slim AS runtime 22 + FROM debian:trixie-slim AS runtime 23 23 ARG CRATE_NAME 24 - WORKDIR /workspace 24 + ENV USER=${CRATE_NAME} 25 + RUN useradd \ 26 + --create-home \ 27 + --home-dir "/home/$USER" \ 28 + --shell /bin/bash \ 29 + "$USER" 30 + USER $USER 31 + WORKDIR /home/${CRATE_NAME} 32 + COPY ./connectors/fluvio_profile.toml /home/${CRATE_NAME}/.fluvio/config 25 33 COPY --from=builder /workspace/target/release/${CRATE_NAME} /usr/local/bin/app 26 34 ENTRYPOINT ["/usr/local/bin/app"]
+14
helm/ott/templates/tei_service.yaml
··· 1 + # Service to reach tei serive on host, beacuse mac GPU acceleration doesn't 2 + # work in docker 3 + apiVersion: v1 4 + kind: Service 5 + metadata: 6 + name: tei-host-service 7 + namespace: default 8 + spec: 9 + type: ExternalName 10 + externalName: host.docker.internal 11 + ports: 12 + - port: 8080 13 + targetPort: 8080 14 + protocol: TCP
+18
helm/ott/values.yaml
··· 13 13 fqn: posts-connector 14 14 pullPolicy: IfNotPresent 15 15 replicas: 1 16 + 17 + - name: ott-filter 18 + image: 19 + fqn: ott-filter 20 + pullPolicy: IfNotPresent 21 + replicas: 1 22 + 23 + - name: ott-embed 24 + image: 25 + fqn: ott-embed 26 + pullPolicy: IfNotPresent 27 + 28 + - name: ott-xrpc 29 + image: 30 + fqn: ott-embed 31 + pullPolicy: IfNotPresent 32 + replicas: 1 33 + replicas: 1
+25
skaffold.yaml
··· 21 21 buildArgs: 22 22 CONFIG_FILE: "likes-config.yaml" 23 23 24 + 25 + - image: ott-embed 26 + context: . 27 + docker: 28 + dockerfile: docker/rust-service/Dockerfile 29 + buildArgs: 30 + CRATE_NAME: "ott-embed" 31 + 32 + - image: ott-filter 33 + context: . 34 + docker: 35 + dockerfile: docker/rust-service/Dockerfile 36 + buildArgs: 37 + CRATE_NAME: "ott-filter" 38 + 39 + - image: ott-xrpc 40 + context: . 41 + docker: 42 + dockerfile: docker/rust-service/Dockerfile 43 + buildArgs: 44 + CRATE_NAME: "ott-xrpc" 45 + 24 46 tagPolicy: 25 47 envTemplate: 26 48 template: >- ··· 50 72 setValueTemplates: 51 73 deployments[0].image.fqn: "{{.IMAGE_FULLY_QUALIFIED_likes_connector}}" 52 74 deployments[1].image.fqn: "{{.IMAGE_FULLY_QUALIFIED_posts_connector}}" 75 + deployments[2].image.fqn: "{{.IMAGE_FULLY_QUALIFIED_ott_filter}}" 76 + deployments[3].image.fqn: "{{.IMAGE_FULLY_QUALIFIED_ott_embed}}" 77 + deployments[4].image.fqn: "{{.IMAGE_FULLY_QUALIFIED_ott_xrpc}}" 53 78 version: 0.1.0