Skip to content

Commit 14f09a4

Browse files
authored
Vitus/configurable-marqo-host (#1314)
1 parent ae911b2 commit 14f09a4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

run_marqo.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,15 @@ fi
152152
export MARQO_LOG_LEVEL=${MARQO_LOG_LEVEL:-info}
153153
MARQO_LOG_LEVEL=`echo "$MARQO_LOG_LEVEL" | tr '[:upper:]' '[:lower:]'`
154154

155+
156+
# set the default host to 0.0.0.0
157+
export MARQO_HOST=${MARQO_HOST:-"0.0.0.0"}
158+
155159
case "$MARQO_MODE" in
156160
COMBINED)
157161
# Start the combined Marqo API and Inference in the background
158162
cd /app/src/marqo/tensor_search || { echo "Failed to navigate to tensor_search directory"; exit 1; }
159-
uvicorn api:app --host 0.0.0.0 --port 8882 --timeout-keep-alive 75 --log-level "$MARQO_LOG_LEVEL" &
163+
uvicorn api:app --host "$MARQO_HOST" --port 8882 --timeout-keep-alive 75 --log-level "$MARQO_LOG_LEVEL" &
160164
;;
161165
API)
162166
# set default number of workers to 1
@@ -166,12 +170,12 @@ case "$MARQO_MODE" in
166170

167171
# Start the Marqo API in the background
168172
cd /app/src/marqo/tensor_search || { echo "Failed to navigate to tensor_search directory"; exit 1; }
169-
uvicorn api:app --host 0.0.0.0 --port 8882 --workers $MARQO_API_WORKERS --timeout-keep-alive 75 --log-level "$MARQO_LOG_LEVEL" &
173+
uvicorn api:app --host "$MARQO_HOST" --port 8882 --workers $MARQO_API_WORKERS --timeout-keep-alive 75 --log-level "$MARQO_LOG_LEVEL" &
170174
;;
171175
INFERENCE)
172176
# Start the native Inference server app in the background
173177
cd /app/src/marqo/inference/native_inference/remote/server || { echo "Failed to navigate to inference server directory"; exit 1; }
174-
uvicorn inference_api:app --host 0.0.0.0 --port 8881 --timeout-keep-alive 75 --log-level "$MARQO_LOG_LEVEL" &
178+
uvicorn inference_api:app --host "$MARQO_HOST" --port 8881 --timeout-keep-alive 75 --log-level "$MARQO_LOG_LEVEL" &
175179
;;
176180
*)
177181
echo "Invalid MARQO_MODE: $MARQO_MODE. Supported modes are 'COMBINED', 'API' and 'INFERENCE'"
@@ -184,4 +188,4 @@ export api_pid=$!
184188
# Wait for the Uvicorn process to terminate
185189
wait "$api_pid"
186190
# Exit with status of process that exited first
187-
exit $?
191+
exit $?

0 commit comments

Comments
 (0)