diff --git a/SearchQnA/README.md b/SearchQnA/README.md index 3b49c17ba..9498905d4 100644 --- a/SearchQnA/README.md +++ b/SearchQnA/README.md @@ -63,22 +63,22 @@ bash ./docker/set_env.sh ## Deploy SearchQnA on Gaudi -If your version of `Habana Driver` < 1.16.0 (check with `hl-smi`), run the following command directly to start SearchQnA services. Please find corresponding [docker_compose.yaml](./docker/gaudi/docker_compose.yaml). +If your version of `Habana Driver` < 1.16.0 (check with `hl-smi`), run the following command directly to start SearchQnA services. Please find corresponding [compose.yaml](./docker/gaudi/compose.yaml). ```bash cd GenAIExamples/SearchQnA/docker/gaudi/ -docker compose -f docker_compose.yaml up -d +docker compose up -d ``` If your version of `Habana Driver` >= 1.16.0, refer to the [Gaudi Guide](./docker/gaudi/README.md) to build docker images from source. ## Deploy SearchQnA on Xeon -Please find corresponding [docker_compose.yaml](./docker/xeon/docker_compose.yaml). +Please find corresponding [compose.yaml](./docker/xeon/compose.yaml). ```bash cd GenAIExamples/SearchQnA/docker/xeon/ -docker compose -f docker_compose.yaml up -d +docker compose up -d ``` Refer to the [Xeon Guide](./docker/xeon/README.md) for more instructions on building docker images from source. @@ -116,6 +116,6 @@ curl http://${host_ip}:3001/embed \ -H 'Content-Type: application/json' ``` -2. (Docker only) If all microservices work well, please check the port ${host_ip}:3008, the port may be allocated by other users, you can modify the `docker_compose.yaml`. +2. (Docker only) If all microservices work well, please check the port ${host_ip}:3008, the port may be allocated by other users, you can modify the `compose.yaml`. -3. (Docker only) If you get errors like "The container name is in use", please change container name in `docker_compose.yaml`. +3. (Docker only) If you get errors like "The container name is in use", please change container name in `compose.yaml`. diff --git a/SearchQnA/docker/gaudi/README.md b/SearchQnA/docker/gaudi/README.md index 5073c4725..e52da5943 100644 --- a/SearchQnA/docker/gaudi/README.md +++ b/SearchQnA/docker/gaudi/README.md @@ -109,7 +109,7 @@ export LLM_SERVICE_PORT=3007 ```bash cd GenAIExamples/SearchQnA/docker/gaudi/ -docker compose -f docker_compose.yaml up -d +docker compose up -d ``` ## 🚀 Test MicroServices diff --git a/SearchQnA/docker/gaudi/docker_compose.yaml b/SearchQnA/docker/gaudi/compose.yaml similarity index 100% rename from SearchQnA/docker/gaudi/docker_compose.yaml rename to SearchQnA/docker/gaudi/compose.yaml diff --git a/SearchQnA/docker/xeon/README.md b/SearchQnA/docker/xeon/README.md index b615da255..0425ee769 100644 --- a/SearchQnA/docker/xeon/README.md +++ b/SearchQnA/docker/xeon/README.md @@ -88,7 +88,7 @@ export LLM_SERVICE_PORT=3007 ```bash cd GenAIExamples/SearchQnA/docker/xeon/ -docker compose -f docker_compose.yaml up -d +docker compose up -d ``` ## 🚀 Test MicroServices diff --git a/SearchQnA/docker/xeon/docker_compose.yaml b/SearchQnA/docker/xeon/compose.yaml similarity index 100% rename from SearchQnA/docker/xeon/docker_compose.yaml rename to SearchQnA/docker/xeon/compose.yaml diff --git a/SearchQnA/tests/test_searchqna_on_gaudi.sh b/SearchQnA/tests/test_searchqna_on_gaudi.sh index 929c7e715..379a846e8 100644 --- a/SearchQnA/tests/test_searchqna_on_gaudi.sh +++ b/SearchQnA/tests/test_searchqna_on_gaudi.sh @@ -20,10 +20,10 @@ function build_docker_images() { docker build --no-cache -t opea/reranking-tei:latest -f comps/reranks/tei/docker/Dockerfile . docker build --no-cache -t opea/llm-tgi:latest -f comps/llms/text-generation/tgi/Dockerfile . - cd .. - git clone https://github.com/huggingface/tei-gaudi - cd tei-gaudi/ - docker build --no-cache -f Dockerfile-hpu -t opea/tei-gaudi:latest . +# cd .. +# git clone https://github.com/huggingface/tei-gaudi +# cd tei-gaudi/ +# docker build --no-cache -f Dockerfile-hpu -t opea/tei-gaudi:latest . docker pull ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 docker pull ghcr.io/huggingface/tgi-gaudi:2.0.1 @@ -37,6 +37,12 @@ function build_docker_images() { } function start_services() { + # build tei-gaudi for each test instead of pull from local registry + cd $WORKPATH + git clone https://github.com/huggingface/tei-gaudi + cd tei-gaudi/ + docker build --no-cache -f Dockerfile-hpu -t opea/tei-gaudi:latest . + cd $WORKPATH/docker/gaudi export GOOGLE_CSE_ID=$GOOGLE_CSE_ID export GOOGLE_API_KEY=$GOOGLE_API_KEY @@ -63,17 +69,23 @@ function start_services() { # sed -i "s/backend_address/$ip_address/g" $WORKPATH/docker/ui/svelte/.env - # Replace the container name with a test-specific name - # echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG" - # sed -i "s#image: opea/chatqna:latest#image: opea/chatqna:${IMAGE_TAG}#g" docker_compose.yaml - # sed -i "s#image: opea/chatqna-ui:latest#image: opea/chatqna-ui:${IMAGE_TAG}#g" docker_compose.yaml - # sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" docker_compose.yaml + if [[ "$IMAGE_REPO" != "" ]]; then + # Replace the container name with a test-specific name + echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG" + sed -i "s#image: opea/searchqna:latest#image: opea/searchqna:${IMAGE_TAG}#g" compose.yaml + sed -i "s#image: opea/searchqna-ui:latest#image: opea/searchqna-ui:${IMAGE_TAG}#g" compose.yaml + sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" compose.yaml + sed -i "s#image: ${IMAGE_REPO}opea/tei-gaudi:latest#image: opea/tei-gaudi:latest#g" compose.yaml + echo "cat compose.yaml" + cat compose.yaml + fi + # Start Docker Containers - docker compose -f docker_compose.yaml up -d + docker compose up -d n=0 until [[ "$n" -ge 500 ]]; do - docker logs tgi-gaudi-server > tgi_service_start.log - if grep -q Connected tgi_service_start.log; then + docker logs tgi-gaudi-server > $LOG_PATH/tgi_service_start.log + if grep -q Connected $LOG_PATH/tgi_service_start.log; then break fi sleep 1s @@ -126,22 +138,14 @@ function validate_megaservice() { function stop_docker() { cd $WORKPATH/docker/gaudi - container_list=$(cat docker_compose.yaml | grep container_name | cut -d':' -f2) - for container_name in $container_list; do - cid=$(docker ps -aq --filter "name=$container_name") - if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi - done + docker compose down } function main() { stop_docker - build_docker_images - # begin_time=$(date +%s) + if [[ "$IMAGE_REPO" == "" ]]; then build_docker_images; fi start_services - # end_time=$(date +%s) - # maximal_duration=$((end_time-begin_time)) - # echo "Mega service start duration is "$maximal_duration"s" && sleep 1s validate_megaservice # validate_frontend diff --git a/SearchQnA/tests/test_searchqna_on_xeon.sh b/SearchQnA/tests/test_searchqna_on_xeon.sh index ea302c929..73a6361f1 100644 --- a/SearchQnA/tests/test_searchqna_on_xeon.sh +++ b/SearchQnA/tests/test_searchqna_on_xeon.sh @@ -55,17 +55,22 @@ function start_services() { # sed -i "s/backend_address/$ip_address/g" $WORKPATH/docker/ui/svelte/.env - # Replace the container name with a test-specific name - # echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG" - # sed -i "s#image: opea/chatqna:latest#image: opea/chatqna:${IMAGE_TAG}#g" docker_compose.yaml - # sed -i "s#image: opea/chatqna-ui:latest#image: opea/chatqna-ui:${IMAGE_TAG}#g" docker_compose.yaml - # sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" docker_compose.yaml + if [[ "$IMAGE_REPO" != "" ]]; then + # Replace the container name with a test-specific name + echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG" + sed -i "s#image: opea/searchqna:latest#image: opea/searchqna:${IMAGE_TAG}#g" compose.yaml + sed -i "s#image: opea/searchqna-ui:latest#image: opea/searchqna-ui:${IMAGE_TAG}#g" compose.yaml + sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" compose.yaml + echo "cat compose.yaml" + cat compose.yaml + fi + # Start Docker Containers - docker compose -f docker_compose.yaml up -d + docker compose up -d n=0 until [[ "$n" -ge 200 ]]; do - docker logs tgi-service > tgi_service_start.log - if grep -q Connected tgi_service_start.log; then + docker logs tgi-service > $LOG_PATH/tgi_service_start.log + if grep -q Connected $LOG_PATH/tgi_service_start.log; then break fi sleep 1s @@ -116,22 +121,14 @@ function validate_megaservice() { function stop_docker() { cd $WORKPATH/docker/xeon - container_list=$(cat docker_compose.yaml | grep container_name | cut -d':' -f2) - for container_name in $container_list; do - cid=$(docker ps -aq --filter "name=$container_name") - if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi - done + docker compose down } function main() { stop_docker - build_docker_images - # begin_time=$(date +%s) + if [[ "$IMAGE_REPO" == "" ]]; then build_docker_images; fi start_services - # end_time=$(date +%s) - # maximal_duration=$((end_time-begin_time)) - # echo "Mega service start duration is "$maximal_duration"s" && sleep 1s validate_megaservice # validate_frontend