forked from simstudioai/sim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_simstudio_docker.sh
More file actions
executable file
·70 lines (61 loc) · 1.9 KB
/
start_simstudio_docker.sh
File metadata and controls
executable file
·70 lines (61 loc) · 1.9 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
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SIM_DIR=$SCRIPT_DIR/sim
# Function to display help
show_help() {
echo "Usage: $0 [OPTIONS]"
echo
echo "Start Sim Studio with Docker containers"
echo
echo "Options:"
echo " -h, --help Show this help message"
echo " --local Use local LLM configuration with Ollama service"
echo
echo "Examples:"
echo " $0 # Start without local LLM"
echo " $0 --local # Start with local LLM (requires GPU)"
echo
echo "Note: When using --local flag, GPU availability is automatically detected"
echo " and appropriate configuration is used."
exit 0
}
# Parse command line arguments
LOCAL=false
while [[ "$#" -gt 0 ]]; do
case $1 in
-h|--help) show_help ;;
--local) LOCAL=true ;;
*) echo "Unknown parameter: $1"; echo "Use -h or --help for usage information"; exit 1 ;;
esac
shift
done
# Check if .env file exists, if not, create from example
if [ ! -f $SIM_DIR/.env ]; then
echo "Creating .env file from .env.example..."
cp $SIM_DIR/.env.example $SIM_DIR/.env
echo "Please update .env file with your configuration."
else
echo ".env file found."
fi
# Stop any running containers
docker compose down
# Build and start containers
if [ "$LOCAL" = true ]; then
if nvidia-smi &> /dev/null; then
# GPU available with local LLM
docker compose --profile local-gpu up --build -d
else
# No GPU available with local LLM
docker compose --profile local-cpu up --build -d
fi
else
docker compose up --build -d
fi
# Wait for database to be ready
echo "Waiting for database to be ready..."
sleep 5
# Apply migrations automatically
echo "Applying database migrations..."
docker compose exec simstudio npm run db:push
echo "Sim Studio is now running at http://localhost:3000"
echo "To view logs, run: docker compose logs -f simstudio"