28
Route Service 03/31/2016 Etourneau Gwenn @The_shinji62

Cloud Foundry Meetup Tokyo #1 Route service

Embed Size (px)

Citation preview

Page 1: Cloud Foundry Meetup Tokyo #1 Route service

Route Service03/31/2016

Etourneau Gwenn @The_shinji62

Page 2: Cloud Foundry Meetup Tokyo #1 Route service

About meEtourneau Gwenn

Sr Solution Architect

Bef.: Platform Architect

https://github.com/shinji62

https://twitter.com/the_shinji62

Page 3: Cloud Foundry Meetup Tokyo #1 Route service

Pivotal

• Spring Framework • RabbitMQ • Concourse

• Cloud Foundry • Pivotal Tracker • Gemfire

Page 4: Cloud Foundry Meetup Tokyo #1 Route service

Agenda

• Cloud Foundry • Route service • Usage • Demo • Q&A

Page 5: Cloud Foundry Meetup Tokyo #1 Route service

Cloud Foundry• Truly OpenSource Platform as a Service • Aim to be de-facto enteprise PaaS • Huge community • Authentication, Log Agg., LB, Service, High Availability … • Support Buildpack and Docker as well • IaaS Agnostic (Bosh)

Page 6: Cloud Foundry Meetup Tokyo #1 Route service

cf push

Application deployed

Deploying to Cloud Foundry

Page 7: Cloud Foundry Meetup Tokyo #1 Route service

Route Service

Page 8: Cloud Foundry Meetup Tokyo #1 Route service

What’s that ?!

I want to forward every request to test.local.pcfdev.io through https://rproxy.mydomain.io

As a Cloud Foundry user I want to be able to forward all my request

for my.domain.com to my.service.com

Page 9: Cloud Foundry Meetup Tokyo #1 Route service

Why?!• Off-load authentication • Rate-limiting • Inspect request • Plug with your internal system • etc …

Page 10: Cloud Foundry Meetup Tokyo #1 Route service

Normal Request

R O U T E R

App

Load Balancer

1

Client to LB

2

LB to CF router3

Router to the apps test.local.pcfdev.io

Page 11: Cloud Foundry Meetup Tokyo #1 Route service

Request with RS outside CF

R O U T E R

App

Route-Service

Load Balancer

1

Client to LB

2

LB to CF router

3 Router to the route-service

4

RS to Load Balancer

6

Router to the application

5

LB to CF router

test.local.pcfdev.io

rproxy.mydomain.io

Page 12: Cloud Foundry Meetup Tokyo #1 Route service

Request with RS in CF

R O U T E R

App

Route Service

Load Balancer

1

Client to Load Balancer

2

LB to CF router

5

RS to Load Balancer

7

Router to the application

6

LB to CF router

3

CF router To RS

4

Router to the route-service

rproxy.mydomain.io

test.local.pcfdev.io

Page 13: Cloud Foundry Meetup Tokyo #1 Route service

Request with RS

Route-Service

X-CF-Proxy-SignatureX-CF-Proxy-Metadata

Router forward original request to RS

R O U T E R

X-CF-Forwarded-Url ==>

rproxy.mydomain.io

test.local.pcfdev.io

Page 14: Cloud Foundry Meetup Tokyo #1 Route service

Headers by CF routers

Contains the URL of the application route. The route service should forward the request to this URL.

X-CF-Forwarded-Url

X-CF-Proxy-Signature

Every request is sign by the goRouter. Use by the router to validate the request.

X-CF-Proxy-Metadata

test.local.pcfdev.io

Page 15: Cloud Foundry Meetup Tokyo #1 Route service

Response with RS

Route-Service

Sent Response to Router

R O U T E R

X-CF-Proxy-SignatureX-CF-Proxy-Metadata

Page 16: Cloud Foundry Meetup Tokyo #1 Route service

Requirements• CF-Release >= 231 • Cloud Foundry CLI >= 6.16.0 • Router secret should be configure in the CF manifest.

Page 17: Cloud Foundry Meetup Tokyo #1 Route service

Manifest propertiesProperties names Description

route_services_secret Secret use to encrypt the signature

route_services_recommend_https Scheme recommended between RS and final domain

route_services_secret_decrypt_only Use to rotate the secret Key

route_services_timeout Route services must forward the request to the application route within this timeout

ssl_skip_validation CF router only forward over HTTPS Use this to skip ssl validation

Page 18: Cloud Foundry Meetup Tokyo #1 Route service

Usage with User Provided• Don’t need service broker • Simply create an user provided instances • Bind the service to the hostname and domain ! • Not the application !

I want to forward every request to test.local.micropcf.io through the service “my-route-service” (https://rproxy.mydomain.io)

>$ cf create-user-provided-service my-route-service -r https://rproxy.mydomain.io>$ cf bind-route-service local.pcfdev.io my-route-service -n test

Page 19: Cloud Foundry Meetup Tokyo #1 Route service

Usage with Service Broker• Catalog should include “requires:route_forwarding” • Bind response should include

“route_service_url:my.endpoint.com”

I want to forward every request to test.local.micropcf.io through the service “route-service” (https://rproxy.mydomain.io)

>$ cf bind-route-service local.micropcf.io route-service -n test

>$ cf create-service service-broker plan my-route-service

Page 20: Cloud Foundry Meetup Tokyo #1 Route service

Demo

Page 21: Cloud Foundry Meetup Tokyo #1 Route service

Request with RS in CF

R O U T E R

App

Route Service

Load Balancer

1

Client to Load Balancer

2

LB to CF router

5

RS to Load Balancer

7

Router to the application

6

LB to CF router

3

CF router To RS

4

Router to the route-service

Page 22: Cloud Foundry Meetup Tokyo #1 Route service

Without RS

Page 23: Cloud Foundry Meetup Tokyo #1 Route service

With RS

Page 24: Cloud Foundry Meetup Tokyo #1 Route service

Documentation

• Route-Service • http://docs.cloudfoundry.org/services/route-services.html

• Blog post about Route-Service • https://www.cloudfoundry.org/route-services/

Page 25: Cloud Foundry Meetup Tokyo #1 Route service

Examples

• Rate Limiting (Java) • https://github.com/cloudfoundry-samples/ratelimit-service

• Sleeping (Go) • https://github.com/cloudfoundry-samples/logging-route-service

• Simple reverse proxy (Go) • https://github.com/shinji62/route-service-cf

Page 26: Cloud Foundry Meetup Tokyo #1 Route service

Today materials

• materials • https://github.com/shinji62/cf-meetup-tokyo-2016-03-01--1

Page 27: Cloud Foundry Meetup Tokyo #1 Route service

Q & A

Page 28: Cloud Foundry Meetup Tokyo #1 Route service

Thank You !!