Skip to content

Commit

Permalink
Merge branch 'main' of github.com:acorn-io/rubra
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjay920 committed Feb 12, 2024
2 parents b70a5d3 + 3081b3a commit e7a4ea7
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 114 deletions.
144 changes: 57 additions & 87 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,45 @@
version: '3.8'

services:
etcd:
container_name: milvus-etcd
image: quay.io/coreos/etcd:v3.5.5
environment:
- ETCD_AUTO_COMPACTION_MODE=revision
- ETCD_AUTO_COMPACTION_RETENTION=1000
- ETCD_QUOTA_BACKEND_BYTES=4294967296
- ETCD_SNAPSHOT_COUNT=50000
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 30s
timeout: 20s
retries: 3
networks:
- rubra

minio:
container_name: milvus-minio
image: minio/minio:RELEASE.2023-03-20T20-16-18Z
environment:
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
ports:
- "9001:9001"
- "9000:9000"
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
command: minio server /minio_data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
networks:
- rubra

standalone:
container_name: milvus
image: milvusdb/milvus:v2.3.3
command: ["milvus", "run", "standalone"]
command: ['milvus', 'run', 'standalone']
security_opt:
- seccomp:unconfined
environment:
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
ETCD_USE_EMBED: 'true'
ETCD_DATA_DIR: '/etcd'
ETCD_CONFIG_PATH: '/milvus/configs/embedEtcd.yaml'
COMMON_STORAGETYPE: 'local'
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
- milvus:/var/lib/milvus
- etcd:/etcd
- ${DOCKER_VOLUME_DIRECTORY:-.}/embedEtcd.yaml:/milvus/configs/embedEtcd.yaml
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
test: ['CMD', 'curl', '-f', 'http://localhost:9091/healthz']
interval: 30s
start_period: 90s
timeout: 20s
retries: 3
ports:
- "19530:19530"
- "9091:9091"
depends_on:
- "etcd"
- "minio"
- '19530:19530'
- '9091:9091'
networks:
- rubra
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
max-size: '10m'
max-file: '3'

mongodb:
image: mongo
container_name: mongodb
ports:
- "27017:27017"
- '27017:27017'
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/mongodb:/data/db
- mongodb:/data/db
networks:
- rubra

Expand All @@ -86,60 +48,61 @@ services:
container_name: redis
command: redis-server --appendonly yes
ports:
- "6379:6379"
- '6379:6379'
networks:
- rubra

litellm:
image: ghcr.io/berriai/litellm:main-v1.18.9
image: ghcr.io/berriai/litellm:main-v1.22.9
ports:
- "8002:8002"
- '8002:8002'
container_name: litellm
volumes:
- ./llm-config.yaml:/app/config.yaml
command: ["--config", "/app/config.yaml", "--port", "8002", "--num_workers", "8"]
networks:
- rubra

embedding_model:
text-embedding-api:
build:
context: ./backend/app/embedding_model
context: ./services/backend/text_embedding_api
dockerfile: Dockerfile
container_name: embedding_model
image: ghcr.io/rubra-ai/embedding_model:latest
container_name: text-embedding-api
image: ghcr.io/acorn-io/rubra/text_embedding_api:${RUBRA_TAG:-main}
ports:
- "8020:8020"
- '8020:8020'
environment:
- MODEL_NAME=sentence-transformers/all-MiniLM-L6-v2
networks:
- rubra

vector_db:
vector-db-api:
build:
context: ./backend/app/vector_db
context: ./services/backend/vector_db_api
dockerfile: Dockerfile
container_name: vector_db
image: ghcr.io/rubra-ai/vector_db:latest
container_name: vector-db-api
image: ghcr.io/acorn-io/rubra/vector_db_api:${RUBRA_TAG:-main}
ports:
- "8010:8010"
- '8010:8010'
environment:
- MILVUS_HOST=milvus
- EMBEDDING_HOST=embedding_model
- EMBEDDING_HOST=text-embedding-api
networks:
- rubra


rubra_task_executor:
task-executor:
build:
context: ./backend
context: ./services/backend/task_executor
dockerfile: Dockerfile_task_executor
image: ghcr.io/rubra-ai/rubra_task_executor:latest
container_name: rubra_task_executor
image: ghcr.io/acorn-io/rubra/task_executor:${RUBRA_TAG:-main}
container_name: task-executor
environment:
- REDIS_HOST=redis
- MONGODB_HOST=mongodb
- LITELLM_HOST=litellm
- EMBEDDING_HOST=embedding_model
- VECTOR_DB_HOST=vector_db
- EMBEDDING_HOST=text-embedding-api
- VECTOR_DB_HOST=vector-db-api
- MILVUS_HOST=milvus
depends_on:
- redis
Expand All @@ -148,39 +111,46 @@ services:
- rubra


rubra_backend:
api-server:
build:
context: ./backend
context: ./services/backend/api_server
dockerfile: Dockerfile_backend
image: ghcr.io/rubra-ai/rubra_backend:latest
# image: rubra_backend:latest
container_name: rubra_backend
image: ghcr.io/acorn-io/rubra/api_server:${RUBRA_TAG:-main}
container_name: api-server
environment:
- REDIS_HOST=redis
- MONGODB_HOST=mongodb
- LITELLM_HOST=litellm
ports:
- "8000:8000"
- '8000:8000'
depends_on:
- rubra_task_executor
- litellm
- task-executor
networks:
- rubra

rubra_frontend:
ui:
build:
context: ./frontend
context: ./services/frontend/ui
dockerfile: Dockerfile
image: ghcr.io/rubra-ai/rubra_frontend:latest
container_name: rubra_frontend
image: ghcr.io/acorn-io/rubra/ui:${RUBRA_TAG:-main}
container_name: ui
environment:
- RUBRA_BACKEND_HOST=rubra_backend
- LITELLM_HOST=litellm
- RUBRA_BACKEND_HOST=api-server
ports:
- "8501:8501"
depends_on:
- api-server
networks:
- rubra

networks:
rubra:
name: rubra
driver: bridge


volumes:
milvus:
mongodb:
etcd:
2 changes: 2 additions & 0 deletions embedEtcd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
listen-client-urls: http://0.0.0.0:2379
advertise-client-urls: http://0.0.0.0:2379
38 changes: 11 additions & 27 deletions quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,35 +186,21 @@ download_llm_config_yaml() {
curl -sSL "$LLM_CONFIG_URL" -o llm-config.yaml || fatal "Failed to download llm-config.yaml"
}

# --- create local etcd config ---
setup_milvus_etcd() {
info "Creating embedded etcd config"
echo "listen-client-urls: http://0.0.0.0:2379" > embedEtcd.yaml
echo "advertise-client-urls: http://0.0.0.0:2379" >> embedEtcd.yaml
}


# --- 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"
}

# --- helper function to check if the model inference server is healthy ---
check_model_inference_server() {
local retries=12
local wait_seconds=5

for ((i=0; i<retries; i++)); do
local response=$(curl -s -X 'GET' 'http://localhost:8002/health/readiness' -H 'accept: application/json')
local status=$(echo "$response" | grep -o '"status":"healthy"')

if [ -n "$status" ]; then
info "Model inference server is healthy."
return 0
else
warn "Model inference server is not healthy. Status: $status. Retrying in $wait_seconds seconds..."
sleep "$wait_seconds"
fi
done

fatal "Model inference server is not healthy after $retries retries."
}


# --- modify check_containers_running to include the model inference server check ---
# --- helper function to check if all containers in the rubra network are running ---
check_containers_running() {
RUBRA_NETWORK="rubra"
info "Checking if all containers in the '$RUBRA_NETWORK' network are running..."
Expand All @@ -232,10 +218,7 @@ check_containers_running() {
done

info "All containers in the '$RUBRA_NETWORK' network are running."

# Now check the model inference server
check_model_inference_server
return $?
return 0
}

# --- helper function to wait for all containers to be running ---
Expand Down Expand Up @@ -321,6 +304,7 @@ main() {
check_rubra_llamafile_ready # Add this line to perform the check
download_docker_compose_yml
download_llm_config_yaml
setup_milvus_etcd
start_docker_containers
wait_for_containers_to_run
info "Rubra started successfully"
Expand Down

0 comments on commit e7a4ea7

Please sign in to comment.