Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
1
Taking your .NET Core
container solution
from laptop to
production
in under a minute
Alex Thissen
2
Alex Thissen
Cloud Architect
Xpirit Netherlands
@alexthissen – athissen@xpirit.com
3
Demo
application
4
Web APIWeb API
containercontainer
Leaderboard
Microservice
Identity
Microservice
ASP.NET Core
Web App
Client application...
5
Then there was a bug
6
Challenge
Development to production under a minute
(and many times per day)
7
Friends don’t let friends
use Publish in Visual Studio
8
9
What? Who?
10
Convince people
Actually, involve less people
11
Back to drawing
board
12
Don't just automate. Rethink your approach
13
Speed: Shift left Stable and predictable
Repeatable: Automate everything
14
Demo: Tracing bug
Find details on error details
Narrow down location
Start work for team
15
DevOps using container technology
16
17
Better isolation from
hypervisor virtualization
Container
management
Docker
Engine
Compute
18
19
Inner loop
Run
Code
Validate
Outer loop
20
Demo: Fixing bug
Isolated development using containers
Branching strategy
Inner loop
Run
Code
Validate
21
Trunk based development Shortlived branches
Full traceability
22
Demo: Trunk based
development
Branch policies
Reviewers and approvers
PR Build
23
Contains steps to:
Same pipeline for
PR and CI
24
Web API
Web App
SQL Server
on Linux
25
Order of files matters:
last one wins
docker-compose
-f "docker-compose.yml"
-f "docker-compose.override.yml"
-p compos...
26
Push and store your images to centralized location
Each image is in its own repository
27
28
Demo: Build pipelines
Tasks involved
Pull Request build conditions
Governance and compliance checks
30
Container cluster
Examples of external resources
Solution composed of
multiple containers
Different compositions
per en...
31
32
Environment:
e.g. developer laptop,
staging or production cluster
Container images are immutable
Environments are not s...
33
Bootstrapping environment variables
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
...
35
Development container cluster
Redis cache
External
resources
Web
Frontend
Web API Backend service
SQL
Server
on Linux R...
36
Managed
master
nodes
+ VMs
37
Create deployment file to apply on cluster
Elaborate scenarios involve multiple environments
38
39
Demo: Releasing
Release pipeline
Triggers and approval
40
Want to go even faster?
41
API v1.0*
Version with new
functionality
behind feature
toggle
Works well with CI/CD
Traffic management
API v1.0
Origin...
42
Turn functionality on/off
Deploy without releasing
Monitor behavior
FeatureToggle
Version 4.0.2
43
Building resilient applications
44
Resiliency: design for failure
Determine your strategy for resiliency
Focus on dependencies outside of your own contain...
Monitoring
Using telemetry, logging and instrumentation
46
Instrumentation not optional
Who wants to fly in the blind?
47
Individual applications Entire landscape
Application New Relic AppMetrics
Insights
48
Message templates
Log providers supporting semantic logging
// Placeholders in template become queryable custom data
lo...
49
Get your log levels right
Register logging providers (sinks)
Log Levels
5 – Critical
4 – Error
3 – Warning
2 – Informat...
50
Leverage existing resources
Appropriate filters
for each sink
Metrics and monitoring
e.g. Application Insights
AppMetri...
51
Health of your application
52
Specific endpoints to query
status of Web API
Middleware exposes health details
Combine with monitoring solution to ale...
53
54
Security and compliance
55
Everything in Docker ecosystem is inspectable
56
Configuration
Where would you leave sensitive data?
Production
appsettings.
development.json
Cluster secrets
docker-
co...
57
Provisioning Azure resources
58
Automate everything
Treat infrastructure as code
59
60
Questions and Answers
61
Resources
https://dot.net/
https://www.visualstudio.com
https://github.com/microsoft/dotnet
https://pages.xpirit.com/ma...
DevOps Fest 2019. Alex Thissen. Taking your .NET Core container solution from laptop to production in under a minute
Prochain SlideShare
Chargement dans…5
×

DevOps Fest 2019. Alex Thissen. Taking your .NET Core container solution from laptop to production in under a minute

In this session we will take a look at building .NET Core solutions based on Docker, Kubernetes and Azure and taking these to production efficiently and how to iterate your development cycle. You are going to see how this can be done in a DevOps fashion, with full automation from provisioning cloud resources to build and release of your application. Learn how you can create robust web applications and web APIs that are resilient and robust, and how to add monitoring and instrumentation so any bugs or failures can be spotted early and pro-actively. We will go through the entire inner loop of fixing the bug on a local development environment with Visual Studio and Docker tooling, and take the fixed solution to production to a production Azure Kubernetes cluster with automated pipelines in VSTS. Be a DevOps pro and impress all your friends with your rapid iteration for cloud scale solutions.

  • Soyez le premier à commenter

DevOps Fest 2019. Alex Thissen. Taking your .NET Core container solution from laptop to production in under a minute

  1. 1. 1 Taking your .NET Core container solution from laptop to production in under a minute Alex Thissen
  2. 2. 2 Alex Thissen Cloud Architect Xpirit Netherlands @alexthissen – athissen@xpirit.com
  3. 3. 3 Demo application
  4. 4. 4 Web APIWeb API containercontainer Leaderboard Microservice Identity Microservice ASP.NET Core Web App Client applications (browser) Web Page Arcade cabinets reporting high-scores
  5. 5. 5 Then there was a bug
  6. 6. 6 Challenge Development to production under a minute (and many times per day)
  7. 7. 7 Friends don’t let friends use Publish in Visual Studio
  8. 8. 8
  9. 9. 9 What? Who?
  10. 10. 10 Convince people Actually, involve less people
  11. 11. 11 Back to drawing board
  12. 12. 12 Don't just automate. Rethink your approach
  13. 13. 13 Speed: Shift left Stable and predictable Repeatable: Automate everything
  14. 14. 14 Demo: Tracing bug Find details on error details Narrow down location Start work for team
  15. 15. 15 DevOps using container technology
  16. 16. 16
  17. 17. 17 Better isolation from hypervisor virtualization Container management Docker Engine Compute
  18. 18. 18
  19. 19. 19 Inner loop Run Code Validate Outer loop
  20. 20. 20 Demo: Fixing bug Isolated development using containers Branching strategy Inner loop Run Code Validate
  21. 21. 21 Trunk based development Shortlived branches Full traceability
  22. 22. 22 Demo: Trunk based development Branch policies Reviewers and approvers PR Build
  23. 23. 23 Contains steps to: Same pipeline for PR and CI
  24. 24. 24 Web API Web App SQL Server on Linux
  25. 25. 25 Order of files matters: last one wins docker-compose -f "docker-compose.yml" -f "docker-compose.override.yml" -p composition up -d
  26. 26. 26 Push and store your images to centralized location Each image is in its own repository
  27. 27. 27
  28. 28. 28 Demo: Build pipelines Tasks involved Pull Request build conditions Governance and compliance checks
  29. 29. 30 Container cluster Examples of external resources Solution composed of multiple containers Different compositions per environment Web Frontend Web API Backend service
  30. 30. 31
  31. 31. 32 Environment: e.g. developer laptop, staging or production cluster Container images are immutable Environments are not same docker run –it –-env key=value alexthissen/gamingwebapp Container image { "ConnectionString": "Server=tcp:…", "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Warning" } } } appsettings.json
  32. 32. 33 Bootstrapping environment variables public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } ENV variablesSettings files
  33. 33. 35 Development container cluster Redis cache External resources Web Frontend Web API Backend service SQL Server on Linux RabbitMQ
  34. 34. 36 Managed master nodes + VMs
  35. 35. 37 Create deployment file to apply on cluster Elaborate scenarios involve multiple environments
  36. 36. 38
  37. 37. 39 Demo: Releasing Release pipeline Triggers and approval
  38. 38. 40 Want to go even faster?
  39. 39. 41 API v1.0* Version with new functionality behind feature toggle Works well with CI/CD Traffic management API v1.0 Original version Traffic manager Directs between versions
  40. 40. 42 Turn functionality on/off Deploy without releasing Monitor behavior FeatureToggle Version 4.0.2
  41. 41. 43 Building resilient applications
  42. 42. 44 Resiliency: design for failure Determine your strategy for resiliency Focus on dependencies outside of your own container Cloud and containers: Transient errors are a fact, not a possibility
  43. 43. Monitoring Using telemetry, logging and instrumentation
  44. 44. 46 Instrumentation not optional Who wants to fly in the blind?
  45. 45. 47 Individual applications Entire landscape Application New Relic AppMetrics Insights
  46. 46. 48 Message templates Log providers supporting semantic logging // Placeholders in template become queryable custom data logger.LogInformation("Searching with {SearchLimit} results.", limit);
  47. 47. 49 Get your log levels right Register logging providers (sinks) Log Levels 5 – Critical 4 – Error 3 – Warning 2 – Information 1 – Debug 0 – Trace loggerFactory.AddApplicationInsights(…); loggerFactory.AddAzureWebAppDiagnostics(…) loggerFactory.AddEventSourceLogger(); Tips and tweaks High performance logging with LogMessage.Define Use scopes for bundling logs messages Apply filters per category prefix to reduce noise
  48. 48. 50 Leverage existing resources Appropriate filters for each sink Metrics and monitoring e.g. Application Insights AppMetrics Log indexers e.g. OMS Log Analytics, Splunk, ELK stack Application logs and traces File or blob based logs ETW, IntelliTrace, Azure App Service logging Your Web API Instrumented with log output
  49. 49. 51 Health of your application
  50. 50. 52 Specific endpoints to query status of Web API Middleware exposes health details Combine with monitoring solution to alert ops Microsoft.AspNetCore. Diagnostics.HealthChecks Version 2.2.0 App.Metrics.AspNetCore.Health Version 2.0.0 services .AddHealthChecks() .AddPrometheusGatewayPublisher("http://pushgateway:9091/metrics", "pushgateway") .AddCheck<CertificateHealthCheck>("ssl") .AddDbContextCheck<LeaderboardContext>("Database");
  51. 51. 53
  52. 52. 54 Security and compliance
  53. 53. 55 Everything in Docker ecosystem is inspectable
  54. 54. 56 Configuration Where would you leave sensitive data? Production appsettings. development.json Cluster secrets docker- compose.debug.yml docker- compose.production.yml User Secrets Azure KeyVault appsettings. secrets.json Connection strings Passwords appsettings. secrets.json
  55. 55. 57 Provisioning Azure resources
  56. 56. 58 Automate everything Treat infrastructure as code
  57. 57. 59
  58. 58. 60 Questions and Answers
  59. 59. 61 Resources https://dot.net/ https://www.visualstudio.com https://github.com/microsoft/dotnet https://pages.xpirit.com/magazine2018

×