File tree Expand file tree Collapse file tree
containers/llm-orchestrator-min Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ version : ' 3.8'
2+
3+ services :
4+ # API Gateway (Traefik)
5+ api-gateway :
6+ build : ./microservices/api-gateway
7+ container_name : llm-api-gateway
8+ ports :
9+ - " 80:80" # API
10+ - " 8080:8080" # Dashboard
11+ volumes :
12+ - /var/run/docker.sock:/var/run/docker.sock:ro
13+ networks :
14+ - llm-network
15+ depends_on :
16+ - model-service
17+ restart : unless-stopped
18+
19+ # Model Service
20+ model-service :
21+ build : ./microservices/model-service
22+ container_name : llm-model-service
23+ environment :
24+ - MODEL_PATH=/app/models/tinyllama
25+ - USE_INT8=true
26+ - MODEL_SERVICE_PORT=5000
27+ volumes :
28+ - model-data:/app/models
29+ networks :
30+ - llm-network
31+ restart : unless-stopped
32+ deploy :
33+ resources :
34+ limits :
35+ memory : 4G
36+
37+ # Cache Service (można dodać w przyszłości)
38+ # cache-service:
39+ # build: ./microservices/cache-service
40+ # container_name: llm-cache-service
41+ # networks:
42+ # - llm-network
43+ # restart: unless-stopped
44+
45+ # Monitoring Service (można dodać w przyszłości)
46+ # monitoring-service:
47+ # build: ./microservices/monitoring-service
48+ # container_name: llm-monitoring-service
49+ # networks:
50+ # - llm-network
51+ # restart: unless-stopped
52+
53+ networks :
54+ llm-network :
55+ driver : bridge
56+
57+ volumes :
58+ model-data :
59+ driver : local
Original file line number Diff line number Diff line change 1+ FROM traefik:v2.9
2+
3+ # Kopiowanie konfiguracji
4+ COPY traefik.yml /etc/traefik/traefik.yml
5+ COPY dynamic_conf.yml /etc/traefik/dynamic_conf.yml
6+
7+ # Ekspozycja portów
8+ EXPOSE 80
9+ EXPOSE 8080
10+
11+ # Healthcheck
12+ HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
13+ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ping || exit 1
14+
15+ # Uruchomienie Traefik
16+ ENTRYPOINT ["traefik" ]
Original file line number Diff line number Diff line change 1+ # # Traefik Dynamic Configuration
2+
3+ # Konfiguracja HTTP
4+ http :
5+ # Middlewares
6+ middlewares :
7+ # Rate limiting
8+ rate-limit :
9+ rateLimit :
10+ average : 100
11+ burst : 50
12+
13+ # Retry
14+ retry-middleware :
15+ retry :
16+ attempts : 3
17+ initialInterval : " 500ms"
18+
19+ # Compression
20+ compress-middleware :
21+ compress : {}
22+
23+ # CORS
24+ cors-middleware :
25+ cors :
26+ allowOriginList :
27+ - " *"
28+ allowHeaders :
29+ - " *"
30+ allowMethods :
31+ - GET
32+ - POST
33+ - PUT
34+ - DELETE
35+ - OPTIONS
36+
37+ # Routery
38+ routers :
39+ # Router dla modelu
40+ model-router :
41+ rule : " PathPrefix(`/api/model`)"
42+ service : model-service
43+ middlewares :
44+ - rate-limit
45+ - retry-middleware
46+ - compress-middleware
47+ - cors-middleware
48+
49+ # Router dla cache
50+ cache-router :
51+ rule : " PathPrefix(`/api/cache`)"
52+ service : cache-service
53+ middlewares :
54+ - rate-limit
55+ - retry-middleware
56+ - compress-middleware
57+
58+ # Router dla monitoringu
59+ monitoring-router :
60+ rule : " PathPrefix(`/api/monitoring`)"
61+ service : monitoring-service
62+
63+ # Usługi
64+ services :
65+ # Usługa modelu
66+ model-service :
67+ loadBalancer :
68+ servers :
69+ - url : " http://model-service:5000"
70+ passHostHeader : true
71+
72+ # Usługa cache
73+ cache-service :
74+ loadBalancer :
75+ servers :
76+ - url : " http://cache-service:5000"
77+ passHostHeader : true
78+
79+ # Usługa monitoringu
80+ monitoring-service :
81+ loadBalancer :
82+ servers :
83+ - url : " http://monitoring-service:5000"
84+ passHostHeader : true
Original file line number Diff line number Diff line change 1+ # # Traefik Static Configuration
2+
3+ # Konfiguracja globalna
4+ global :
5+ checkNewVersion : true
6+ sendAnonymousUsage : false
7+
8+ # Konfiguracja logowania
9+ log :
10+ level : INFO
11+
12+ # Konfiguracja API
13+ api :
14+ insecure : true
15+ dashboard : true
16+
17+ # Konfiguracja dostawców
18+ providers :
19+ docker :
20+ endpoint : " unix:///var/run/docker.sock"
21+ exposedByDefault : false
22+ watch : true
23+ file :
24+ filename : /etc/traefik/dynamic_conf.yml
25+ watch : true
26+
27+ # Konfiguracja punktów wejścia
28+ entryPoints :
29+ web :
30+ address : " :80"
31+ dashboard :
32+ address : " :8080"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Skrypt do pobierania modelu TinyLlama
3+
4+ MODEL_DIR=" /app/models/tinyllama"
5+ MODEL_URL_BASE=" https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0/resolve/main"
6+ MODEL_FILES=(
7+ " tokenizer.model"
8+ " tokenizer_config.json"
9+ " config.json"
10+ " pytorch_model.bin"
11+ )
12+
13+ # Tworzenie katalogu dla modelu
14+ mkdir -p $MODEL_DIR
15+
16+ # Sprawdzenie, czy model już istnieje
17+ if [ ! -f " $MODEL_DIR /pytorch_model.bin" ]; then
18+ echo " Pobieranie modelu TinyLlama..."
19+
20+ # Pobieranie plików modelu
21+ for file in " ${MODEL_FILES[@]} " ; do
22+ echo " Pobieranie $file ..."
23+ wget -q " $MODEL_URL_BASE /$file " -O " $MODEL_DIR /$file "
24+
25+ # Sprawdzenie, czy pobieranie się powiodło
26+ if [ $? -ne 0 ]; then
27+ echo " Błąd podczas pobierania $file !"
28+ exit 1
29+ fi
30+ done
31+
32+ echo " Model pobrany pomyślnie."
33+ else
34+ echo " Model TinyLlama już istnieje, pomijanie pobierania."
35+ fi
Original file line number Diff line number Diff line change 1+ torch == 2.0.1
2+ transformers == 4.30.2
3+ flask == 2.3.2
4+ numpy == 1.24.3
5+ gunicorn == 21.2.0
You can’t perform that action at this time.
0 commit comments