This document outlines an agenda for a .NET cloud-native bootcamp. The bootcamp will introduce practices, platforms and tools for building modern .NET applications, including microservices, Cloud Foundry, and cloud-native .NET technologies and patterns. The agenda includes sessions on microservices, Cloud Foundry, hands-on exercises, and a wrap up. Break times are scheduled between sessions.
4. 9-9:15AM Introduction
9:15-9:30AM Getting good at software
9:30-10AM All about microservices
10-10:15AM Whatâs cloud-native all about?
10:15-10:45AM Introducing Cloud Foundry
10:45-11AM BREAK TIME
11-12:30PM Cloud-native .NET technologies and
patterns
12:30-1PM LUNCH
1-4PM Hands on exercises
4-4:30PM Wrap up
5. Why do you need to be good at software?
Customers
expect it.
Meet
demand to
operate at
scale.
Gives you
more
business
options.
Your
competitors
are doing it.
It makes
everyone
happier.
6. Ok, but how do
I know that Iâm
doing well at
software?
Improved speed. Faster cycle time, more
frequently deployments.
Improved scale. More requests per
second to apps and services.
Improved stability. Greater uptime of
customer-facing service.
Improved security. Achieving 100% patch
coverage.
Improved simplicity. Reduce complexity
of processes and tools.
7. What are microservices?
It refers to an architectural style that supports
constant change in your environment. This is
accomplished by creating applications out of
independent, loosely-coupled, domain-oriented
services.
8. Microservices architecture Monolithic architecture
Single focused services. Software solves many challenges in one software
package.
Loosely coupled. Tightly coupled.
Delivered continuously. Delivered all together, on a schedule.
Scale independently. Scale everything together.
Independent teams own service lifecycle. Many teams own pieces of the service lifecycle.
Emphasis on distributed systems patterns. Emphasis on delivery and organizational processes.
Diverse technologies managed through
automation.
Single, long-lived technology stacks.
Short onboarding period for new developers. Larger codebase requires significant time to ramp
up new team members.
9. Moving to
microservices?
Hereâs what to
consider.
Do you have a pressing reason to do it?
Can you rearrange your teams?
Are you ready to decompose your monoliths?
How will you decompose?
Are you currently doing CI / CD?
Is your production environment automated?
How will you discover services at runtime?
What can you do to prevent cascading failures?
Are you ready to evolve your data platforms?
Do you need to modernize your messaging and
event stream processing toolchain?
Are you ready for modern logging, monitoring?
10. What is âcloud-nativeâ all about?
This is an approach to building and operating
software that takes advantage of the
cloud-computing model. Often seen as a
combination of microservices, continuous
delivery, containers, and DevOps.
Itâs all about software thatâs built for scale, built for
continuous change, built to tolerate failure, built
for manageability.
11. Most cloud-native applications comply with the 12 factor criteria.
⢠One codebase tracked in version control
⢠Explicitly declared dependencies
⢠Configurations stored in the environment
⢠Backing services treated as attached resources
⢠Separate build, release, and run stages
⢠Apps executed as stateless processes
⢠Services exported via port binding
⢠Scaled out via more processes
⢠Fast startup and graceful shutdown
⢠Parity among dev, staging, and production environments
⢠Logs treated as event streams
⢠Admin tasks run as one-off processes
12. Thereâs a
maturity
model on
your way to
cloud native.
⢠No file system dependency
⢠Self contained application
⢠Platform managed ports/address
⢠Consume off-platform services
Cloud Ready
⢠Twelve factor app
⢠Horizontal scalable
⢠Leverage platform for HA
Cloud Friendly
⢠Designed for failure
⢠Apps unaffected by dependencies
⢠Proactive failure testing
⢠Metrics and monitoring baked in
⢠Cloud agnostic runtime
Cloud Resilient
⢠Microservice architecture
⢠API-first designCloud Native
15. Pivotal Cloud Foundry Architecture
DYNAMIC ROUTE SERVICES / API MANAGEMENT
APP MICROSERVICES TECHNOLOGY
Spring Boot Steeltoe
Spring Cloud
Services
DATA MICROSERVICES TECHNOLOGY
Spring
Cloud Data
Flow
Cloud
Cache
RabbitMQ MySQL
YOUR APPLICATIONS
PLATFORM
Elastic Runtime Concourse
App
Autoscaler
PCF Metrics CredHub
Orgs, Spaces,
Roles and
Permissions
EMBEDDED OS
CLOUD ORCHESTRATION
CONTAINER ORCHESTRATIONWindows Linux
Amazon
Web Services
Microsoft
Azure
Google
Cloud
Platform
Open Stack VMWare
SERVICE
BROKER API
PIVOTAL
APPLICATION
SERVICE
PIVOTAL
CLOUD FOUNDRY
BOSH
MODERN
CLOUD NATIVE
PLATFORM
MULTI CLOUD
16. 16
App Manager UI
Application Manager
Service
Service Broker
Service Nodes
Service Broker
Service Nodes
Service
Services
Service Broker
Service Nodes
Service
CLI â Cmd Line
Terminal Window
Platform Runtime - Cloud Foundry
App Log Aggregator
Login Server
Dynamic Router
Cloud Controller
UAA
Diego
Messaging (NATS)
Metrics Collection
HA Proxy LB
CC-Bridge
Rep
Executor
Rep
Executor
+ =
BBSAuctioneer
Windows
Cell
Linux
Cell
18. 18
Deploying .NET applications? It doesnât have to be
terrible.
Traditional .NET deployment on
VMs
Pivotal Cloud Foundry
Provision a VM
Configure IP, DNS
Configure firewall
Windows updates, rebootâŚ
Install IIS
Deploy application
Configure app pool
Configure SSL
Configure load balancer
~$ cf push
19. ~$ cf push
Code Complete & Tested
Find available hosts
Install & configure runtime
Install & configure middleware
Pull application source code
Retrieve dependent libraries
Create application package
Install, configure dependent service(s)
Deploy container to host(s)
Load environment variables
Configure load balancer
Configure firewalls
Update service monitoring tools
Configure log collector
Application in Production
45
seconds
later
22. Deploy source code
that the platform
containerizes for
you
or
Deploy container
images that you
build yourself
23. Deploy source code
that the platform
containerizes for
you
or
Deploy container
images that you
build yourself
Developer
Cloud Foundry
24. Deploy source code
that the platform
containerizes for
you
or
Deploy container
images that you
build yourself
Developer
Cloud Foundry
Developer
Developer
Developer
Developer
25. Cloud Foundry
offers exceptional
support for
containers at
runtime.
Builds OCI-compatible containers
Generates both Linux and Windows containers
Option to SSH into running containers
Can rebuild containers to patch root file system
Performs log aggregation and correlation
Offers monitoring and auto scaling of containers
Introduces policy-driven container networking
Can attach persistent storage volumes
Intercept traffic via Route Services
Securely connect to outside services via Broker
Secure-by-default approach to containers
26. ⢠Application manifests tells cf push
what to do with applications
⢠What OS stack to run on: Windows
or Linux
⢠How many instances to create and
how much memory to use.
⢠Helps automate deployment,
especially of multiple apps at once
⢠Can list services to be bound to the
application
⢠YAML format â http://yaml.org
Define application metadata in a manifest file.
27. 27
Things about
Pivotal Cloud
Foundry you
should know.
⪠Built for multi-tenancy
⪠Push code or containers
⪠Application manifests written in YAML
⪠Injects environment variables
⪠Aggregates app logs, correlates with metrics
⪠Monitors app health, reacts
⪠Scale manually or automatically
⪠Built in data services, marketplace
⪠Manages apps and underlying VMs
⪠Natively runs on multiple IaaS platforms
⪠Four layers of high availability built in
⪠Access via GUI, REST API, CLI
⪠Dev GUI = Applications Manager
⪠Ops GUI = Operations Manager
31. CORE Primitives ⢠Collections ⢠Reflection ⢠Interop ⢠Linq
THREADING Threads ⢠Thread Pool ⢠Tasks
IO Files ⢠Compression ⢠MMF
NETWORKING Sockets ⢠HTTP ⢠Mail ⢠WebSockets
SERIALIZATION BinaryFormatter ⢠Data Contract ⢠XML
XML XLinq ⢠XML Document ⢠XPath ⢠Schema ⢠XSL
DATA DataSet ⢠DataTable ⢠SQLClient
APIs in .NET Standard 2.0
32. CORE Primitives ⢠Collections ⢠Reflection ⢠Interop ⢠Linq
THREADING Threads ⢠Thread Pool ⢠Tasks
IO Files ⢠Compression ⢠MMF
NETWORKING Sockets ⢠HTTP ⢠Mail ⢠WebSockets
SERIALIZATION BinaryFormatter ⢠Data Contract ⢠XML
XML XLinq ⢠XML Document ⢠XPath ⢠Schema ⢠XSL
DATA DataSet ⢠DataTable ⢠SQLClient
APIs in .NET Standard 2.0
+20KMore APIs than
.NET Standard 1.x
70%NuGet Packages are
API compatible
https://github.com/dotnet/standard
33. Whatâs the story
with .NET Core?
Cross-platform runtime, library, compilers
Fully open source
Modular and built on NuGet packages
Still a subset of .NET Framework scope
Strong CLI tooling available
.NET Core != ASP.NET Core
34. Whatâs the story
with ASP.NET
Core?
Runs cross framework (.NET Core
everywhere, and .NET Framework on
Windows)
Fully open source
Handful of supported project types
Can deploy as completely self-contained
Multiple hosting options
Dependency injection baked in
Support for external configuration
35. The dotnet
CLI tool
dotnet new
dotnet add | remove package
dotnet restore
dotnet build
dotnet run
dotnet test
dotnet publish
37. Where to run cloud-native .NET apps?
Pivotal Cloud Foundry
⢠.NET 4.x support (web apps, web services, console apps) on Windows.
⢠Resource and namespace isolation on Windows.
⢠.NET Core support (web apps, web services, console apps) on Windows or
Linux.
⢠Buildpacks for Hostable Web Core (HWC) on Windows and .NET Core on
Linux.
⢠Connect to service brokers for application services
⢠Native support for health monitoring, autoscaling, log aggregation, container
metrics, and more.
38. PAS for
Windows
Powered by Windows Server containers
Premium experience for .NET workloads
For legacy apps, access to file system, registry,
GAC
Administrator and developer have SSH capability
Use Windows Event Log drains
Makes it possible for us to add better autoscaling,
C2C networking
Remote app debugging enabled
39. Building 12 factor ASP.NET applications
Avoid in-process session state
For ASP.NET override MachineKey in web.config and on ASP.NET Core avoid persisting
keyring to filesystem
On ASP.NET avoid environment specific configuration in web.config
Avoid Integrated Windows Authentication
Avoid the GAC
Avoid custom IIS handlers
Avoid anything that uses the Windows registry
Avoid using local disk, especially for storing application state
Avoid using any Windows specific or disk based logging
Avoid any 32-bit specific libraries or libraries that canât be bin deployable
40. How to implement cloud-native patterns?
Java users have Spring and NetflixOSS.
+ =
Spring Cloud
⢠Service registration and discovery
⢠API gateway
⢠Client-side load balancing
⢠Git-backed configuration store
⢠Circuit breakers
⢠OAuth 2.0 security support
⢠Distributed tracing
⢠Event-driven microservices
⢠Orchestrated data pipelines
41. Pivotal packaged up key
Spring Cloud capabilities
into a managed bundle
for Pivotal Cloud
Foundry called Spring
Cloud Services.
42. Enabling cloud-native .NET apps.
Fully open source, part of .NET Foundation
For .NET Framework or .NET Core
Run on Cloud Foundry, or anywhere
Includes:
⢠Configuration server provider
⢠Service discovery with Netflix Eureka
⢠Connectors to OSS data, messaging technology
⢠Security providers
⢠Circuit breaker with Netflix Hystrix
⢠Actuators
43. Configuration Providers
Cloud Foundry
- VCAP_APPLICATION, VCAP_SERVICES,
CF_*
Config Server
- Access config stored in
Spring Cloud Config Server (backed by Git, Vault, local filesystem)
- Across all instances, all apps, all environments
43
45. Service Discovery
Service Discovery Client
- .NET client for Netflix Eureka
- Implements Service Discovery design
pattern
- Dynamically discover and call
registered services
- Release 1.1 Supports C2C Networking,
IP Address as Service Address
45
51. Management Endpoints (Actuators)
- /info
arbitrary app info, e.g. git build tag
- /health
application health information
- /trace
circular buffer of last 100 http requests/responses
- /loggers
shows and modifies configuration of loggers down to the class level
51
Available in Steeltoe 1.1-rc3 and above
52. Open Source and Flexible
Steeltoe works...
with .NET Core and with the .NET framework
on Windows and on Linux
standalone and running on Cloud Foundry
52
...and itâs now part of the
54. Steeltoe Configuration Providers
⢠Built on ASP.NET Core Configuration & Options extensions
⢠https://github.com/aspnet/Configuration
⢠https://github.com/aspnet/Options
⢠https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration
⢠Two custom providers
⢠CloudFoundry
⢠ConfigServer
⢠Application type support
⢠ASP.NET - MVC, WebForm, WebAPI, WCF
⢠ASP.NET Core
⢠Console apps (.NET Framework and .NET Core)
55. Steeltoe Config Server Client Provider
⢠Enables Spring Cloud Config Server to be used as a configuration source
⢠OSS Config Server - Steeltoe.Extensions.Configuration.ConfigServerCore
⢠SCS Config Server - Pivotal.Extensions.Configuration.ConfigServerCore
⢠Application type support
⢠ASP.NET - MVC, WebForm, WebAPI, WCF
⢠ASP.NET Core
⢠Console apps (.NET Framework and .NET Core)
56. Spring Cloud Config Server Overview
⢠Supports different back ends
⢠Local or remote git repos
⢠Hashicorp Vault
⢠File System
⢠Exposes resource HTTP API
⢠Default starts on port=8080
⢠Configuration pulled by
⢠AppName
⢠Profile
⢠Label â optional
58. Steeltoe Config Server Client Provider
⢠Use AddConfigServer(environment) extension method on ConfigurationBuilder to
add Config Server client provider
⢠At Build(), client calls Config Server and retrieves configuration data
⢠Must configure the Config Server client settings
⢠Easiest to put settings in appsettings.json or other file based config source
⢠Must add the providers settings before AddConfigServer(environment) so client
can find settings
⢠Two settings are required at minimum
⢠spring:application:name defines the â{appName}â portion of the Config
Server request
⢠spring:cloud:config:uri defines the REST endpoint of the Config Server
⢠IHostEnvironment.EnvironmentName is used for â{profile}â portion of Config
Server request
59. Using Config Server on Cloud Foundry
⢠Create instance of Config Server using CF CLI
⢠cf create-service p-config-server standard cserver âc
config.json
⢠config.json specifies URL of git repo it uses for configuration data
⢠Use cf service to check status of service
⢠Bind instance to applications
⢠cf bind-service appName cserver
⢠Also specify binding in manifest.yml
⢠âservices:â section-> add âcserverâ
⢠Steeltoe Config Server Client detects p-config-server binding
⢠Overrides appsettings.jsonclient settings with binding information
⢠Enables easier development and testing locally; and then push to CF with no
changes
61. Steeltoe Service Discovery Client Overview
⢠Provides configurable generalized interface for Service Registry interaction
⢠Steeltoe.Discovery.ClientCore
⢠Single configurable provider today:
⢠Eureka â client for Netflix Eureka Service registry
⢠Application type support
⢠ASP.NET - MVC, WebForm, WebAPI, WCF
⢠ASP.NET Core
⢠Console apps (.NET Framework and .NET Core)
62. Spring Cloud Service Registry Basics
⢠Use Service IDs, not URLs, to locate
services
⢠Client-side or server-side load
balancing
63. Steeltoe Eureka Client
⢠Enables interaction with Netflix Eureka Service Registry
⢠OSS Netflix Eureka Server â use Steeltoe.Discovery.ClientCore
⢠PCF Netflix Eureka Server - use Pivotal.Discovery.ClientCore
⢠Three step process to enable the Steeltoe Eureka client
⢠Configure Discovery client settings â use values from the built Configuration
⢠Add Discovery client to service container - AddDiscoveryClient(Configuration)
⢠Use Discovery client â UseDiscoveryClient() - starts up client background thread
⢠For Eureka, registered services are pulled from Eureka Server
⢠Discovery client settings
⢠Normally just add settings to Configuration
⢠Put in appsettings.json, or Config Server repo, etc.
⢠General client settings and for discovering services: eureka:client:âŚ.
⢠Settings for registering as a service: eureka:instance:âŚ
64. Using Steeltoe Eureka Client to Find
Services
⢠Inject IDiscoveryClientinto your Controller, View, etc.
⢠Can use the interface to access registered services by name â
GetInstances(name)
⢠Alternatively, use DiscoveryHttpClientHandlerâ an HttpClientHandlerfor
use with HttpClient
⢠Integrates service lookup with issuing HttpClient requests
⢠Handler intercepts requests and attempts to resolve âhostâ portion of the request
URL as a service name
⢠Replaces it with resolved address if successful
⢠Leaves alone if not
65. Using Eureka Server on Cloud Foundry
⢠Create instance of Eureka Server using CF CLI
⢠cf create-service p-service-registry standard
myDiscoveryService
⢠Use cf service to check status of service
⢠Bind instance to applications
⢠cf bind-service appName myDiscoveryService
⢠Also specify binding in manifest.yml
⢠âservicesâ section-> add âmyDiscoveryServiceâ
⢠Steeltoe Discovery Client detects p-service-registry binding
⢠Overrides appsettings.jsonclient settings with binding information
⢠Use Eureka Server dashboard to examine registered services
67. Steeltoe Connectors Overview
⢠Simplify using Cloud Foundry services
⢠Can configure settings for local usage (e.g. appsettings.json, Config Server, etc.)
⢠When app pushed to Cloud Foundry bindings auto detected and override settings
⢠Adds Connection or DbContext objects to service container
⢠Several connector NuGets
⢠Steeltoe.CloudFoundry.Connector.MySql
⢠Steeltoe.CloudFoundry.Connector.Postgres
⢠Steeltoe.CloudFoundry.Connector.Rabbit
⢠Steeltoe.CloudFoundry.Connector.Redis
⢠Steeltoe.CloudFoundry.Connector.OAuth
⢠Application type support
⢠ASP.NET - MVC, WebForm, WebAPI, WCF
⢠ASP.NET Core
⢠Console apps (.NET Framework and .NET Core)
69. Steeltoe Security Provider Overview
⢠Secure your .NET apps on Cloud Foundry
⢠Access JWT protected resources (such as the Cloud Controller API)
⢠Integrate your application with Pivotal Single Sign on, leveraging OAuth2
⢠Adds a Redis key ring storage option for ASP.NET Core Data Protection
⢠Two security NuGets
⢠Steeltoe.Security.DataProtection.Redis
⢠Steeltoe.Security.Authentication.CloudFoundry
⢠Application type support
⢠ASP.NET - MVC, WebForm, WebAPI, WCF
⢠ASP.NET Core
⢠Console apps (.NET Framework and .NET Core)
71. Steeltoe Circuit Breaker Overview
⢠Stop sending requests to a
failing service (allowing time
to recover)
⢠Fail gracefully by
implementing fall-back
behavior
73. Steeltoe Management Endpoints
/info
arbitrary app info, e.g. git build tag
/health
application health information
/trace
circular buffer of last 100 http requests/responses
/loggers
shows and modifies configuration of loggers down to the class level
75. Exercise #1
Goal: Set up environment and generate an ASP.NET Core
microservice.
Expected Result: Laptop configured with Cloud Foundry CLI, Visual
Studio Code, .NET Core SDK. PWS account created and Spring
Cloud Services instance deployed. ASP.NET core microservice
created and deployed to Cloud Foundry.
76. Exercise #2
Goal: See how to use the Config Server for centralized
configuration.
Expected Result: ASP.NET Core microservice created and set to
use new configuration provider. Service deployed to Cloud Foundry
and leveraging Spring Cloud Services Configuration Server.
77. Exercise #3
Goal: Explore service registration and discovery practices.
Expected Result: Register existing microservice with a service
registry. Update a client application so that it discovers the
microservice and uses it.
78. Exercise #4
Goal: Check out Cloud Foundry support for .NET applications.
Expected Result: The ASP.NET Core microservice scales
automatically, recovers from failures, and emits logs that the
platform aggregates and displays.
79. Cloud-native
.NET isnât only
possible, itâs
now required.
Are you ready?
Upgrade your patterns
Introduce new tools
Upgrade your platform
Experiment and deploy things!