-
Notifications
You must be signed in to change notification settings - Fork 40
/
kragen-gui.sh
executable file
·67 lines (52 loc) · 2.31 KB
/
kragen-gui.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
#!/bin/bash
# Copy .env file and replace the value of the 11th line
# cp ./KRAGEN_Dashboard/Backend/config.json.sample ./KRAGEN_Dashboard/Backend/config.json
# openaikey=$(awk 'NR == 11 {print}' .env)
# openaikey=$(echo $openaikey | cut -d'=' -f2)
# weaviatekey=$(awk 'NR == 16 {print}' .env)
# weaviatekey=$(echo $weaviatekey | cut -d'=' -f2)
# weaviateurl=$(awk 'NR == 15 {print}' .env)
# weaviateurl=$(echo $weaviateurl | cut -d'=' -f2)
# awk -v value="$openaikey" 'NR == 28 {$0 = "\"api_key\": \"" value "\", "} 1' ./KRAGEN_Dashboard/Backend/config.json > temp && mv temp ./KRAGEN_Dashboard/Backend/config.json
# awk -v value="$weaviatekey" 'NR == 15 {$0 = "\"api_key\": \"" value "\", "} 1' ./KRAGEN_Dashboard/Backend/config.json > temp && mv temp ./KRAGEN_Dashboard/Backend/config.json
# awk -v value="$weaviateurl" 'NR == 16 {$0 = "\"url\": \"" value "\", "} 1' ./KRAGEN_Dashboard/Backend/config.json > temp && mv temp ./KRAGEN_Dashboard/Backend/config.json
# Start Flask server in Docker container
# cd ./KRAGEN_Dashboard/Backend
# IMAGE_NAME="kragen-flask-server"
# # Check if the Docker image already exists
# if docker images "$IMAGE_NAME" | grep -q "$IMAGE_NAME"; then
# echo "Docker image $IMAGE_NAME already exists. Skipping build."
# else
# echo "Docker image $IMAGE_NAME does not exist. Building..."
# docker build -t "$IMAGE_NAME" .
# fi
# Source environment variables from the .env file
source .env
# Configure the backend config.json file:
docker compose run kragen config_backend
source config/kragen.env
# Display the OpenAI API key, Weaviate URL, and Weaviate API key for verification
echo "WEAVIATE_URL: $WEAVIATE_URL"
Start the Docker container for the Flask server with docker compose
docker compose run -d -p 5050:5050 execgpt
# # Navigate to the Frontend directory
# cd KRAGEN_Dashboard/Frontend
#
# # Install npm dependencies and start the React application in the background
# npm install
# npm start &
# REACT_PID=$!
#
# # Define a function to clean up background processes on script exit
# function cleanup_react() {
# echo "Exiting..."
# kill $REACT_PID
# exit
# }
#
# # Trap EXIT signal to ensure the cleanup function runs on script exit
# trap cleanup_react EXIT
#
# # Wait for the React process to finish before exiting the script
# wait $REACT_PID
docker compose run -d -p 3000:3000 gui