Project GenAI Url Digest
Tags: googlecloud, kubernetes, opentelemetry, terraform
Published: 2024-06-04 07:33:37

## Project Description:- 
GenAI-Url-Digest is a simple GenAI-RAG web app built with the LangChain framework and deployed in GKE as a microservice, including both frontend and backend. We improved observability with OpenTelemetry distributed tracing and set up continuous integration with Jenkins pipelines and continuous deployment with Argo CD. Ansible configured the Jenkins master node, and Terraform deployed the infrastructure. A pgvector database stores vector embeddings, allowing LangChain to perform vector searches. The project supports both local and cloud deployment.

## Tools Used

- Langchain Framework with RAG
- Google Kubernetes Engine
- Opentelemetry Tracing
- Ansible
- Terraform
- Jenkins
- Docker Compose

## Website Images
                            Website Architecture

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfnpyzodiaypqmdvqml9.jpg)
                             Url Post Route
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uv0gpumu8dtx741xjyl.png)

                         Question & Answer page
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t7lm3n0036uryb0kv2yt.png)

                    Cloud trace dashboard
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4a3rudcco5qdiv71k8ev.png)

Here is the small intro to project.For full project setup visit below github repo once.

[PROJECT_GITHUB_REPO](https://github.com/Gkemhcs/genai-url-digest.git)
**
Sample Docker Compose File for Local Deployment **

```
name: "urldigest"
version: '3.8'

services:
  frontend:
    build: ./src/frontend
    environment:
      - BACKEND_SERVER_URL=http://backend:5001
      - REDIS_SERVER_URL=redis
      - REDIS_AUTH_STRING=gkem1234
      - OTLP_ENDPOINT=otelcol

    depends_on:
      - backend
    ports:
      - "5000:5000"
    networks:
    - frontend 
    - backend 
    - redis
    - otelcol

  backend:
    build: ./src/backend
    ports:
      - "5001:5001"
    environment:
      - GOOGLE_APPLICATION_CREDENTIALS=/run/secrets/key.json
      - PGVECTOR_HOST_URL=pgvector
      - PGVECTOR_USER=gkem
      - PGVECTOR_PASSWORD=gkem1234
      - PGVECTOR_DATABASE=urldigest
      - OTLP_ENDPOINT=otelcol
    secrets:
      - key.json
    depends_on:
      - redis
      - pgvector
      - otelcol
    networks:
    - backend 
    - otelcol
    - pgvector

  redis:
    image: redis:latest
    command: redis-server /usr/local/etc/redis/redis.conf --requirepass gkem1234
    volumes:
      - ./config/redis.conf:/usr/local/etc/redis/redis.conf
    ports:
      - 6379:6379
    networks:
    - redis

  otelcol:
    image: otel/opentelemetry-collector:latest
    command: --config /etc/otelcol/config.yaml
    volumes:
      - ./collector.yaml:/etc/otelcol/config.yaml
    ports:
      - 4317:4317
      - 4318:4318
      - 55681:55681
      - 55680:55680
    depends_on:
      - zipkin
    networks:
    - otelcol
    - zipkin

  pgvector:
    image: pgvector/pgvector:pg16
    environment:
      - POSTGRES_USER=gkem
      - POSTGRES_PASSWORD=gkem1234
      - POSTGRES_DB=urldigest
    ports:
      - 5432:5432
    networks:
    - pgvector

  zipkin:
    image: openzipkin/zipkin
    ports:
      - 9411:9411
    networks:
      - zipkin

secrets:
  key.json:
    file: ./key.json

networks:
  zipkin:
  redis:
  frontend:
  backend:
  otelcol:
  pgvector:
  
```