Skip to content

Commit

Permalink
Merge pull request #18 from vectornguyen76/develop
Browse files Browse the repository at this point in the history
Develop triton inference server
  • Loading branch information
vectornguyen76 committed Oct 30, 2023
2 parents 1ab82d3 + 4719c45 commit e841c8b
Show file tree
Hide file tree
Showing 78 changed files with 7,703 additions and 537 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401
ignore = F401
max-line-length = 100
max-complexity = 18
select = B,C,E,F,W,T4,B9
4 changes: 2 additions & 2 deletions .github/workflows/development_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: black --check ./image-search-engine/.

- name: Run flake8
run: flake8 --ignore=E501,W503 ./image-search-engine
run: flake8 --ignore=E501,W503,F401 ./image-search-engine

# - name: Run Pylint
# run: pylint ./image-search-engine/*.py
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
run: black --check ./text-search-engine/.

- name: Run flake8
run: flake8 --ignore=E501,W503 ./text-search-engine
run: flake8 --ignore=E501,W503,F401 ./text-search-engine

# - name: Run Pylint
# run: pylint ./image-search-engine/*.py
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ image-search-engine/assets/uploaded_images/*

# Model
*.pth
*.pt
*.onnx
*.engine

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
142 changes: 142 additions & 0 deletions docker-compose-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
version: "3"
services:
triton-server:
container_name: triton-server
image: nvcr.io/nvidia/tritonserver:23.09-py3
ports:
- 9000:8000
- 9001:8001
- 9002:8002
command: tritonserver --model-repository=/models
volumes:
- ./image-search-engine/model_repository:/models
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

qdrant-vector-database:
container_name: qdrant-vector-database
image: qdrant/qdrant:v1.5.1
ports:
- 6333:6333
- 6334:6334
volumes:
- ./qdrant-vector-database:/qdrant/storage

image-search-engine:
container_name: image-search-container
image: vectornguyen76/image-search-engine
build:
context: ./image-search-engine
dockerfile: Dockerfile
environment:
- QDRANT_URL=http://qdrant-vector-database:6334
- TRITON_SERVER_URL=triton-server:8001
ports:
- 7000:7000
volumes:
- ./image-search-engine/logs:/app/logs
depends_on:
- qdrant-vector-database
profiles:
- dev.frontend
- prod

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
container_name: elasticsearch
environment:
- node.name=elasticsearch
- cluster.name=es-docker-cluster
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
healthcheck:
test: curl --fail http://localhost:9200/_cat/health || exit 1
interval: 10s
timeout: 1s
retries: 10
volumes:
- data-elastic-search:/usr/share/elasticsearch/data

kibana:
image: docker.elastic.co/kibana/kibana:7.10.0
container_name: kibana
ports:
- 5601:5601
environment:
ELASTICSEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
depends_on:
elasticsearch:
condition: service_healthy

text-search-engine:
container_name: text-search-container
image: vectornguyen76/text-search-engine
build:
context: ./text-search-engine
dockerfile: Dockerfile
ports:
- 8000:8000
environment:
ELASTICSEARCH_HOST: http://elasticsearch:9200
depends_on:
elasticsearch:
condition: service_healthy
profiles:
- dev.frontend
- prod

frontend_dev_service:
container_name: frontend_dev_container
image: vectornguyen76/frontend_dev_image
build:
context: ./frontend
dockerfile: Dockerfile.dev
ports:
- 3000:3000
profiles:
- dev.backend

frontend_service:
container_name: frontend_prod_container
image: vectornguyen76/frontend_prod_image
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- 3000:3000
profiles:
- prod

nginx_service:
container_name: nginx_container
image: nginx:1.25.1-alpine
ports:
- 80:80
volumes:
- ./nginx-server/default.conf:/etc/nginx/conf.d/default.conf
- ./nginx-server/log:/var/log/nginx/
depends_on:
- frontend_service
- image-search-engine
- text-search-engine
profiles:
- prod

volumes:
data-elastic-search:
driver: local
qdrant-vector-database:
driver: local
File renamed without changes.
136 changes: 34 additions & 102 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,55 +1,22 @@
version: "3"
services:
triton:
image: nvcr.io/nvidia/tritonserver:22.02-py3
ipc: host
triton-server:
container_name: triton-server
image: nvcr.io/nvidia/tritonserver:23.09-py3
ports:
- 9000:8000
- 9001:8001
- 9002:8002
command: tritonserver --model-repository=/models
volumes:
- ./image-search-engine/model_repository:/models
# deploy:
# resources:
# reservations:
# devices:
# - capabilities: [gpu]

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
container_name: elasticsearch
environment:
- node.name=elasticsearch
- cluster.name=es-docker-cluster
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
healthcheck:
test: curl --fail http://localhost:9200/_cat/health || exit 1
interval: 10s
timeout: 1s
retries: 10
volumes:
- data-elastic-search:/usr/share/elasticsearch/data

kibana:
image: docker.elastic.co/kibana/kibana:7.10.0
container_name: kibana
ports:
- 5601:5601
environment:
ELASTICSEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
depends_on:
elasticsearch:
condition: service_healthy
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

qdrant-vector-database:
container_name: qdrant-vector-database
Expand All @@ -67,73 +34,38 @@ services:
context: ./image-search-engine
dockerfile: Dockerfile
environment:
- QDRANT_HOST=qdrant-vector-database
- QDRANT_URL=http://qdrant-vector-database:6334
- TRITON_SERVER_URL=triton-server:8001
ports:
- 7000:7000
volumes:
- ./image-search-engine/logs:/app/logs
depends_on:
- qdrant-vector-database
profiles:
- dev.frontend
- prod

text-search-engine:
container_name: text-search-container
image: vectornguyen76/text-search-engine
build:
context: ./text-search-engine
dockerfile: Dockerfile
ports:
- 8000:8000
environment:
ELASTICSEARCH_HOST: http://elasticsearch:9200
depends_on:
elasticsearch:
condition: service_healthy
profiles:
- dev.frontend
- prod

frontend_dev_service:
container_name: frontend_dev_container
image: vectornguyen76/frontend_dev_image
build:
context: ./frontend
dockerfile: Dockerfile.dev
ports:
- 3000:3000
profiles:
- dev.backend

frontend_service:
container_name: frontend_prod_container
image: vectornguyen76/frontend_prod_image
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- 3000:3000
profiles:
- prod

nginx_service:
container_name: nginx_container
image: nginx:1.25.1-alpine
ports:
- 80:80
volumes:
- ./nginx-server/default.conf:/etc/nginx/conf.d/default.conf
- ./nginx-server/log:/var/log/nginx/
depends_on:
- frontend_service
- image-search-engine
- text-search-engine
profiles:
- prod
# image-search-engine-gpu:
# container_name: image-search-container-gpu
# image: vectornguyen76/image-search-engine-gpu
# build:
# context: ./image-search-engine
# dockerfile: Dockerfile.gpu
# environment:
# - QDRANT_URL=http://qdrant-vector-database:6334
# - TRITON_SERVER_URL=triton-server:8001
# ports:
# - 7000:7000
# volumes:
# - ./image-search-engine/logs:/app/logs
# depends_on:
# - qdrant-vector-database
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]

volumes:
data-elastic-search:
driver: local
qdrant-vector-database:
driver: local
3 changes: 3 additions & 0 deletions image-search-engine/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
data
locust
faiss_store
model_repository
6 changes: 3 additions & 3 deletions image-search-engine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ FROM python:3.9-slim
# Set the working directory inside the container to /app
WORKDIR /app

# Install for OpenCV
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y

# Copy the requirements.txt file from the host into the container's /app directory
COPY requirements.txt /app

Expand Down Expand Up @@ -31,9 +34,6 @@ RUN python -c 'from torchvision.models import efficientnet_b3, EfficientNet_B3_W
# Copy all files from the host into the container's /app directory
COPY . /app

# Ingest data to Faiss
RUN python faiss_ingest.py

# Expose port 7000 to the host machine
EXPOSE 7000

Expand Down
Loading

0 comments on commit e841c8b

Please sign in to comment.