From 4ea7ed0ea5cfd79d43b0375704317f72bdd79371 Mon Sep 17 00:00:00 2001 From: Ivan Charapanau Date: Fri, 2 Aug 2024 20:53:10 +0200 Subject: [PATCH] feat: container name prefix fix: linking harbor instead of harbor.sh --- .env | 1 + compose.aphrodite.yml | 2 +- compose.bionicgpt.yml | 18 +++++++++--------- compose.hollama.yml | 2 +- compose.langfuse.yml | 4 ++-- compose.librechat.yml | 10 +++++----- compose.litellm.yml | 4 ++-- compose.llamacpp.yml | 2 +- compose.lmdeploy.yml | 2 +- compose.ollama.yml | 2 +- compose.searxng.yml | 2 +- compose.tgi.yml | 2 +- compose.tts.yml | 2 +- compose.vllm.yml | 2 +- compose.webui.yml | 2 +- harbor.sh | 8 ++++++-- open-webui/config.json | 8 +++++++- 17 files changed, 42 insertions(+), 31 deletions(-) diff --git a/.env b/.env index c06c6ca..fc2c923 100644 --- a/.env +++ b/.env @@ -48,6 +48,7 @@ HARBOR_ASSISTANTS_KEY="" HARBOR_UI_MAIN="webui" HARBOR_UI_AUTOOPEN=false HARBOR_SERVICES_DEFAULT="ollama;webui" +HARBOR_CONTAINER_PREFIX="harbor" # OpenAI # --------------------- diff --git a/compose.aphrodite.yml b/compose.aphrodite.yml index 4110df1..1fe47cc 100644 --- a/compose.aphrodite.yml +++ b/compose.aphrodite.yml @@ -1,7 +1,7 @@ services: aphrodite: image: alpindale/aphrodite-engine - container_name: aphrodite + container_name: ${HARBOR_CONTAINER_PREFIX}.aphrodite env_file: ./.env ipc: host ports: diff --git a/compose.bionicgpt.yml b/compose.bionicgpt.yml index 158bf0b..9e9e9cd 100644 --- a/compose.bionicgpt.yml +++ b/compose.bionicgpt.yml @@ -1,6 +1,6 @@ services: bionicgpt: - container_name: bionicgpt + container_name: ${HARBOR_CONTAINER_PREFIX}.bionicgpt image: ghcr.io/bionic-gpt/bionicgpt-envoy:1.7.41 ports: - ${HARBOR_BIONICGPT_HOST_PORT}:7700 @@ -12,7 +12,7 @@ services: bi-app: image: ghcr.io/bionic-gpt/bionicgpt:1.7.41 - container_name: bi-app + container_name: ${HARBOR_CONTAINER_PREFIX}.bi-app environment: SIGNOUT_URL: /auth/sign_out ENABLE_BARRICADE: 1 @@ -26,25 +26,25 @@ services: - harbor-network bi-llm-api: - container_name: bi-llm-api + container_name: ${HARBOR_CONTAINER_PREFIX}.bi-llm-api image: ghcr.io/bionic-gpt/llama-3-8b-chat:1.1.1 networks: - harbor-network bi-embeddings-api: - container_name: bi-embeddings-api + container_name: ${HARBOR_CONTAINER_PREFIX}.bi-embeddings-api image: ghcr.io/bionic-gpt/bionicgpt-embeddings-api:cpu-0.6 networks: - harbor-network bi-chunking-engine: - container_name: bi-chunking-engine + container_name: ${HARBOR_CONTAINER_PREFIX}.bi-chunking-engine image: downloads.unstructured.io/unstructured-io/unstructured-api:4ffd8bc networks: - harbor-network bi-postgres: - container_name: bi-postgres + container_name: ${HARBOR_CONTAINER_PREFIX}.bi-postgres image: ankane/pgvector platform: linux/amd64 environment: @@ -62,7 +62,7 @@ services: - ./bionicgpt/db:/var/lib/postgresql/data bi-barricade: - container_name: bi-barricade + container_name: ${HARBOR_CONTAINER_PREFIX}.bi-barricade image: purtontech/barricade:1.2.10 environment: # This secret key is used to encrypt cookies. @@ -80,7 +80,7 @@ services: # Sets up our database tables bi-migrations: - container_name: bi-migrations + container_name: ${HARBOR_CONTAINER_PREFIX}.bi-migrations image: ghcr.io/bionic-gpt/bionicgpt-db-migrations:1.7.41 environment: DATABASE_URL: postgresql://postgres:testpassword@bi-postgres:5432/bionic-gpt?sslmode=disable @@ -92,7 +92,7 @@ services: # Parses documents into chunks and creates embeddings. bi-pipeline-job: - container_name: bi-pipeline-job + container_name: ${HARBOR_CONTAINER_PREFIX}.bi-pipeline-job image: ghcr.io/bionic-gpt/bionicgpt-pipeline-job:1.7.41 environment: APP_DATABASE_URL: postgresql://bionic_application:testpassword@bi-postgres:5432/bionic-gpt?sslmode=disable diff --git a/compose.hollama.yml b/compose.hollama.yml index 760235e..814d05f 100644 --- a/compose.hollama.yml +++ b/compose.hollama.yml @@ -2,7 +2,7 @@ services: hollama: image: ghcr.io/fmaclen/hollama:latest env_file: ./.env - container_name: hollama + container_name: ${HARBOR_CONTAINER_PREFIX}.hollama ports: - ${HARBOR_HOLLAMA_HOST_PORT}:4173 networks: diff --git a/compose.langfuse.yml b/compose.langfuse.yml index 2fda342..828b4f6 100644 --- a/compose.langfuse.yml +++ b/compose.langfuse.yml @@ -2,7 +2,7 @@ services: langfuse: image: langfuse/langfuse env_file: ./.env - container_name: langfuse + container_name: ${HARBOR_CONTAINER_PREFIX}.langfuse ports: - ${HARBOR_LANGFUSE_HOST_PORT}:3000 depends_on: @@ -19,7 +19,7 @@ services: langfusedb: image: postgres restart: always - container_name: langfusedb + container_name: ${HARBOR_CONTAINER_PREFIX}.langfusedb healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 1s diff --git a/compose.librechat.yml b/compose.librechat.yml index 2c4c8e8..e740cbc 100644 --- a/compose.librechat.yml +++ b/compose.librechat.yml @@ -1,6 +1,6 @@ services: librechat: - container_name: librechat + container_name: ${HARBOR_CONTAINER_PREFIX}.librechat ports: - "${HARBOR_LIBRECHAT_HOST_PORT}:${HARBOR_LIBRECHAT_HOST_PORT}" depends_on: @@ -42,7 +42,7 @@ services: - ./librechat/logs:/app/api/logs lcdb: - container_name: lcdb + container_name: ${HARBOR_CONTAINER_PREFIX}.lcdb image: mongo volumes: - ./librechat/data:/data/db @@ -51,7 +51,7 @@ services: - harbor-network lcsearch: - container_name: lcsearch + container_name: ${HARBOR_CONTAINER_PREFIX}.lcsearch image: getmeili/meilisearch:v1.7.3 environment: - MEILI_HOST=http://lcsearch:7700 @@ -62,7 +62,7 @@ services: - harbor-network lcvector: - container_name: lcvector + container_name: ${HARBOR_CONTAINER_PREFIX}.lcvector image: ankane/pgvector:latest environment: POSTGRES_DB: mydatabase @@ -74,7 +74,7 @@ services: - harbor-network lcrag: - container_name: lcrag + container_name: ${HARBOR_CONTAINER_PREFIX}.lcrag image: ghcr.io/danny-avila/librechat-rag-api-dev-lite:latest environment: - DB_HOST=lcvector diff --git a/compose.litellm.yml b/compose.litellm.yml index afd4b72..25c990a 100644 --- a/compose.litellm.yml +++ b/compose.litellm.yml @@ -2,7 +2,7 @@ services: litellm: image: ghcr.io/berriai/litellm:main-stable env_file: ./.env - container_name: litellm + container_name: ${HARBOR_CONTAINER_PREFIX}.litellm volumes: # Additional config file volumes will be appended when # LiteLLM is combined with other services @@ -31,7 +31,7 @@ services: litellmdb: image: postgres restart: always - container_name: litellmdb + container_name: ${HARBOR_CONTAINER_PREFIX}.litellmdb healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 3s diff --git a/compose.llamacpp.yml b/compose.llamacpp.yml index 1d10d4e..c17738d 100644 --- a/compose.llamacpp.yml +++ b/compose.llamacpp.yml @@ -1,7 +1,7 @@ services: llamacpp: image: ghcr.io/ggerganov/llama.cpp:full-cuda - container_name: llamacpp + container_name: ${HARBOR_CONTAINER_PREFIX}.llamacpp volumes: - ${HARBOR_HF_CACHE}:/app/models - ${HARBOR_LLAMACPP_CACHE}:/root/.cache/llama.cpp diff --git a/compose.lmdeploy.yml b/compose.lmdeploy.yml index 1a9aac0..dd27c0f 100644 --- a/compose.lmdeploy.yml +++ b/compose.lmdeploy.yml @@ -1,7 +1,7 @@ services: lmdeploy: image: openmmlab/lmdeploy:latest - container_name: lmdeploy + container_name: ${HARBOR_CONTAINER_PREFIX}.lmdeploy volumes: - ${HARBOR_HF_CACHE}:/root/.cache/huggingface ports: diff --git a/compose.ollama.yml b/compose.ollama.yml index 2c28301..ea5fb13 100644 --- a/compose.ollama.yml +++ b/compose.ollama.yml @@ -1,6 +1,6 @@ services: ollama: - container_name: ollama + container_name: ${HARBOR_CONTAINER_PREFIX}.ollama env_file: ./.env volumes: - ${HARBOR_OLLAMA_CACHE}:/root/.ollama diff --git a/compose.searxng.yml b/compose.searxng.yml index 48f39ff..0dff951 100644 --- a/compose.searxng.yml +++ b/compose.searxng.yml @@ -1,6 +1,6 @@ services: searxng: - container_name: searxng + container_name: ${HARBOR_CONTAINER_PREFIX}.searxng env_file: ./.env image: searxng/searxng environment: diff --git a/compose.tgi.yml b/compose.tgi.yml index 82383fa..db58236 100644 --- a/compose.tgi.yml +++ b/compose.tgi.yml @@ -1,6 +1,6 @@ services: tgi: - container_name: tgi + container_name: ${HARBOR_CONTAINER_PREFIX}.tgi env_file: ./.env image: ghcr.io/huggingface/text-generation-inference:2.2.0 command: ${HARBOR_TGI_MODEL_SPECIFIER} ${HARBOR_TGI_EXTRA_ARGS} diff --git a/compose.tts.yml b/compose.tts.yml index 0c4a2da..d72d146 100644 --- a/compose.tts.yml +++ b/compose.tts.yml @@ -1,7 +1,7 @@ services: tts: image: ghcr.io/matatonic/openedai-speech - container_name: tts + container_name: ${HARBOR_CONTAINER_PREFIX}.tts env_file: ./.env ports: - ${HARBOR_TTS_HOST_PORT}:8000 diff --git a/compose.vllm.yml b/compose.vllm.yml index 127ad2f..0040fa0 100644 --- a/compose.vllm.yml +++ b/compose.vllm.yml @@ -1,6 +1,6 @@ services: vllm: - container_name: vllm + container_name: ${HARBOR_CONTAINER_PREFIX}.vllm env_file: ./.env image: vllm/vllm-openai:latest ports: diff --git a/compose.webui.yml b/compose.webui.yml index 68624c8..b5566af 100644 --- a/compose.webui.yml +++ b/compose.webui.yml @@ -3,7 +3,7 @@ services: image: ghcr.io/open-webui/open-webui:main env_file: - ./.env - container_name: webui + container_name: ${HARBOR_CONTAINER_PREFIX}.webui volumes: - ./open-webui:/app/backend/data - ./open-webui/start_webui.sh:/app/start_webui.sh diff --git a/harbor.sh b/harbor.sh index c8c3d35..432c56d 100755 --- a/harbor.sh +++ b/harbor.sh @@ -180,6 +180,7 @@ run_dive() { link_cli() { local target_dir="$HOME/.local/bin" + local script_name="harbor" local script_path="$harbor_home/harbor.sh" # Check if target directory exists in PATH @@ -216,8 +217,10 @@ get_service_url() { return 0 fi + local target_name="$default_container_prefix.$1" + # Check if the specified service is running - if ! echo "$services" | grep -q "^$1$"; then + if ! echo "$services" | grep -q "^$target_name$"; then echo "Service '$1' is not currently running." echo "Available services:" echo "$services" @@ -225,7 +228,7 @@ get_service_url() { fi # Get the port mapping for the service - port=$(docker port "$1" | grep -oP '0.0.0.0:\K\d+' | head -n 1) + port=$(docker port "$target_name" | grep -oP '0.0.0.0:\K\d+' | head -n 1) if [ -z "$port" ]; then echo "No port mapping found for service '$1'." @@ -848,6 +851,7 @@ cd $harbor_home default_options=($(env_manager get services.default | tr ';' ' ')) default_open=$(env_manager get ui.main) default_autoopen=$(env_manager get ui.autoopen) +default_container_prefix=$(env_manager get container.prefix) # Main script logic case "$1" in diff --git a/open-webui/config.json b/open-webui/config.json index 9e26dfe..2308a54 100644 --- a/open-webui/config.json +++ b/open-webui/config.json @@ -1 +1,7 @@ -{} \ No newline at end of file +{ + "ollama": { + "base_urls": [ + "http://ollama:11434" + ] + } +} \ No newline at end of file