Skip to content

Commit

Permalink
refactor vectorDB script as makefile
Browse files Browse the repository at this point in the history
Signed-off-by: greg pereira <[email protected]>
  • Loading branch information
Gregory-Pereira committed Apr 28, 2024
1 parent 6541325 commit be21e2d
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 134 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ models/*
convert_models/converted_models
recipes/common/bin/*
*/.venv/
vector_dbs/milvus/volumes/milvus/*
2 changes: 1 addition & 1 deletion vector_dbs/Makefile → vector_dbs/chromadb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPIMAGE ?= quay.io/ai-lab/${APP}:latest

.PHONY: build
build:
podman build -f chromadb/Containerfile -t ${APPIMAGE} .
podman build -f Containerfile -t ${APPIMAGE} .
3 changes: 2 additions & 1 deletion vector_dbs/milvus/Containerfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
FROM docker.io/milvusdb/milvus
FROM docker.io/milvusdb/milvus:master-20240426-bed6363f
ADD embedEtcd.yaml /milvus/configs/embedEtcd.yaml
55 changes: 55 additions & 0 deletions vector_dbs/milvus/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
REGISTRY ?= quay.io
REGISTRY_ORG ?= ai-lab
COMPONENT = vector_dbs

IMAGE ?= $(REGISTRY)/$(REGISTRY_ORG)/$(COMPONENT)/milvus:latest

ARCH ?= $(shell uname -m)
PLATFORM ?= linux/$(ARCH)

gRCP_PORT := 19530
REST_PORT := 9091
CLIENT_PORT := 2379

LIB_MILVUS_DIR_MOUNTPATH := $(shell pwd)/volumes/milvus

.PHONY: build
build:
podman build --platform $(PLATFORM) -f Containerfile -t ${IMAGE} .

.PHONY: run
run:
podman run -d \
--name milvus-standalone \
--security-opt seccomp:unconfined \
-e ETCD_USE_EMBED=true \
-e ETCD_CONFIG_PATH=/milvus/configs/embedEtcd.yaml \
-e COMMON_STORAGETYPE=local \
-v $(LIB_MILVUS_DIR_MOUNTPATH):/var/lib/milvus \
-p $(gRCP_PORT):$(gRCP_PORT) \
-p $(REST_PORT):$(REST_PORT) \
-p $(CLIENT_PORT):$(CLIENT_PORT) \
--health-cmd="curl -f http://localhost:$(REST_PORT)/healthz" \
--health-interval=30s \
--health-start-period=90s \
--health-timeout=20s \
--health-retries=3 \
$(IMAGE) \
milvus run standalone 1> /dev/null

.PHONY: stop
stop:
-podman stop milvus-standalone

.PHONY: delete
delete:
-podman rm milvus-standalone -f

.PHONY: podman-clean
podman-clean:
@container_ids=$$(podman ps --format "{{.ID}} {{.Image}}" | awk '$$2 == "$(IMAGE)" {print $$1}'); \
echo "removing all containers with IMAGE=$(IMAGE)"; \
for id in $$container_ids; do \
echo "Removing container: $$id,"; \
podman rm -f $$id; \
done
5 changes: 5 additions & 0 deletions vector_dbs/milvus/embedEtcd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
listen-client-urls: http://0.0.0.0:2379
advertise-client-urls: http://0.0.0.0:2379
quota-backend-bytes: 4294967296
auto-compaction-mode: revision
auto-compaction-retention: '1000'
132 changes: 0 additions & 132 deletions vector_dbs/milvus/milvus_standalone_embed.sh

This file was deleted.

Empty file.

0 comments on commit be21e2d

Please sign in to comment.