Azure-Samples / graphrag-accelerator

One-click deploy of a Knowledge Graph powered RAG (GraphRAG) in Azure
https://github.com/microsoft/graphrag
MIT License
1.65k stars 247 forks source link

[BUG] error deploying docker image without existing container registry #109

Open satarupaguha11 opened 1 month ago

satarupaguha11 commented 1 month ago

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):

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.

nociza commented 1 month ago

I have encountered the same problem using github codespaces.

rnpramasamyai commented 1 month ago

Please check below instruction:

image
satarupaguha11 commented 1 month ago

@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.

timothymeyers commented 1 month ago

@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.

cynthiajiangatl commented 1 month ago

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"

}

rnpramasamyai commented 1 month ago

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