From 889a2fd77e94953f483b8110e538d0256fd63fbc Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Tue, 21 May 2024 22:07:51 +0100 Subject: [PATCH 1/2] fix: wrong path for space litellm config --- backend/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/start.sh b/backend/start.sh index a36feadd9..a7232a24a 100755 --- a/backend/start.sh +++ b/backend/start.sh @@ -37,7 +37,7 @@ if [ -n "$SPACE_ID" ]; then # Copy litellm_config.yaml with specified ownership echo "Copying litellm_config.yaml to the desired location with specified ownership..." - cp ./backend/space/litellm_config.yaml ./data/litellm/config.yaml + cp -f ./space/litellm_config.yaml ./data/litellm/config.yaml WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" uvicorn main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' & webui_pid=$! From b20ec0586ee512ff7ff398c720e3d866af368c00 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Tue, 21 May 2024 22:09:25 +0100 Subject: [PATCH 2/2] refac: only create space admin user when configured --- backend/start.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/backend/start.sh b/backend/start.sh index a7232a24a..ba7741e1d 100755 --- a/backend/start.sh +++ b/backend/start.sh @@ -39,20 +39,24 @@ if [ -n "$SPACE_ID" ]; then echo "Copying litellm_config.yaml to the desired location with specified ownership..." cp -f ./space/litellm_config.yaml ./data/litellm/config.yaml - WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" uvicorn main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' & - webui_pid=$! - echo "Waiting for webui to start..." - while ! curl -s http://localhost:8080/health > /dev/null; do - sleep 1 - done - echo "Creating admin user..." - curl \ - -X POST "http://localhost:8080/api/v1/auths/signup" \ - -H "accept: application/json" \ - -H "Content-Type: application/json" \ - -d "{ \"email\": \"${ADMIN_USER_EMAIL}\", \"password\": \"${ADMIN_USER_PASSWORD}\", \"name\": \"Admin\" }" - echo "Shutting down webui..." - kill $webui_pid + if [ -n "$ADMIN_USER_EMAIL" ] && [ -n "$ADMIN_USER_PASSWORD" ]; then + echo "Admin user configured, creating" + WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" uvicorn main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' & + webui_pid=$! + echo "Waiting for webui to start..." + while ! curl -s http://localhost:8080/health > /dev/null; do + sleep 1 + done + echo "Creating admin user..." + curl \ + -X POST "http://localhost:8080/api/v1/auths/signup" \ + -H "accept: application/json" \ + -H "Content-Type: application/json" \ + -d "{ \"email\": \"${ADMIN_USER_EMAIL}\", \"password\": \"${ADMIN_USER_PASSWORD}\", \"name\": \"Admin\" }" + echo "Shutting down webui..." + kill $webui_pid + fi + export WEBUI_URL=${SPACE_HOST} fi