microsoft / azurechat

🤖 💼 Azure Chat Solution Accelerator powered by Azure Open AI Service
MIT License
1.24k stars 1.21k forks source link

Provide Documentation to Deploy to Azure without GitHub Action #96

Closed Kirchen99 closed 1 year ago

Kirchen99 commented 1 year ago

I've noticed that the current documentation focuses solely on deploying ChatGPT to Azure using GitHub Actions. While GitHub Actions is a powerful tool, some users may prefer different deployment methods or may not have access to GitHub for various reasons.

I kindly request that you consider creating documentation that outlines alternative methods for deploying ChatGPT to Azure without relying on GitHub Actions. This would provide more flexibility and accessibility to a wider audience of users who may have different workflows or preferences.

oliverlabs commented 1 year ago

@Kirchen99, it's fairly simple to deploy the app manually.

  1. Do an npm install and npm run build like so:

    cd ./src
    npm install
    npm run build --if-present
    cd ..
  2. Copy standalone into the root

    cp -R ./src/.next/standalone ./site-deploy
  3. Copy static into the .next folder

    cp -R ./src/.next/static ./site-deploy/.next/static
  4. Copy Public folder

    cp -R ./src/public ./site-deploy/public
  5. Create a zip of your Next application

    cd ./site-deploy
    zip Nextjs-site.zip ./* .next -qr 
  6. Deploy to a Web App via REST API cURL command or using Azure CLI

    az webapp deployment source config-zip -g <resource_group> -n \
    <app_name> --src Nextjs-site.zip

    or

    curl -X POST \
    --data-binary "@Nextjs-site.zip" \
    -H "Authorization: Bearer <access_token>" \
    "https://<app_name>.scm.azurewebsites.net/api/zipdeploy"

Hope this helps.

Kirchen99 commented 1 year ago

Thank you for the quick response!

After successfully deploying my application to Azure, I encountered the following error:

AADSTS50011: The redirect URI 'https://<app_name>.azurewebsites.net/.auth/login/aad/callback' specified in the request does not match the redirect URIs configured for the application 

And I checked my "Redirect URI" in the "App registrations":

before:

https://<app_name>.azurewebsites.net/api/auth/callback/azure-ad

after:

https://<app_name>.azurewebsites.net/.auth/login/aad/callback

With this adjustment, I attempted to log in again at https://.azurewebsites.net, and this time, the login process succeeded. However, I'm now encountering an "Internal Server Error." I see nothing in the application logs. Could you kindly assist in identifying any further steps or configurations I may be missing? Your guidance is greatly appreciated.

Kirchen99 commented 1 year ago

I also testet it locally and it worked on my localhost, the Redirect URI is

http://localhost:3000/api/auth/callback/azure-ad

I have no idea why my Redirect URI in Azure ends with .auth/login/aad/callback. Maybe this is the problem?

Kirchen99 commented 1 year ago

I ran into this problem because I added an identity provider to the Authentication option of the Azure App. After I removed the identity provider, it works. Thanks again for the help.

jupiter19914 commented 1 year ago

@oliverlabs in your instructions to deploy manually why is the last step using "az functionapp deployment" instead of "az webapp deployment"?

oliverlabs commented 1 year ago

@jupiter19914, you are correct. It should be az webapp. I will fix the command above.