-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
69 lines (59 loc) · 1.3 KB
/
dev.sh
File metadata and controls
69 lines (59 loc) · 1.3 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
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
#!/bin/bash
function build() {
echo "Building Docker images..."
docker-compose build
}
function start() {
echo "Starting services..."
docker-compose up -d
echo "Waiting for services to start..."
sleep 5
echo "Services are ready!"
}
function stop() {
echo "Stopping services..."
docker-compose down
}
function logs() {
docker-compose logs -f
}
function test() {
echo "Testing the API..."
# Test adding a vector
curl -X POST http://localhost:8080/api/add \
-H "Content-Type: application/json" \
-d '{"key":"test1","text":"This is a test document","metadata":{"source":"test"}}'
echo -e "\n\nWaiting 2 seconds before search test...\n"
sleep 2
# Test searching
curl -X POST http://localhost:8080/api/search \
-H "Content-Type: application/json" \
-d '{"query":"test document","top_k":5,"threshold":0.6}'
}
function cleanup() {
echo "Cleaning up volumes..."
docker-compose down -v
}
case "$1" in
"build")
build
;;
"start")
start
;;
"stop")
stop
;;
"logs")
logs
;;
"test")
test
;;
"cleanup")
cleanup
;;
*)
echo "Usage: $0 {build|start|stop|logs|test|cleanup}"
exit 1
esac