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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store optimizations #96

Merged
merged 9 commits into from
Feb 1, 2024
Merged

Store optimizations #96

merged 9 commits into from
Feb 1, 2024

Conversation

pauldotyu
Copy link
Contributor

@pauldotyu pauldotyu commented Jan 23, 2024

Purpose

This change is mainly to reduce the size and startup time of the store-front and store-admin container images. The images were too large (>400MB) and could underperform in scale-out scenarios. Both store-front and store-admin were built with Vue.js and included a devserver which was used to proxy requests to other microservices.

To reduce the size of the containers, the Dockerfiles were updated to do a "production" build of the containers and run the JS files in a NGINX web server rather than running a server using the npm run serve command.

With NGINX now running as the proxy, an app architecture decision was made to move the ai-service behind the product-service and have the product-service serve as the proxy for ai-service. This was due to a limitation of the NGINX server's ability to conditionally proxy web requests to services that may or may not exist.

The store-front and store-admin container image sizes are now ~45MB (about 89% reduction)

Additional changes in this PR include Azure Developer CLI and Helm chart enhancements to allow for more configurable deployments (i.e., Azure CosmosDB API choice of MongoDB vs SQL API, and Azure Container Registry for application deployments).

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone https://github.com/Azure-Samples/aks-store-demo.git
cd aks-store-demo
git checkout store_optimizations
  • Test the following scenarios
    Local dev with Docker Compose
docker compose up

Local dev with Docker Compose quickstart

docker compose -f  docker-compose-quickstart.yaml up -d

Azure with Azure Developer CLI (azd)

azd auth login
az login
azd up
// run `azd down` when done testing 

Azure with azd and Azure Container Registry (import containers from ghcr.io)

azd env set DEPLOY_AZURE_CONTAINER_REGISTRY true
azd up
// run `azd down` when done testing

Azure with azd and Azure Container Registry (build containers from source)

azd env set DEPLOY_AZURE_CONTAINER_REGISTRY true
azd env set BUILD_CONTAINERS true
azd up
// run `azd down` when done testing

Azure with azd and Azure CosmosDB SQL API

azd env set AZURE_COSMOSDB_ACCOUNT_KIND GlobalDocumentDB
azd up
// run `azd down` when done testing

What to Check

Verify that the following are valid

  • Ensure store-front functionality is accessible from web
  • Ensure store-admin functionality is accessible from web
  • Ensure store-admin can get product descriptions from ai-service

Other Information

@pauldotyu pauldotyu marked this pull request as ready for review January 24, 2024 21:23
Copy link
Collaborator

@chzbrgr71 chzbrgr71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested all of the scenarios and everything works.

@chzbrgr71 chzbrgr71 merged commit 3ffa729 into main Feb 1, 2024
4 checks passed
@pauldotyu pauldotyu deleted the store_optimizations branch February 1, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants