This document discusses using Azure Functions and Container Instances to interact with a website without using virtual machines. It presents the Page Object Model pattern for maintaining a representation of web pages. Selenium is used to drive a browser within a Docker container to interact with the website. Azure Container Instances host the Docker container in Azure. Polly provides reliability by implementing retry and circuit breaker policies. The solution achieves the goals of interacting with a website daily without additional cost by using serverless Azure Functions and container-based hosting with on-demand billing.
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Azure functions and container instances
1. Azure Functions and Container Instances
By John Staveley
02/03/2019
https://uk.linkedin.com/in/johnstaveley/
@johnstaveley
2. Overview
The Problem
Selenium and Page Object Model
Azure Functions – developer experience
Docker
SideCar pattern
Azure Container Instances
Polly for reliability
3. Who am I?
John Staveley
Mvc C# Azure Angular developer
Organiser at Leeds Sharp, Leeds Data Science meetups
Second migration into Azure from OnPrem
5. Problem Requirements
No Api
Interact with the website
– Navigate to the website
– Logon
– Navigate to target web page
– Interact with the page
Do this every day at 8pm without fail
Try and avoid additional cost (No more Vms!)
Framework for solving similar problems
7. Azure Functions
Used to drive the actions
WebJobs bad, Azure functions good
Service plan vs Consumption charging
Azure SDK in visual studio, uses .Net core 2.2
Precompiled function
Triggers: Blob/Table/MongoDb storage, Queue, Timer
Local Function and Storage Emulators for debug
Deploy as web service
13. MajorDomo Demo
See selenium interacting with the web pages
Code explanation
– Pages using Page Object Model
– How Page object model was used
14. Docker and SideCar pattern
Used to contain the browser
Why? So I can test selenium grid will work locally
Docker – like small Vms
SideCar pattern
Demo: MajorDomo running locally using docker
15. Azure Container Instances
Used to contain the browser in Azure cloud
ACI billing similar to VMs
Docker image: selenium/standalone-chrome
Startup/Shutdown using Azure libraries:
21. Summary
Page Object Model for a
maintainable model of web pages
Azure Precompiled Function in the
cloud, same power as a container
without the charging model
Azure Container Instances SideCar
on demand
Polly for reliability and resilience
No VM, Pay as you go for azure
function = No Cost
Slides on slideshare