Book Image

Advanced Serverless Architectures with Microsoft Azure

By : Daniel Bass
Book Image

Advanced Serverless Architectures with Microsoft Azure

By: Daniel Bass

Overview of this book

Advanced Serverless Architectures with Microsoft Azure redefines your experience of designing serverless systems. It shows you how to tackle challenges of varying levels, not just the straightforward ones. You'll be learning how to deliver features quickly by building systems, which retain the scalability and benefits of serverless. You'll begin your journey by learning how to build a simple, completely serverless application. Then, you'll build a highly scalable solution using a queue, load messages onto the queue, and read them asynchronously. To boost your knowledge further, the book also features durable functions and ways to use them to solve errors in a complex system. You'll then learn about security by building a security solution from serverless components. Next, you’ll gain an understanding of observability and ways to leverage application insights to bring you performance benefits. As you approach the concluding chapters, you’ll explore chaos engineering and the benefits of resilience, by actively switching off a few of the functions within a complex system, submitting a request, and observing the resulting behavior. By the end of this book, you will have developed the skills you need to build and maintain increasingly complex systems that match evolving platform requirements.
Table of Contents (8 chapters)

Chapter 6: Chaos Engineering


Activity 7: Chaos Experiment to Check the Resilience to Loss of a Function App

  1. Delete the OrdersApi function in the portal and observe the issue on the orders.html page by submitting orders. The errors will become visible in the developer tools of your browser:

    Figure 6.64: Failed request to order api

  2. Create a backup OrdersApi.

  3. Create a backup connection string on the orders.html file by using the JavaScript mentioned.

  4. Navigate to the builds page in Azure DevOps. Click on the build definition you already have, click on the ellipses, and click Clone:

    Figure 6.65: Build clone

  5. You will be taken to your new build pipeline. Click on Pipeline and change the Path to solution or packages.config field to point to the path of the OrdersApi function, Lesson6/Activity7/OrdersApi/*.csproj:

    Figure 6.66: Modify the build path to the solution

  6. Click Save & queue and Save and Queue again. Click the build number to view the build progress:

    Figure 6.67: Build process successful

  7. Open the Releases page. Click the ellipses next to the existing release and click Clone:

    Figure 6.68: Clone release

  8. You will be taken to your pipeline screen. Open the Production stage. Modify the –appName value in the template parameters field on the Azure Deployment task to advancedserverlessorderapi:

    Figure 6.69: -appName variable modified

  9. Right-click on the Azure deployment task and clone it:

    Figure 6.70: Clone task

  10. Again, modify the –appName value in the template parameters field on the Azure Deployment cloned task to advancedserverlessorderapibackup:

    Figure 6.71: -appName template parameter

  11. Right-click on the Deploy Azure App Service task and click Remove Selected Tasks:

    Figure 6.72: Clone release

  12. Click the + button and search for "Azure App Service Deploy". Click Add:

    Figure 6.73: Azure App Service Deploy task

  13. Set the Azure subscription to advancedserverless, the App Service type to Function App on Windows, and the App Service name to advancedserverlessorderapi:

    Figure 6.74: Setting up App Service task

  14. Right-click the Azure App Service Deploy task and click Clone task(s):

    Figure 6.75: Clone tasks

  15. Modify the App Service Name on the cloned task to advancedserverlessorderapibackup:

    Figure 6.76: Backup App Service Name

  16. Click on Pipeline and click on the Add option next to Artifacts. Set the Source (build pipeline) to the cloned build pipeline:

    Figure 6.77: Add source pipeline

  17. Click Add. Select the other artifact and click Delete:

    Figure 6.78: Delete original build artifact

  18. Change the Source alias field to remove the -clone on the end. This ensures all the tasks are looking in the correct place for the code:

    Figure 6.79: Rename build artifact alias

  19. Click Save. Click Release, and then Create a Release:

    Figure 6.80: Create a release

  20. Click the Continuous Chaos stage to remove it from the automated release, as we haven't configured that stage. Select the latest build artifact. Click Create:

    Figure 6.81: Configure release

  21. Click the link to the release that will appear at the top left of the screen. Click Deploy on the production stage. Click Deploy again. The release will start:

    Figure 6.82: Release summary

  22. Now delete the advancedserverlessorderapi function app and visit the order.html page. Submit an order, and see it succeed:

    Figure 6.83: order.html page