Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify deployment scripts to serve static files from web service #377

Merged
merged 14 commits into from
Oct 6, 2023

Conversation

glahaye
Copy link
Collaborator

@glahaye glahaye commented Sep 22, 2023

Motivation and Context

This change enables having a generic single package containing both backend and frontend that can be deployed using the "Deploy to Azure" button.

It also reduces the complexity and cost of deployments.

Description

  • Remove usage of SWA and its CLI.
  • Make the backend serve files.
  • Build static files with yarn and copy them to package deployed to Azure.
  • Introduced a middleware that inserts the configuration values needed by the frontend in its source code.
  • Modified deployment scripts accordingly

Contribution Checklist

@github-actions github-actions bot added documentation Improvements or additions to documentation webapp Pull requests that update Typescript code webapi Pull requests that update .net code deployment Issues related to deploying Chat-Copilot PR: ready for review labels Sep 22, 2023
@glahaye glahaye changed the title Modify deployment scripts to serve static file from web service Modify deployment scripts to serve static files from web service Sep 22, 2023
@glahaye glahaye marked this pull request as draft September 22, 2023 18:33
@github-actions github-actions bot added the github actions Pull requests that update GitHub Actions code label Sep 24, 2023
@glahaye glahaye marked this pull request as ready for review September 24, 2023 23:48
scripts/deploy/deploy-webapi.ps1 Outdated Show resolved Hide resolved
scripts/deploy/deploy-webapi.ps1 Outdated Show resolved Hide resolved
scripts/deploy/deploy-webapi.ps1 Outdated Show resolved Hide resolved
scripts/deploy/deploy-webapi.sh Outdated Show resolved Hide resolved
scripts/deploy/main.bicep Show resolved Hide resolved
scripts/deploy/main.bicep Show resolved Hide resolved
webapi/Middleware/ResponseTokenReplacerMiddleware.cs Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the webapi Pull requests that update .net code label Oct 3, 2023
github-merge-queue bot pushed a commit that referenced this pull request Oct 5, 2023
### Motivation and Context

<!-- Thank you for your contribution to the chat-copilot repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
this PR prepares the frontend for #377 and removes the need for any AAD
configuration environment variables.

### Description
- removes `REACT_APP_AUTH_TYPE` and all variables starting with
`REACT_APP_AAD_`
- calls the `/authConfig` endpoint when the app first loads and if
needed, renders the `MsalProvider` using the fetched config.
- updates workflows and deployment scripts accordingly

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [X] The code builds clean without any errors or warnings
- [X] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/chat-copilot/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [X] All unit tests pass, and I have added new tests where possible
- [X] I didn't break anyone 馃槃
scripts/deploy/deploy-webapi.ps1 Outdated Show resolved Hide resolved
scripts/deploy/deploy-webapi.sh Outdated Show resolved Hide resolved
scripts/deploy/deploy-webapi.sh Outdated Show resolved Hide resolved
scripts/deploy/package-webapi.sh Outdated Show resolved Hide resolved
@glahaye glahaye added this pull request to the merge queue Oct 6, 2023
Merged via the queue into microsoft:main with commit 112691c Oct 6, 2023
6 checks passed
@glahaye glahaye deleted the host_static_files_from_service branch October 6, 2023 21:22
@raj-microsoft
Copy link

raj-microsoft commented Nov 1, 2023

the docs could be updated to reflect the new deployment steps sk-frontend-deployment

Also is it required to create 2 separate app registrations, now that both frontend & backend is served from within one appservice

@glahaye
Copy link
Collaborator Author

glahaye commented Nov 1, 2023

the docs here could be updated to reflect the new deployment steps sk-frontend-deployment

Also is it required to create 2 separate app registrations, now that both frontend & backend is served from within one appservice

@raj-microsoft You still need 2 app registrations. The frontend files can be hosted anywhere independently from the backend. They are now hosted by the backend by default to reduce the number of moving parts and to reduce the number of steps required to get to a functional Chat Copilot deployment.

Thank you for pointing out the disconnect with the documentation on learn.microsoft.com. I will go and fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment Issues related to deploying Chat-Copilot documentation Improvements or additions to documentation github actions Pull requests that update GitHub Actions code webapp Pull requests that update Typescript code
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants