Skip to content

Commit 52087b7

Browse files
update
1 parent a4dfe35 commit 52087b7

4 files changed

Lines changed: 55 additions & 1 deletion

File tree

containers/llm-orchestrator-min/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
torch==2.0.1
22
transformers==4.30.2
3-
accelerate==0.20.3
43
sentencepiece==0.1.99
54
pydantic==1.10.8
65
fastapi==0.100.0

containers/llm-orchestrator/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def index():
7474

7575
app = Flask(__name__)
7676

77+
@app.route('/api/health', methods=['GET'])
7778
@app.route('/health', methods=['GET'])
7879
def health():
7980
return jsonify({"status": "ok"}), 200
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import smtplib
2+
import os
3+
from email.mime.multipart import MIMEMultipart
4+
from email.mime.text import MIMEText
5+
from email.mime.base import MIMEBase
6+
from email import encoders
7+
from typing import List, Optional
8+
9+
def send_email_with_attachments(to_email: str, subject: str, body: str, attachments: Optional[List[str]] = None) -> bool:
10+
smtp_server = os.getenv("SMTP_SERVER")
11+
smtp_port = int(os.getenv("SMTP_PORT", "587"))
12+
smtp_user = os.getenv("SMTP_USER")
13+
smtp_pass = os.getenv("SMTP_PASS")
14+
from_email = os.getenv("EMAIL_FROM", smtp_user)
15+
if not (smtp_server and smtp_user and smtp_pass and to_email):
16+
raise ValueError("Missing SMTP configuration or recipient email")
17+
18+
msg = MIMEMultipart()
19+
msg['From'] = from_email
20+
msg['To'] = to_email
21+
msg['Subject'] = subject
22+
msg.attach(MIMEText(body, 'plain'))
23+
24+
if attachments:
25+
for path in attachments:
26+
part = MIMEBase('application', 'octet-stream')
27+
with open(path, 'rb') as f:
28+
part.set_payload(f.read())
29+
encoders.encode_base64(part)
30+
part.add_header('Content-Disposition', f'attachment; filename="{os.path.basename(path)}"')
31+
msg.attach(part)
32+
33+
with smtplib.SMTP(smtp_server, smtp_port) as server:
34+
server.starttls()
35+
server.login(smtp_user, smtp_pass)
36+
server.send_message(msg)
37+
return True

stop.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ for SERVICE in "${SERVICES[@]}"; do
2727
fi
2828
done
2929

30+
log "Zatrzymywanie środowiska minimalnego (docker-compose.min.yml)..."
31+
if [ -f "docker-compose.min.yml" ]; then
32+
docker-compose -f docker-compose.min.yml down || warn "Nie udało się zatrzymać środowiska minimalnego."
33+
fi
34+
3035
log "Zatrzymywanie wszystkich usług docker-compose..."
3136
docker compose down || docker-compose down || warn "docker-compose down nie powiodło się (brak pliku lub usługi)"
3237

@@ -38,7 +43,19 @@ else
3843
warn "Brak kontenerów powiązanych z projektem coboarding."
3944
fi
4045

46+
# Usuwanie kontenerów z wersji minimalnej
47+
MIN_CONTAINERS="llm-orchestrator-min browser-service novnc"
48+
for CONTAINER in $MIN_CONTAINERS; do
49+
if docker ps -a --filter "name=$CONTAINER" -q | grep -q .; then
50+
log "Usuwanie kontenera $CONTAINER..."
51+
docker rm -f $CONTAINER || warn "Nie udało się usunąć kontenera $CONTAINER."
52+
fi
53+
done
54+
4155
log "Usuwanie nieużywanych sieci docker..."
4256
docker network prune -f || warn "Nie udało się wyczyścić sieci docker."
4357

58+
log "Usuwanie nieużywanych wolumenów docker..."
59+
docker volume prune -f || warn "Nie udało się wyczyścić wolumenów docker."
60+
4461
log "Wszystkie usługi zatrzymane i kontenery usunięte."

0 commit comments

Comments
 (0)