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
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?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
Local dev with Docker Compose quickstart
Azure with Azure Developer CLI (azd)
Azure with azd and Azure Container Registry (import containers from ghcr.io)
Azure with azd and Azure Container Registry (build containers from source)
Azure with azd and Azure CosmosDB SQL API
What to Check
Verify that the following are valid
Other Information