From cc664913dc26d6e52026b94e5e35452f15b0cdd2 Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 12 Dec 2024 12:07:31 -0800 Subject: [PATCH] chore: change docker compose mapped AVS port to 5555, use port 5555 in example readme run commands. Add a warning for mac users using basic search with port 5000 --- basic-search/README.md | 2 +- basic-search/search.py | 40 ++++++++++++++++-------------- docker/README.md | 6 +---- docker/docker-compose-asdb-6.4.yml | 2 +- docker/docker-compose.yaml | 2 +- prism-image-search/README.md | 2 +- quote-semantic-search/README.md | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/basic-search/README.md b/basic-search/README.md index fa7c052..565b52d 100644 --- a/basic-search/README.md +++ b/basic-search/README.md @@ -54,5 +54,5 @@ python3 search.py --help Run the example. ```shell -python3 search.py +python3 search.py --port 5555 ``` diff --git a/basic-search/search.py b/basic-search/search.py index 13480a3..9a6c815 100644 --- a/basic-search/search.py +++ b/basic-search/search.py @@ -61,24 +61,28 @@ ) args = arg_parser.parse_args() -with AdminClient( - seeds=types.HostPort(host=args.host, port=args.port), - listener_name=listener_name, - is_loadbalancer=args.load_balancer, -) as adminClient: - try: - print("creating index") - adminClient.index_create( - namespace=args.namespace, - name=index_name, - vector_field="vector", - dimensions=2, - sets=args.set, - index_storage=types.IndexStorage(namespace=args.index_namespace, set_name=args.index_set), - ) - except Exception as e: - print("failed creating index " + str(e)) - pass +try: + with AdminClient( + seeds=types.HostPort(host=args.host, port=args.port), + listener_name=listener_name, + is_loadbalancer=args.load_balancer, + ) as adminClient: + try: + print("creating index") + adminClient.index_create( + namespace=args.namespace, + name=index_name, + vector_field="vector", + dimensions=2, + sets=args.set, + index_storage=types.IndexStorage(namespace=args.index_namespace, set_name=args.index_set), + ) + except Exception as e: + print("failed creating index " + str(e)) + pass +except Exception as e: + raise Exception(f"you are trying to connect to AVS on port {args.port}, " + "on MacOS airplay uses port 5000 by default, make sure there is not a conflict") from e with Client( seeds=types.HostPort(host=args.host, port=args.port), diff --git a/docker/README.md b/docker/README.md index fe7b230..13739e9 100644 --- a/docker/README.md +++ b/docker/README.md @@ -3,10 +3,6 @@ ## Prerequisite Locate valid `features.conf` in the `./config` directory: -> [!IMPORTANT] -> If you are running MacOS you will need to replace all occurrences of port 5000 with -> port 5002 in your docker compose file and aerospike-vector-search.yml file. - ## Installation Aerospike and AVS Clusters (docker-compose) ```shell docker compose -f docker-compose.yaml up -d @@ -46,7 +42,7 @@ docker run -d \ docker run -d \ --name aerospike-vs \ --network svc \ --p 5000:5000 \ +-p 5555:5000 \ -p 5040:5040 \ -v ./config:/etc/aerospike-vector-search \ aerospike/aerospike-vector-search:1.0.0 diff --git a/docker/docker-compose-asdb-6.4.yml b/docker/docker-compose-asdb-6.4.yml index 7ddbe18..4182dd3 100644 --- a/docker/docker-compose-asdb-6.4.yml +++ b/docker/docker-compose-asdb-6.4.yml @@ -26,7 +26,7 @@ services: aerospike-cluster: condition: service_healthy ports: - - "5000:5000" + - "5555:5000" - "5040:5040" networks: - svc diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 9826132..2037e57 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -26,7 +26,7 @@ services: aerospike-cluster: condition: service_healthy ports: - - "5000:5000" + - "5555:5000" - "5040:5040" networks: - svc diff --git a/prism-image-search/README.md b/prism-image-search/README.md index af7f4e9..f0d3ec6 100644 --- a/prism-image-search/README.md +++ b/prism-image-search/README.md @@ -43,7 +43,7 @@ ln -s ~/Pictures static/images/data > likely not be in your path. ```shell - waitress-serve --host 127.0.0.1 --port 8080 --threads 32 prism:app +AVS_PORT=5555 waitress-serve --host 127.0.0.1 --port 8080 --threads 32 prism:app ``` ## Performing an image search diff --git a/quote-semantic-search/README.md b/quote-semantic-search/README.md index 327a1c6..e90e6ae 100644 --- a/quote-semantic-search/README.md +++ b/quote-semantic-search/README.md @@ -141,7 +141,7 @@ shown [here](https://dev.to/thetrebelcc/how-to-run-a-flask-app-over-https-using- #### Start the application ```shell -waitress-serve --host 127.0.0.1 --port 8080 --threads 32 quote_search:app +AVS_PORT=5555 waitress-serve --host 127.0.0.1 --port 8080 --threads 32 quote_search:app ``` #### Run for development