From 2182135112657676dd3e6957e8bc2391dfc7085c Mon Sep 17 00:00:00 2001 From: Thorsten Klein Date: Fri, 23 Feb 2024 08:19:22 +0100 Subject: [PATCH] fix: POSIX compliance for script and make it work with docker compose plugin --- README.md | 2 +- docker-compose.yml | 2 +- embedEtcd.yaml | 2 +- quickstart.sh | 25 +++++++++++++++++-------- 4 files changed, 20 insertions(+), 11 deletions(-) mode change 100644 => 100755 quickstart.sh diff --git a/README.md b/README.md index cec2126..793b2ca 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Rubra is an open-source ChatGPT. It's designed for users who want: - On MacOS you need to have Xcode Command Line Tools installed: `xcode-select --install` - At least 16 GB RAM - At least 10 GB of available disk space -- Docker and Docker Compose installed +- Docker and Docker Compose (>= v2.17.0) installed ### Installation diff --git a/docker-compose.yml b/docker-compose.yml index 6b4d824..ea091a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -103,7 +103,7 @@ services: task-executor: build: context: ./services/backend/task_executor - additional_contexts: + additional_contexts: # requires compose >=v2.17.0 - core=./core dockerfile: Dockerfile image: ghcr.io/rubra-ai/rubra/task_executor:${RUBRA_TAG:-main} diff --git a/embedEtcd.yaml b/embedEtcd.yaml index 023576c..2bd73bb 100644 --- a/embedEtcd.yaml +++ b/embedEtcd.yaml @@ -1,2 +1,2 @@ listen-client-urls: http://0.0.0.0:2379 -advertise-client-urls: http://0.0.0.0:2379 \ No newline at end of file +advertise-client-urls: http://0.0.0.0:2379 diff --git a/quickstart.sh b/quickstart.sh old mode 100644 new mode 100755 index 457b993..486c94d --- a/quickstart.sh +++ b/quickstart.sh @@ -13,6 +13,8 @@ fatal() { exit 1 } +COMPOSE="docker-compose" # Docker Compose command to use - can be either the traditional docker-compose or the new docker compose (plugin) + # --- report system information --- report_system_info() { info "Detecting system information..." @@ -24,6 +26,7 @@ report_system_info() { # For more detailed OS info, you can use /etc/os-release on Linux systems if [ -f /etc/os-release ]; then + # shellcheck disable=SC1091 . /etc/os-release info "OS Name: $NAME" info "OS Version: $VERSION" @@ -98,9 +101,11 @@ check_docker() { fi } -# --- check if docker-compose is installed --- +# --- check if docker-compose or docker compose (plugin) is installed --- check_docker_compose() { - if ! command -v docker-compose >/dev/null 2>&1; then + if command -v docker compose >/dev/null 2>&1; then + COMPOSE="docker compose" + elif command -v docker-compose >/dev/null 2>&1; then fatal "Docker Compose is not installed. Please install Docker Compose before running this script." fi } @@ -204,7 +209,8 @@ setup_milvus_etcd() { # --- pull images and start docker containers --- start_docker_containers() { info "Pulling images and starting Docker containers" - docker-compose pull && docker-compose up -d || fatal "Failed to start Docker containers" + # shellcheck disable=SC2015 + ${COMPOSE} pull && ${COMPOSE} up -d || fatal "Failed to start Docker containers" } # --- helper function to check if all containers in the rubra network are running --- @@ -230,11 +236,12 @@ check_containers_running() { # --- helper function to wait for all containers to be running --- wait_for_containers_to_run() { - local retries=5 - local wait_seconds=5 - local post_wait_seconds=15 # Additional wait time after containers are confirmed running + retries=5 + wait_seconds=5 + post_wait_seconds=15 # Additional wait time after containers are confirmed running - for ((i=0; i