File size: 867 Bytes
30b9f3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
set -euo pipefail
DBOPS=${DBOPS_ROOT:-/data/adaptai/platform/dbops}
BIN_DIR=$DBOPS/binaries/weaviate
BIN=$BIN_DIR/weaviate
DATA=$DBOPS/data/weaviate
LOG=$DBOPS/logs/weaviate
PORT=${WEAVIATE_PORT:-17780}
mkdir -p "$BIN_DIR" "$DATA" "$LOG"
if [ ! -x "$BIN" ]; then
  echo "[weaviate] fetching binary"
  url=$(curl -fsSL https://api.github.com/repos/weaviate/weaviate/releases/latest | grep browser_download_url | grep -E 'linux-amd64(\.tar\.gz)?$' | grep -v sha256 | cut -d '"' -f4 | head -n1)
  tmp=$(mktemp -d)
  curl -fsSL "$url" -o "$tmp/wv"
  if file "$tmp/wv" | grep -q 'gzip compressed data'; then
    tar -xzf "$tmp/wv" -C "$tmp"
    found=$(find "$tmp" -type f -name weaviate | head -n1)
    cp "$found" "$BIN"
  else
    cp "$tmp/wv" "$BIN"
  fi
  chmod +x "$BIN"
  rm -rf "$tmp"
fi
exec "$BIN" --host 0.0.0.0 --port "$PORT" --scheme http