-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·70 lines (54 loc) · 1.83 KB
/
start.sh
File metadata and controls
executable file
·70 lines (54 loc) · 1.83 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
70
#!/bin/bash
: ${DOMAIN?"Please provide domain in DOMAIN env variable. This will be the domain used for provisioned vms. For localhost use 'nip.io': 'export DOMAIN=\"nip.io\"'"}
: ${HOSTNAME?"Please provide vm hostname HOSTNAME env variable. For localhost use '127.0.0.1': 'export HOSTNAME=\"127.0.0.1\"'"}
export DOMAIN=$DOMAIN
export HOSTNAME=$HOSTNAME
export HOST_IP=$(hostname -I | awk '{print $1}')
export LITELLM_MASTER_KEY=sk-super-secret-key-for-ps
if [[ -n $VERTEX_SA_KEY ]];
then
echo $VERTEX_SA_KEY > vertex_sa_in.txt
cat vertex_sa_in.txt | base64 -d > vertex_sa.json
if [ $? -ne 0 ]; then
mv vertex_sa_in.txt vertex_sa.json
fi
rm vertex_sa_in.txt
fi
rm -rf ./dist
if [ "$LAB_MODE" = "ws" ]; then
cp -r ./ws/ ./dist/
export MATERIALS_PATH=ws
echo "Copied ./ws to ./dist/"
else
cp -r ./all/ ./dist/
export MATERIALS_PATH=university
echo "Copied ./all to ./dist/"
fi
# Copy doc assets (e.g. redis_logo.png) into the served static site
cp -r ./doc/ ./dist/client/
docker-compose up -d --scale jupyter=0 --scale docs=0
echo "Waiting for litellm to be ready (healthcheck)..."
timeout="${LITELLM_READY_TIMEOUT:-100}"
start_ts=$(date +%s)
while true; do
if sudo docker exec litellm wget -qO- 'http://localhost:4000/' >/dev/null 2>&1; then
echo "litellm is ready."
break
else
echo "litellm not ready"
fi
now_ts=$(date +%s)
if [ $((now_ts - start_ts)) -ge "$timeout" ]; then
echo "ERROR: litellm not ready after ${timeout}s" >&2
exit 1
fi
sleep 1
done
sudo docker exec litellm wget 'http://localhost:4000/key/generate' \
--header "Authorization: Bearer $LITELLM_MASTER_KEY" \
--header 'Content-Type: application/json' \
--post-data '{"max_budget":1}'
sudo docker cp litellm:/app/generate .
export LITELLM_API_KEY=$(cat generate | jq '.key' | tr -d '"')
docker-compose up -d jupyter docs
wait $!