-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathend.sh
More file actions
executable file
·42 lines (32 loc) · 1.19 KB
/
end.sh
File metadata and controls
executable file
·42 lines (32 loc) · 1.19 KB
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
#!/bin/bash
# Source the .env file to get LLM_PROVIDER
set -a
source .env
set +a
# Determine which profile to use
if [ "$LLM_PROVIDER" = "local" ]; then
PROFILE="--profile local"
BACKEND_SERVICE="backend-gpu"
else
PROFILE="--profile openai"
BACKEND_SERVICE="backend"
fi
echo "🛑 Stopping all containers..."
docker-compose $PROFILE down
echo "🗑️ Removing all volumes..."
docker-compose $PROFILE down -v
echo "🧹 Removing all related images..."
# Remove backend images (both GPU and non-GPU versions)
docker rmi $(docker images | grep "${BACKEND_SERVICE}" | awk '{print $3}') 2>/dev/null || true
# Remove frontend image
docker rmi $(docker images | grep 'smart-battery-storage-knowledge-rag_frontend' | awk '{print $3}') 2>/dev/null || true
echo "🧼 Cleaning up unused volumes..."
docker volume prune -f
echo "🧼 Cleaning up unused networks..."
docker network prune -f
echo "🗑️ Removing MongoDB volumes..."
docker volume rm battery-rag-service_mongo_data
echo "🗑️ Removing PostgreSQL volumes..."
docker volume rm battery-rag-service_postgres_data
echo "✨ Cleanup complete! The environment has been completely reset."
echo "To restart the services, run: ./start.sh"