Skip to content

Commit 18adca7

Browse files
Release version 0.1.14
### Added - Changes in README.md - Changes in containers/browser-service/Dockerfile - Changes in containers/browser-service/requirements.txt - Changes in containers/browser-service/scripts/form-fill.py - Changes in containers/browser-service/supervisord.conf - Changes in containers/llm-orchestrator/.dockerignore - Changes in containers/llm-orchestrator/Dockerfile - Changes in containers/llm-orchestrator/api.py - Changes in containers/novnc/Dockerfile - Changes in containers/test-runner/Dockerfile - Changes in containers/video-chat/Dockerfile - Changes in containers/voice-interface/Dockerfile - Changes in containers/voice-interface/app.py - Changes in containers/web-interface/Dockerfile - Changes in containers/web-terminal/Dockerfile - Changes in containers/web-voice-api/Dockerfile - Changes in containers/web-voice-api/app.py - Changes in dev.sh - Changes in docker-compose.browser-service.yml - Changes in docker-compose.llm-orchestrator.yml - Changes in docker-compose.novnc.yml - Changes in docker-compose.video-chat.yml - Changes in docker-compose.web-interface.yml - Changes in docker-compose.web-terminal.yml - Changes in infra/ansible/playbook.yml - Changes in pyproject.toml - Changes in setup.py
1 parent 6bfa62f commit 18adca7

40 files changed

Lines changed: 479 additions & 49 deletions

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.1.14] - 2025-05-13
6+
7+
### Added
8+
- Changes in README.md
9+
- Changes in containers/browser-service/Dockerfile
10+
- Changes in containers/browser-service/requirements.txt
11+
- Changes in containers/browser-service/scripts/form-fill.py
12+
- Changes in containers/browser-service/supervisord.conf
13+
- Changes in containers/llm-orchestrator/.dockerignore
14+
- Changes in containers/llm-orchestrator/Dockerfile
15+
- Changes in containers/llm-orchestrator/api.py
16+
- Changes in containers/novnc/Dockerfile
17+
- Changes in containers/test-runner/Dockerfile
18+
- Changes in containers/video-chat/Dockerfile
19+
- Changes in containers/voice-interface/Dockerfile
20+
- Changes in containers/voice-interface/app.py
21+
- Changes in containers/web-interface/Dockerfile
22+
- Changes in containers/web-terminal/Dockerfile
23+
- Changes in containers/web-voice-api/Dockerfile
24+
- Changes in containers/web-voice-api/app.py
25+
- Changes in dev.sh
26+
- Changes in docker-compose.browser-service.yml
27+
- Changes in docker-compose.llm-orchestrator.yml
28+
- Changes in docker-compose.novnc.yml
29+
- Changes in docker-compose.video-chat.yml
30+
- Changes in docker-compose.web-interface.yml
31+
- Changes in docker-compose.web-terminal.yml
32+
- Changes in infra/ansible/playbook.yml
33+
- Changes in pyproject.toml
34+
- Changes in setup.py
35+
536
## [0.1.13] - 2025-05-13
637

738
### Added

README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,134 @@ Pierwsze uruchomienie automatycznie skonfiguruje środowisko (venv, zależności
3535

3636
> **WAŻNE:** Projekt wymaga Docker Compose v2 (polecenie `docker compose`). Skrypt `install.sh` instaluje go automatycznie jako plugin CLI.
3737
38+
## Cache pip w Docker
39+
40+
Wszystkie kontenery pythonowe korzystają z cache pip zamontowanego jako volume:
41+
42+
```yaml
43+
volumes:
44+
- ~/.cache/pip:/root/.cache/pip
45+
```
46+
47+
Dzięki temu, podczas budowania obrazu, pip używa lokalnego cache i nie pobiera ponownie tych samych pakietów z internetu, co znacząco przyspiesza development oraz CI/CD.
48+
49+
> **Uwaga:** Flaga `--no-cache-dir` NIE jest używana w poleceniach pip w Dockerfile – cache jest zawsze wykorzystywany.
50+
51+
**Czyszczenie cache pip lokalnie:**
52+
53+
Jeśli chcesz wyczyścić lokalny cache pip (np. w przypadku problemów z zależnościami lub braku miejsca na dysku):
54+
55+
```bash
56+
rm -rf ~/.cache/pip
57+
```
58+
59+
Cache zostanie odbudowany automatycznie przy następnym budowaniu obrazu.
60+
61+
## Optymalizacja buildów Docker – pliki .dockerignore
62+
63+
Każdy katalog z Dockerfile powinien zawierać plik `.dockerignore`, który określa, jakie pliki i katalogi nie powinny być kopiowane do kontekstu budowy obrazu.
64+
65+
Przykładowa zawartość `.dockerignore`:
66+
```
67+
.git
68+
__pycache__
69+
*.pyc
70+
*.pyo
71+
*.pyd
72+
*.db
73+
*.sqlite3
74+
*.log
75+
*.md
76+
tests/
77+
test-examples/
78+
data/
79+
model-configs/
80+
node_modules/
81+
.env
82+
*.egg-info
83+
```
84+
85+
**Dlaczego to ważne?**
86+
- Szybszy build (Docker nie kopiuje niepotrzebnych plików)
87+
- Mniejszy rozmiar obrazu
88+
- Efektywniejsze cache warstw
89+
90+
**Instrukcja:**
91+
- Jeśli dodajesz nowy katalog z Dockerfile, skopiuj powyższy `.dockerignore` lub dostosuj go do swoich potrzeb.
92+
- Możesz edytować istniejący `.dockerignore`, aby ignorować dodatkowe pliki specyficzne dla danego serwisu.
93+
94+
## Testowanie poprawności plików deklaratywnych
95+
96+
W repozytorium znajduje się skrypt:
97+
98+
```bash
99+
./test-declarative.sh
100+
```
101+
102+
Sprawdza on poprawność wszystkich plików YAML/YML, Dockerfile (lint/hadolint) oraz JSON w projekcie. Zalecane uruchamianie przed commitem większych zmian w konfiguracji.
103+
104+
## Testowanie usług i E2E
105+
106+
### Testowanie pojedynczych serwisów Docker
107+
108+
Każdy serwis możesz przetestować osobno w izolowanym środowisku:
109+
110+
```bash
111+
bash containers/test-service.sh <nazwa-serwisu>
112+
```
113+
Np. dla llm-orchestrator:
114+
```bash
115+
bash containers/test-service.sh llm-orchestrator
116+
```
117+
118+
Wymagane są pliki `docker-compose.<service>.yml` (generowane automatycznie dla głównych usług). Skrypt:
119+
- Buduje i uruchamia środowisko tylko dla wybranego serwisu
120+
- Sprawdza, czy kontener działa
121+
- (Opcjonalnie) wykonuje healthcheck HTTP
122+
- Wyświetla logi i zatrzymuje środowisko
123+
124+
### Automatyczne testy wszystkich usług
125+
126+
Aby przetestować wszystkie główne serwisy po kolei (z Ansible healthcheck):
127+
128+
```bash
129+
bash dev.sh
130+
```
131+
132+
Skrypt:
133+
- Uruchamia test-service.sh dla każdego serwisu
134+
- Po każdym teście uruchamia testy E2E Ansible dla danego endpointu
135+
- Zatrzymuje środowisko po każdym teście
136+
137+
### Testy E2E Ansible
138+
139+
W katalogu `infra/ansible/` znajduje się playbook `playbook.yml`, który sprawdza healthchecki HTTP kluczowych usług. Możesz uruchomić go ręcznie:
140+
141+
```bash
142+
ansible-playbook infra/ansible/playbook.yml --extra-vars "endpoints=[{name:'llm-orchestrator',url:'http://localhost:5000/health',status:200}]"
143+
```
144+
145+
## Rozwiązywanie problemów z uruchomieniem kontenerów
146+
147+
- Jeśli kontener natychmiast się wyłącza:
148+
- Uruchom go na pierwszym planie, by zobaczyć błąd:
149+
```bash
150+
docker-compose -f docker-compose.<service>.yml up
151+
```
152+
- Sprawdź, czy wszystkie wymagane pliki istnieją (np. requirements.txt, api.py, katalogi data/, model-configs/)
153+
- Sprawdź logi kontenera:
154+
```bash
155+
docker-compose -f docker-compose.<service>.yml logs
156+
```
157+
- Upewnij się, że port nie jest zajęty przez inną usługę
158+
- Sprawdź, czy requirements.txt zawiera wszystkie zależności
159+
160+
## Struktura kontenerów i testów
161+
- Każdy główny serwis ma własny Dockerfile w `containers/<service>/`
162+
- Dedykowane pliki `docker-compose.<service>.yml` pozwalają na izolowane testowanie
163+
- Skrypt `containers/test-service.sh` automatyzuje testowanie pojedynczych usług
164+
- Skrypt `dev.sh` testuje cały zestaw usług po kolei i uruchamia testy Ansible
165+
38166
## Instalacja środowiska (Python 3.11+ / 3.12 na Ubuntu 24.10+)
39167

40168
Aby uniknąć problemów z kompatybilnością (np. PyAudio vs Python 3.12), zalecane jest użycie Pythona 3.11. **Na Ubuntu 24.10+ dostępny jest tylko Python 3.12 – patrz uwaga poniżej!**
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.git
2+
__pycache__
3+
*.pyc
4+
*.pyo
5+
*.pyd
6+
*.db
7+
*.sqlite3
8+
*.log
9+
*.md
10+
tests/
11+
test-examples/
12+
data/
13+
model-configs/
14+
node_modules/
15+
.env
16+
*.egg-info

containers/browser-service/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3131
ca-certificates \
3232
unzip \
3333
&& rm -rf /var/lib/apt/lists/*
34+
VOLUME /root/.cache/pip
3435

3536
# Install Chrome (new way to add the key)
3637
RUN set -eux; \
@@ -139,8 +140,9 @@ RUN echo '[DEBUG] Copied supervisord.conf configuration file.'
139140

140141
# Install Python dependencies
141142
COPY requirements.txt /app/
143+
VOLUME /root/.cache/pip
142144
RUN echo '[DEBUG] Installing Python dependencies...'; \
143-
pip3 install --no-cache-dir -r /app/requirements.txt; \
145+
pip3 install --cache-dir=/root/.cache/pip -r /app/requirements.txt; \
144146
echo '[DEBUG] Python dependencies installation completed.'
145147

146148
# Configure TigerVNC

containers/browser-service/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ pytest==7.3.1
1010
pyautogui==0.9.54
1111
pytest-html==3.2.0
1212
pytest-xdist==3.3.1
13-
cryptography==41.0.3
13+
cryptography==41.0.3
14+
flask
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from flask import Flask, request, jsonify
2+
3+
app = Flask(__name__)
4+
5+
@app.route('/fill-form', methods=['POST', 'GET'])
6+
def fill_form():
7+
# Tu logika automatycznego wypełniania formularza
8+
return jsonify({"status": "ok", "message": "Form filled (mock response)"}), 200
9+
10+
if __name__ == '__main__':
11+
app.run(host='0.0.0.0', port=5001)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from http.server import BaseHTTPRequestHandler, HTTPServer
2+
import json
3+
4+
class HealthHandler(BaseHTTPRequestHandler):
5+
def do_GET(self):
6+
if self.path == '/health':
7+
self.send_response(200)
8+
self.send_header('Content-type', 'application/json')
9+
self.end_headers()
10+
response = {'status': 'ok', 'service': 'browser-service'}
11+
self.wfile.write(json.dumps(response).encode('utf-8'))
12+
else:
13+
self.send_response(404)
14+
self.end_headers()
15+
16+
def run(server_class=HTTPServer, handler_class=HealthHandler, port=3000):
17+
server_address = ('', port)
18+
httpd = server_class(server_address, handler_class)
19+
print(f'Starting health server on port {port}...')
20+
httpd.serve_forever()
21+
22+
if __name__ == '__main__':
23+
run()

containers/browser-service/supervisord.conf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,12 @@ autorestart=true
2626
stdout_logfile=/var/log/supervisor/form-fill.log
2727
stderr_logfile=/var/log/supervisor/form-fill.error.log
2828
environment=DISPLAY=:99
29-
priority=300
29+
priority=300
30+
31+
[program:health]
32+
command=python3 /opt/scripts/health.py
33+
autostart=true
34+
autorestart=true
35+
stdout_logfile=/var/log/supervisor/health.log
36+
stderr_logfile=/var/log/supervisor/health.error.log
37+
priority=50

containers/llm-orchestrator/.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ __pycache__/
66
*.log
77
*.tmp
88
.env
9+
*.pyo
10+
*.pyd
11+
*.db
12+
*.sqlite3
13+
*.md
14+
tests/
15+
test-examples/
16+
node_modules/
17+
*.egg-info

containers/llm-orchestrator/Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,20 @@ WORKDIR /app
1313

1414
# Kopiowanie plików requirements i instalacja zależności
1515
COPY requirements.txt .
16-
RUN pip install --no-cache-dir -r requirements.txt
16+
VOLUME /root/.cache/pip
17+
RUN pip install --cache-dir=/root/.cache/pip -r requirements.txt
1718

1819
# Kopiowanie pozostałych plików aplikacji
19-
COPY api.py .
20-
COPY detect-hardware.py .
21-
COPY pipeline_generator.py .
20+
COPY api.py ./
21+
COPY detect-hardware.py ./
22+
COPY pipeline_generator.py ./
2223
COPY model-configs/ ./model-configs/
2324
COPY data/ ./data/
2425

2526
# Utworzenie potrzebnych katalogów
2627
RUN mkdir -p /app/models /app/config
2728
RUN mkdir -p /app/model-configs /app/data
2829

29-
# Kopiowanie plików model-configs i data jeśli istnieją
30-
COPY model-configs/ ./model-configs/ || true
31-
COPY data/ ./data/ || true
3230

3331
# Ekspozycja portu API
3432
EXPOSE 5000

0 commit comments

Comments
 (0)