Skip to content

Commit 14ce5fd

Browse files
Using docker compose for embedding test (opea-project#1185)
* Using docker compose for embedding test Signed-off-by: lvliang-intel <liang1.lv@intel.com>
1 parent 533b3b5 commit 14ce5fd

File tree

12 files changed

+169
-218
lines changed

12 files changed

+169
-218
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
include:
5+
- ../../../third_parties/tei/deployment/docker_compose/compose.yaml
6+
- ../../../third_parties/bridgetower/deployment/docker_compose/compose.yaml
7+
8+
x-multimodal-bridgetower-embedding-config: &multimodal-bridgetower-embedding-config
9+
image: ${REGISTRY:-opea}/embedding:${TAG:-latest}
10+
container_name: multimodal-bridgetower-embedding-server
11+
ports:
12+
- ${MM_EMBEDDING_PORT_MICROSERVICE:-10200}:${MM_EMBEDDING_PORT_MICROSERVICE:-10200}
13+
ipc: host
14+
environment:
15+
no_proxy: ${no_proxy}
16+
http_proxy: ${http_proxy}
17+
https_proxy: ${https_proxy}
18+
MULTIMODAL_EMBEDDING: true
19+
EMBEDDING_COMPONENT_NAME: "OPEA_MULTIMODAL_EMBEDDING_BRIDGETOWER"
20+
MMEI_EMBEDDING_ENDPOINT: ${MMEI_EMBEDDING_ENDPOINT}
21+
MM_EMBEDDING_PORT_MICROSERVICE: ${MM_EMBEDDING_PORT_MICROSERVICE}
22+
restart: unless-stopped
23+
24+
services:
25+
tei-embedding-server:
26+
image: ${REGISTRY:-opea}/embedding:${TAG:-latest}
27+
container_name: tei-embedding-server
28+
ports:
29+
- "${EMBEDDER_PORT:-10200}:6000"
30+
ipc: host
31+
environment:
32+
no_proxy: ${no_proxy}
33+
http_proxy: ${http_proxy}
34+
https_proxy: ${https_proxy}
35+
TEI_EMBEDDING_ENDPOINT: ${TEI_EMBEDDING_ENDPOINT}
36+
EMBEDDING_COMPONENT_NAME: "OPEA_TEI_EMBEDDING"
37+
depends_on:
38+
tei-embedding-serving:
39+
condition: service_healthy
40+
restart: unless-stopped
41+
42+
pg-embedding-server:
43+
image: ${REGISTRY:-opea}/embedding:${TAG:-latest}
44+
container_name: pg-embedding-server
45+
ports:
46+
- ${EMBEDDER_PORT:-10200}:6000
47+
ipc: host
48+
environment:
49+
no_proxy: ${no_proxy}
50+
http_proxy: ${http_proxy}
51+
https_proxy: ${https_proxy}
52+
PG_EMBEDDING_MODEL_NAME: ${PG_EMBEDDING_MODEL_NAME}
53+
PREDICTIONGUARD_API_KEY: ${PREDICTIONGUARD_API_KEY}
54+
EMBEDDING_COMPONENT_NAME: "OPEA_PREDICTIONGUARD_EMBEDDING"
55+
restart: unless-stopped
56+
57+
multimodal-bridgetower-embedding-server:
58+
<<: *multimodal-bridgetower-embedding-config
59+
depends_on:
60+
multimodal-bridgetower-embedding-serving:
61+
condition: service_healthy
62+
63+
multimodal-bridgetower-embedding-gaudi-server:
64+
<<: *multimodal-bridgetower-embedding-config
65+
container_name: embedding-multimodal-bridgetower-gaudi-server
66+
depends_on:
67+
multimodal-bridgetower-embedding-gaudi-serving:
68+
condition: service_healthy
69+
70+
networks:
71+
default:
72+
driver: bridge

comps/embeddings/deployment/docker_compose/compose_multimodal_bridgetower.yaml

Lines changed: 0 additions & 44 deletions
This file was deleted.

comps/embeddings/deployment/docker_compose/compose_predictionguard.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

comps/embeddings/deployment/docker_compose/compose_tei.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,48 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
services:
5-
embedding-multimodal-bridgetower:
6-
image: opea/embedding-multimodal-bridgetower-hpu:latest
7-
container_name: embedding-multimodal-bridgetower
5+
6+
multimodal-bridgetower-embedding-serving:
7+
image: ${REGISTRY:-opea}/embedding-multimodal-bridgetower:${TAG:-latest}
8+
container_name: multimodal-bridgetower-embedding-serving
89
ports:
9-
- ${EMBEDDER_PORT}:${EMBEDDER_PORT}
10+
- ${EMBEDDER_PORT:-12400}:${EMBEDDER_PORT:-12400}
1011
ipc: host
1112
environment:
1213
no_proxy: ${no_proxy}
1314
http_proxy: ${http_proxy}
1415
https_proxy: ${https_proxy}
1516
PORT: ${EMBEDDER_PORT}
16-
HABANA_VISIBLE_DEVICES: all
17-
runtime: habana
18-
cap_add:
19-
- SYS_NICE
2017
restart: unless-stopped
2118
healthcheck:
2219
test: ["CMD-SHELL", "http_proxy='' curl -f http://localhost:${EMBEDDER_PORT}/v1/health_check"]
2320
interval: 10s
2421
timeout: 6s
2522
retries: 18
2623
start_period: 30s
27-
embedding:
28-
image: opea/embedding:latest
29-
container_name: embedding-multimodal-bridgetower-server
24+
25+
multimodal-bridgetower-embedding-gaudi-serving:
26+
image: ${REGISTRY:-opea}/embedding-multimodal-bridgetower-hpu:${TAG:-latest}
27+
container_name: multimodal-bridgetower-embedding-gaudi-serving
3028
ports:
31-
- ${MM_EMBEDDING_PORT_MICROSERVICE}:${MM_EMBEDDING_PORT_MICROSERVICE}
29+
- ${EMBEDDER_PORT:-12400}:${EMBEDDER_PORT:-12400}
3230
ipc: host
3331
environment:
3432
no_proxy: ${no_proxy}
3533
http_proxy: ${http_proxy}
3634
https_proxy: ${https_proxy}
37-
MULTIMODAL_EMBEDDING: true
38-
EMBEDDING_COMPONENT_NAME: "OPEA_MULTIMODAL_EMBEDDING_BRIDGETOWER"
39-
MMEI_EMBEDDING_ENDPOINT: ${MMEI_EMBEDDING_ENDPOINT}
40-
MM_EMBEDDING_PORT_MICROSERVICE: ${MM_EMBEDDING_PORT_MICROSERVICE}
35+
PORT: ${EMBEDDER_PORT}
36+
HABANA_VISIBLE_DEVICES: all
37+
runtime: habana
38+
cap_add:
39+
- SYS_NICE
4140
restart: unless-stopped
42-
depends_on:
43-
embedding-multimodal-bridgetower:
44-
condition: service_healthy
41+
healthcheck:
42+
test: ["CMD-SHELL", "http_proxy='' curl -f http://localhost:${EMBEDDER_PORT}/v1/health_check"]
43+
interval: 10s
44+
timeout: 6s
45+
retries: 18
46+
start_period: 30s
4547

4648
networks:
4749
default:

comps/third_parties/bridgetower/deployment/docker_compose/compose_intel_cpu.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

comps/third_parties/bridgetower/deployment/docker_compose/compose_intel_hpu.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
services:
5+
tei-embedding-serving:
6+
image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.5
7+
container_name: tei-embedding-serving
8+
entrypoint: /bin/sh -c "apt-get update && apt-get install -y curl && text-embeddings-router --json-output --model-id ${EMBEDDING_MODEL_ID} --auto-truncate"
9+
ports:
10+
- "${TEI_EMBEDDER_PORT:-12000}:80"
11+
volumes:
12+
- "./data:/data"
13+
shm_size: 1g
14+
environment:
15+
no_proxy: ${no_proxy}
16+
http_proxy: ${http_proxy}
17+
https_proxy: ${https_proxy}
18+
host_ip: ${host_ip}
19+
healthcheck:
20+
test: ["CMD", "curl", "-f", "http://${host_ip}:${TEI_EMBEDDER_PORT}/health"]
21+
interval: 10s
22+
timeout: 6s
23+
retries: 48

tests/embeddings/test_embeddings_multimodal_bridgetower.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ set -x
66

77
WORKPATH=$(dirname "$PWD")
88
ip_address=$(hostname -I | awk '{print $1}')
9-
export your_mmei_port=8089
9+
export your_mmei_port=12400
1010
export EMBEDDER_PORT=$your_mmei_port
1111
export MMEI_EMBEDDING_ENDPOINT="http://$ip_address:$your_mmei_port"
12-
export your_embedding_port_microservice=6609
12+
export your_embedding_port_microservice=10202
1313
export MM_EMBEDDING_PORT_MICROSERVICE=$your_embedding_port_microservice
1414
unset http_proxy
1515

1616
function build_mm_docker_images() {
1717
cd $WORKPATH
1818
echo $(pwd)
19-
docker build --no-cache -t opea/embedding:latest -f comps/embeddings/src/Dockerfile .
19+
docker build --no-cache -t opea/embedding:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/embeddings/src/Dockerfile .
2020
if [ $? -ne 0 ]; then
2121
echo "opea/embedding built fail"
2222
exit 1
@@ -44,9 +44,10 @@ function build_docker_images() {
4444
}
4545

4646
function start_service() {
47+
service_name="multimodal-bridgetower-embedding-serving multimodal-bridgetower-embedding-server"
4748
cd $WORKPATH
4849
cd comps/embeddings/deployment/docker_compose/
49-
docker compose -f compose_multimodal_bridgetower.yaml up -d
50+
docker compose up ${service_name} -d
5051
sleep 30
5152
}
5253

@@ -60,8 +61,8 @@ function validate_microservice_text_embedding() {
6061
echo "Result correct."
6162
else
6263
echo "Result wrong. Received was $result"
63-
docker logs embedding-multimodal-bridgetower
64-
docker logs embedding-multimodal-bridgetower-server
64+
docker logs multimodal-bridgetower-embedding-serving
65+
docker logs multimodal-bridgetower-embedding-server
6566
exit 1
6667
fi
6768
}
@@ -76,8 +77,8 @@ function validate_microservice_image_text_pair_embedding() {
7677
echo "Result correct."
7778
else
7879
echo "Result wrong. Received was $result"
79-
docker logs embedding-multimodal-bridgetower
80-
docker logs embedding-multimodal-bridgetower-server
80+
docker logs multimodal-bridgetower-embedding-serving
81+
docker logs multimodal-bridgetower-embedding-server
8182
exit 1
8283
fi
8384
}
@@ -92,8 +93,8 @@ function validate_microservice_b64_image_text_pair_embedding() {
9293
echo "Result correct."
9394
else
9495
echo "Result wrong. Received was $result"
95-
docker logs embedding-multimodal-bridgetower
96-
docker logs embedding-multimodal-bridgetower-server
96+
docker logs multimodal-bridgetower-embedding-serving
97+
docker logs multimodal-bridgetower-embedding-server
9798
exit 1
9899
fi
99100
}
@@ -105,7 +106,7 @@ function validate_microservice() {
105106
}
106107

107108
function stop_docker() {
108-
cid=$(docker ps -aq --filter "name=embedding-multimodal-bridgetower")
109+
cid=$(docker ps -aq --filter "name=multimodal-bridgetower-embedding-*")
109110
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
110111
}
111112

0 commit comments

Comments
 (0)