File size: 3,798 Bytes
afad319
 
 
 
 
 
 
 
 
 
 
 
192b2d2
 
afad319
 
 
 
192b2d2
afad319
 
 
 
 
192b2d2
afad319
 
192b2d2
afad319
 
 
 
 
 
 
 
192b2d2
 
afad319
 
 
 
 
 
 
192b2d2
afad319
192b2d2
afad319
 
192b2d2
 
 
afad319
 
 
 
 
 
 
192b2d2
afad319
 
192b2d2
afad319
 
 
 
 
 
 
 
192b2d2
afad319
 
 
 
 
 
192b2d2
afad319
 
192b2d2
afad319
 
192b2d2
afad319
 
192b2d2
afad319
 
192b2d2
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# =============================================================================
# Docker Compose Configuration for RAG System
# =============================================================================
# This file defines the services and configuration for running the RAG system
# in a containerized environment using Docker Compose.

# =============================================================================
# COMPOSE VERSION
# =============================================================================

# Specify Docker Compose file format version
# Version 3.8 provides modern features and compatibility
version: '3.8'

# =============================================================================
# SERVICES DEFINITION
# =============================================================================

services:
  # =============================================================================
  # RAG SYSTEM SERVICE
  # =============================================================================
  
  # Main service for the RAG system application
  rag-system:
    # Build the Docker image from the current directory
    # Uses the Dockerfile in the root directory
    build: .
    
    # =============================================================================
    # NETWORK CONFIGURATION
    # =============================================================================
    
    # Port mapping: host_port:container_port
    # Maps port 8501 from the host to port 8501 in the container
    # Allows access to the Streamlit web interface from the host machine
    ports:
      - "8501:8501"
    
    # =============================================================================
    # ENVIRONMENT VARIABLES
    # =============================================================================
    
    # Set environment variables for the container
    # These override the defaults set in the Dockerfile
    environment:
      # Python path configuration
      - PYTHONPATH=/app
      
      # Streamlit server configuration
      - STREAMLIT_SERVER_PORT=8501
      - STREAMLIT_SERVER_ADDRESS=0.0.0.0
      - STREAMLIT_SERVER_HEADLESS=true
    
    # =============================================================================
    # VOLUME MOUNTING
    # =============================================================================
    
    # Mount volumes for data persistence
    # This ensures that the vector store data persists between container restarts
    volumes:
      # Mount the local vector_store directory to the container
      # Format: host_path:container_path
      - ./vector_store:/app/vector_store
    
    # =============================================================================
    # RESTART POLICY
    # =============================================================================
    
    # Container restart policy
    # unless-stopped: Restart the container unless it was explicitly stopped
    # This ensures the service stays running even after system reboots
    restart: unless-stopped
    
    # =============================================================================
    # HEALTH CHECK CONFIGURATION
    # =============================================================================
    
    # Health check to monitor service status
    healthcheck:
      # Command to test if the service is healthy
      # Uses curl to check if the Streamlit health endpoint responds
      test: ["CMD", "curl", "-f", "http://localhost:8501/_stcore/health"]
      
      # Check interval: run health check every 30 seconds
      interval: 30s
      
      # Timeout: wait up to 10 seconds for health check to complete
      timeout: 10s
      
      # Retries: attempt health check 3 times before marking as unhealthy
      retries: 3