Files
sim/start_simstudio_docker.sh
Waleed Latif 717e17d02a feat(bun): upgrade to bun, reduce docker image size by 95%, upgrade docs & ci (#371)
* migrate to bun

* added envvars to drizzle

* upgrade bun devcontainer feature to a valid one

* added bun, docker not working

* updated envvars, updated to bunder and esnext modules

* fixed build, reinstated otel

* feat: optimized multi-stage docker images

* add coerce for boolean envvar

* feat: add docker-compose configuration for local LLM services and remove legacy Dockerfile and entrypoint script

* feat: add docker-compose files for local and production environments, and implement GitHub Actions for Docker image build and publish

* refactor: remove unused generateStaticParams function from various API routes and maintain dynamic rendering

* cleanup

* upgraded bun

* updated ci

* fixed build

---------

Co-authored-by: Aditya Tripathi <aditya@climactic.co>
2025-05-18 01:01:32 -07:00

70 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SIM_DIR=$SCRIPT_DIR/apps/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 bash -c "cd apps/sim && bun run db:push"
echo "Sim Studio is now running at http://localhost:3000"
echo "To view logs, run: docker compose logs -f simstudio"