graphrag-accelerator icon indicating copy to clipboard operation
graphrag-accelerator copied to clipboard

[BUG] error deploying docker image without existing container registry

Open satarupaguha11 opened this issue 1 year ago • 6 comments

Describe the bug All the required packages (recommended versions) are installed and deploy.parameters.json have been filled in with the required variable values. I did not create a container registry beforehand as it was not marked as a required variable.

However, it throws an error - "Deploying docker image 'graphrag:backend' to container registry 'xxxx.azurecr.io'...Error deploying docker image, exiting.." I have reproduced this bug both on Windows as well as WSL.

To Reproduce Steps to reproduce the behavior:

  1. Install all the required packages in Windows/WSL
  2. Fill in all the required values in infra/deploy.parameters.json
  3. Run the command "bash deploy.sh -p deploy.parameters.json"
  4. See error "Deploying docker image 'graphrag:backend' to container registry 'xxxx.azurecr.io'...Error deploying docker image, exiting.."

Expected behavior Deployment should automatically complete successfully.

Screenshots image

Desktop (please complete the following information):

  • OS: Windows & WSL
  • Version 23H2

Additional context I already had AOAI resources which I have filled in. I however didn't find any instruction about setting up cognitive services resources, so I didn't provide them anywhere.

satarupaguha11 avatar Jul 26 '24 18:07 satarupaguha11

I have encountered the same problem using github codespaces.

nociza avatar Jul 28 '24 07:07 nociza

Please check below instruction: image

rnpramasamyai avatar Jul 31 '24 03:07 rnpramasamyai

@rnpramasamyai I already have these permissions- I am an owner of the subscription. It also works when I deploy from the devcontainer using the docker option. So access issues do not seem to be the reason for this failure.

satarupaguha11 avatar Aug 02 '24 00:08 satarupaguha11

@satarupaguha11 if you update https://github.com/Azure-Samples/graphrag-accelerator/blob/c211508a7d569ea71f831a171cc5cbd832c69264/infra/deploy.sh#L533 and remove > /dev/null 2>&1 from the end of the line, and run again, you should get more logging output to go on.

timothymeyers avatar Aug 05 '24 19:08 timothymeyers

Add resource group to both az acr show and az acr build command. When resource group is not included, existing ACR will not be found.

createAcrIfNotExists() { # check if container registry exists printf "Checking if container registry exists... " local existingRegistry existingRegistry=$(az acr show --name $CONTAINER_REGISTRY_SERVER --resource-group $RESOURCE_GROUP --query loginServer -o tsv 2>/dev/null) if [ $? -eq 0 ]; then printf "Yes.\nUsing existing registry '$existingRegistry'.\n" CONTAINER_REGISTRY_SERVER=$existingRegistry return 0 fi # else deploy a new container registry printf "No.\nCreating container registry... " AZURE_ACR_DEPLOY_RESULT=$(az deployment group create --resource-group $RESOURCE_GROUP --name "acr-deployment" --template-file core/acr/acr.bicep --only-show-errors --no-prompt -o json
--parameters "name=$CONTAINER_REGISTRY_SERVER") exitIfCommandFailed $? "Error creating container registry, exiting..." CONTAINER_REGISTRY_SERVER=$(jq -r .properties.outputs.loginServer.value <<< $AZURE_ACR_DEPLOY_RESULT) exitIfValueEmpty "$CONTAINER_REGISTRY_SERVER" "Unable to parse container registry login server from deployment, exiting..." printf "'$CONTAINER_REGISTRY_SERVER' created.\n" }

deployDockerImageToACR() { printf "Deploying docker image '${GRAPHRAG_IMAGE}' to container registry '${CONTAINER_REGISTRY_SERVER}'..." local SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; #az acr build --registry $CONTAINER_REGISTRY_SERVER -f $SCRIPT_DIR/../docker/Dockerfile-backend --image $GRAPHRAG_IMAGE $SCRIPT_DIR/../ > /dev/null 2>&1 az acr build --registry $CONTAINER_REGISTRY_SERVER --resource-group $RESOURCE_GROUP -f $SCRIPT_DIR/../docker/Dockerfile-backend --image $GRAPHRAG_IMAGE $SCRIPT_DIR/../ > /dev/null 2>&1 exitIfCommandFailed $? "Error deploying docker image, exiting..." printf " Done.\n" }

cynthiajiangatl avatar Aug 06 '24 00:08 cynthiajiangatl

@satarupaguha11 Please update your Linux subsystem if you are using Linux on Windows. It solved many issues when I tried to deploy this repo.

rnpramasamyai avatar Aug 07 '24 08:08 rnpramasamyai