-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·83 lines (64 loc) · 1.43 KB
/
start.sh
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
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env bash
set -eou pipefail
function start_weaviate() {
docker compose up -d
while ! curl --fail -o /dev/null -s http://localhost:8080/v1/.well-known/ready; do
echo "Waiting for Weaviate to be ready..."
sleep 1;
done
}
function import_with_curl() {
./import/curl/create_schema.sh
./import/curl/import.sh
}
function import_with_go() {
function cmd_go() {
if ! hash "go" 2>/dev/null; then
docker run --rm -v "$PWD":/app -w /app golang:1.19-alpine $@
else
$@
fi
}
cd ./import/go && cmd_go go mod vendor; go run cmd/main.go && cd -
}
run_go=true
run_curl=false
while [[ "$#" -gt 0 ]]; do
case $1 in
--go) run_curl=false; run_go=true ;;
--curl) run_curl=true ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
start_weaviate
if $run_curl
then
echo "Running import using curl"
import_with_curl
fi
if $run_go
then
echo "Running import using Go client"
import_with_go
fi
##Create and activate virtual env
# check the OS
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
# Windows
python -m venv venv
source venv/Scripts/activate
else
# macOS or Linux
python -m venv venv
source venv/bin/activate
fi
echo "VENV: created and activated"
##Change to python/
cd python
#Install requirements
pip install -r requirements.txt
echo "COMPLETE: requirements.txt install"
#Run python client
## PYTHONUNBUFFERED=1 python app.py
python "app.py"