-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathstart.sh
executable file
·57 lines (45 loc) · 1011 Bytes
/
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
#!/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=false
run_curl=true
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
cd frontend && yarn && yarn start