Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building intelligent apps and microservices wit...

Pamela Fox
September 11, 2023

Building intelligent apps and microservices with Azure Container Apps

Azure Container Apps is a service that allows you to run applications on a platform that's scalable, resilient, and cost-effective. You can focus on running apps, microservices, and background jobs without thinking about infrastructure. In this talk, you'll learn how to deploy Python apps on Azure Container Apps and use ChatGPT and other AI services to make your apps smarter. You'll also see real-world examples of Python apps running on Azure Container Apps and learn how to scale, monitor, and optimize them.

Pamela Fox

September 11, 2023
Tweet

More Decks by Pamela Fox

Other Decks in Technology

Transcript

  1. Azure Developers | Python Day RAG (Retrieval Augmented Generation) Large

    Language Model Document Search User question Benefit_Options-2.pdf: The plans also cover preventive care services such as mammograms, colonoscopies, and other cancer screenings. Northwind Health Plus offers more comprehensive coverage than Northwind Standard. This plan offers coverage for emergency services, both in-network and out-of-network, as well as mental health and substance abuse coverage. …. The Northwind Health Plus plan includes coverage for emergency services, mental health and substance abuse, out-of-network services, and a wider range of prescription drug coverage compared to the Northwind Standard plan. [Benefit_Options-2.pdf] What is included in my Northwind Health Plus plan that is not in standard?
  2. Azure Developers | Python Day Azure Cognitive Search Azure architecture

    Azure OpenAI Azure Container Apps Azure Storage Azure Storage Form Recognizer Web Container Local Script Azure OpenAI Azure Cognitive Search Uploads PDF pages Extracts data from PDFs Computes embeddings Stores in index prepdocs.py
  3. Azure Developers | Python Day Deployment with the Azure Developer

    CLI name: azure-search-openai-demo services: web: project: ./app/backend language: py host: containerapp hooks: prepackage: posix: shell: sh run: cd ../frontend;npm install;npm run build interactive: true continueOnError: false hooks: postprovision: posix: shell: sh run: ./scripts/prepdocs.sh interactive: true continueOnError: false >>> azd up https://github.com/Azure-Samples/azure-search-openai-demo/tree/aca aka.ms/aca-rag
  4. Azure Developers | Python Day Why containerize? Dockerfile Create an

    environment that's replicable and portable (across local machine and prod, across clouds, across Azure services). FROM python:3.11-bullseye RUN python -m pip install --upgrade pip WORKDIR /demo-code COPY requirements.txt . RUN python -m pip install -r requirements.txt RUN python -m pip install gunicorn==21.2.0 COPY entrypoint.sh . RUN chmod +x entrypoint.sh COPY . . CMD bash -c ". entrypoint.sh" App Container App Container Docker engine Operating system
  5. Azure Developers | Python Day Containers on Azure Azure Kubernetes

    Service Azure Container Apps Azure App Service BYOC Azure Functions (Preview) Flexibility PaaS features https://learn.microsoft.com/en-us/azure/container-apps/compare-options aka.ms/azure-containers
  6. Azure Developers | Python Day Azure Container Apps ACA allows

    you to run multiple containers within a shared network. Features: • Pull images from any container registry (ACR, DockerHub, private, etc) • Consumption-based pricing • Auto-scaling, including scale-to-zero Container app 1 Revision 1 Revision 2 Replica Replica Container(s) Container(s) Container app 2 Revision 1 Revision 2 Replica Replica Container(s) Container(s) Azure Container Apps Environment
  7. Azure Developers | Python Day Azure Container Apps: Auto-scaling Default

    scaling rule: When ACA detects ~10 concurrent requests per second, it creates a new instance. Or configure custom scale rules: Demo: https://youtu.be/N0QjLLQ8YWw
  8. AUTO-SCALE CRITERIA Scaling is determined by the number of concurrent

    HTTP requests Jobs can be triggered on demand or on schedule Individual microservices can scale independently using any KEDA scale triggers Scaling is determined by the number of concurrent HTTP requests Scaling is determined by the number of messages in the queue Public API endpoints Background processing Microservices Web Apps Event-driven processing E.g., API app with HTTP requests split between two revisions of the app E.g., on-demand job running background processing to transform data in a database Microservices architecture with the option to integrate with Dapr E.g., Web app with custom domain, TLS certificates, and integrated authentication HTTP TRAFFIC REVISION 2 REVISION 1 80% 20% MICROSERVICE B MICROSERVICE C MICROSERVICE A E.g., Queue reader apps or jobs that process messages as they arrive in a queue
  9. Azure Developers | Python Day Azure Cognitive Search Azure architecture

    for Uploader + Job Azure OpenAI Azure Container Apps Azure Storage Azure Storage Form Recognizer Web Container Local Script Azure OpenAI Azure Cognitive Search Uploads PDFs Extracts data from PDFs Computes embeddings Stores in index
  10. Azure Developers | Python Day Azure Cognitive Search Azure architecture

    for Uploader + Job Azure OpenAI Azure Container Apps Azure Storage Azure Storage Form Recognizer Web Container Job Azure OpenAI Azure Cognitive Search Uploads PDFs Extracts data from PDFs Computes embeddings Stores in index Uploader UI
  11. Azure Developers | Python Day Azure Container Apps — apps

    and jobs Apps Services that are continuously running, such as a web or API app, or app that constantly polls a queue for messages. Can receive HTTP or TCP connections Configure KEDA scale rules to add or remove replicas based on events. Jobs Tasks that run to completion, such as a data processing job or a job that processes a single message from a queue and exits. Trigger job executions manually/programmatically or on a schedule. Configure KEDA scale rules that are evaluated on regular intervals that trigger job executions. (event-driven jobs) Apps Jobs
  12. Azure Developers | Python Day Learn more • Deploy a

    Flask/FastAPI to Azure Container Apps https://learn.microsoft.com/azure/developer/python/ tutorial-containerize-simple-web-app • Azd templates for Python + ACA https://azure.github.io/awesome- azd/?operator=AND&tags=python&tags=aca • Deploy "Chat on your data" app to azd: https://github.com/Azure-Samples/azure-search- openai-demo/tree/aca aka.ms/container-apps/github Got feedback for ACA team? Any questions (that ChatGPT can't answer)? aka.ms/aca-python-tutorial aka.ms/aca-python-azd aka.ms/aca-rag