From d2cd1d669f761b153bf8f92107105c2e8b19d6a1 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Wed, 14 May 2025 21:09:03 -0400 Subject: [PATCH] Update Signed-off-by: Yuan Tang --- install.sh | 147 ++++++++++++++++++++++------------------------------- 1 file changed, 62 insertions(+), 85 deletions(-) diff --git a/install.sh b/install.sh index 912ab3fcf..b9d1b42b8 100755 --- a/install.sh +++ b/install.sh @@ -38,6 +38,67 @@ wait_for_service() { return 0 } +usage() { + cat << EOF +๐Ÿ“š Llama-Stack Deployment Script + +Description: + This script sets up and deploys Llama-Stack with Ollama integration in containers. + It handles both Docker and Podman runtimes and includes automatic platform detection. + +Usage: + $(basename "$0") [OPTIONS] + +Options: + -p, --port PORT Server port for Llama-Stack (default: ${PORT}) + -o, --ollama-port PORT Ollama service port (default: ${OLLAMA_PORT}) + -m, --model MODEL Model alias to use (default: ${MODEL_ALIAS}) + -i, --image IMAGE Server image (default: ${SERVER_IMAGE}) + -t, --timeout SECONDS Service wait timeout in seconds (default: ${WAIT_TIMEOUT}) + -h, --help Show this help message + +For more information: + Documentation: https://llama-stack.readthedocs.io/ + GitHub: https://github.com/llamastack/llamastack + +Report issues: + https://github.com/llamastack/llamastack/issues +EOF +} + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + case $1 in + -h|--help) + usage + exit 0 + ;; + -p|--port) + PORT="$2" + shift 2 + ;; + -o|--ollama-port) + OLLAMA_PORT="$2" + shift 2 + ;; + -m|--model) + MODEL_ALIAS="$2" + shift 2 + ;; + -i|--image) + SERVER_IMAGE="$2" + shift 2 + ;; + -t|--timeout) + WAIT_TIMEOUT="$2" + shift 2 + ;; + *) + die "Unknown option: $1" + ;; + esac +done + if command -v docker &> /dev/null; then ENGINE="docker" elif command -v podman &> /dev/null; then @@ -142,88 +203,4 @@ log "๐Ÿ‘‰ API endpoint: http://localhost:${PORT}" log "๐Ÿ“– Documentation: https://llama-stack.readthedocs.io/en/latest/references/index.html" log "๐Ÿ’ป To access the llamaโ€‘stack CLI, exec into the container:" log " $ENGINE exec -ti llama-stack bash" -log "" -usage() { - cat << EOF -๐Ÿ“š Llama-Stack Deployment Script v${VERSION} - -Description: - This script sets up and deploys Llama-Stack with Ollama integration in containers. - It handles both Docker and Podman runtimes and includes automatic platform detection. - -Usage: - $(basename "$0") [OPTIONS] - -Options: - -p, --port PORT Server port for Llama-Stack (default: ${DEFAULT_PORT}) - -o, --ollama-port PORT Ollama service port (default: ${DEFAULT_OLLAMA_PORT}) - -m, --model MODEL Model alias to use (default: ${DEFAULT_MODEL_ALIAS}) - -i, --image IMAGE Server image (default: ${DEFAULT_SERVER_IMAGE}) - -t, --timeout SECONDS Service wait timeout in seconds (default: ${DEFAULT_WAIT_TIMEOUT}) - -c, --config FILE Config file path (default: ${CONFIG_FILE}) - -v, --verbose Enable verbose output - -h, --help Show this help message - --version Show version information - -Configuration: - The script can be configured using either command-line arguments or a config file. - Config file location: ${CONFIG_FILE} - Configuration precedence: Command-line > Config file > Default values - -Environment Requirements: - - Docker or Podman installed and running - - Network connectivity for pulling images - - Available ports for services - - Sufficient system resources for running containers - -Examples: - 1. Basic usage with default settings: - $ $(basename "$0") - - 2. Custom ports and model: - $ $(basename "$0") --port 8080 --ollama-port 11435 --model "llama3.2:7b" - - 3. Using verbose mode with custom timeout: - $ $(basename "$0") -v --timeout 600 - - 4. Specify custom server image: - $ $(basename "$0") --image "llamastack/distribution-ollama:latest" - -Configuration File Example: - # Contents for ${CONFIG_FILE} - PORT=8080 - OLLAMA_PORT=11435 - MODEL_ALIAS="llama3.2:7b" - WAIT_TIMEOUT=600 - SERVER_IMAGE="llamastack/distribution-ollama:latest" - -Services: - 1. Ollama Server - - Runs the Ollama service for model hosting - - Default port: ${DEFAULT_OLLAMA_PORT} - - Container name: ollama-server - - 2. Llama-Stack - - Runs the main Llama-Stack service - - Default port: ${DEFAULT_PORT} - - Container name: llama-stack - -Network: - - Creates a Docker/Podman network named 'llama-net' - - All containers are connected to this network - - Internal communication uses container names as hostnames - -Logs and Debugging: - - Use -v flag for verbose output - - Container logs are available using: - $ docker/podman logs ollama-server - $ docker/podman logs llama-stack - -For more information: - Documentation: https://llama-stack.readthedocs.io/ - GitHub: https://github.com/llamastack/llamastack - -Report issues: - https://github.com/llamastack/llamastack/issues -EOF -} \ No newline at end of file +log "" \ No newline at end of file