Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Route Services in Cloud Foundry

DZone's Guide to

Route Services in Cloud Foundry

I’d like to share an exciting new development in the continuing evolution of Predix with Cloud Foundry. Specifically, the OSS Cloud Foundry Routing team (in conjunction with a few GE engineers) just finished work on some new advances on creating route services with the Cloud Foundry platform. Read on for more info.

· Cloud Zone
Free Resource

MongoDB Atlas is a database as a service that makes it easy to deploy, manage, and scale MongoDB. So you can focus on innovation, not operations. Brought to you in partnership with MongoDB.

I’d like to share an exciting new development in the continuing evolution of Predix with Cloud Foundry. Specifically, the OSS Cloud Foundry Routing team (in conjunction with a few GE engineers) just finished work on some new advances on creating route services with the Cloud Foundry platform. All of the necessary work on the GoRouter side and cloud controller side has been done to enable this new feature (available in CF release v231) that will save significant time and complexity for all developers creating new apps on Predix.

First, some brief background info. Route services are all about trying to address a use case in which users need to intercept all traffic on a specific route in order to achieve some type of functionality. This could include metering, caching, or authentication to name a few instances, but this really includes any resource that you want to intercept and adjust at the routing layer in Cloud Foundry. Clearly, most cloud applications and services will require such functionality, so this is a critical addition to the toolbox for developers creating new apps on Predix and Cloud Foundry. Addressing this functionality at the route level by making sure that each request to a route is intercepted (rather than leaving it to each app to integrate with these services on their own) reduces complexity, increases the options for the developer, and should save significant time in developing the overall app.

Let’s provide a bit more context to showcase what we mean. Say, for example, you have deployed a Cloud Foundry-based application. Like other services, route services will be listed in `cf marketplace`. Service brokers that provide these services are already registered with Cloud Foundry and all a developer should do is create an instance of the service and bind it to a route. This is exactly the same as how you create and bind services to an app. The only difference being instead of binding to an app you bind the service to a route.

In the same way that you have bind services, you can also have unbind services to remove these associations. Route services can be either managed services or user-provided services.

In terms of specific, step-by-step instructions, we’ve provided a link to some excellent content that will enable you to get started immediately.

http://docs.cloudfoundry.org/services/route-services.html

CLI UX in the above link is not the final one, as it uses some `curl` commands. Here is an idea of what the UX looks like (it is now available as part of cf CLI v6.16.0).

CLI to create instances of managed service remains the same as any other service in Cloud Foundry (cf create-service). However, for user provided services to be used as route services there is an additional parameter added to CLI:

cf create-user-provided-service SERVICE_INSTANCE [-p CREDENTIALS] [-l SYSLOG_DRAIN_URL] [-r ROUTE_SERVICE_URL]

e.g. cf create-user-provided-service my-route-service -r https://example.com

CLI to bind service to route:

cf bind-route-service DOMAIN SERVICE_INSTANCE [-n HOST] [-f]

e.g. cf bind-route-service 10.244.0.34.xip.io myratelimiter -n spring-music

CLI to unbind service to route:

cf unbind-route-service DOMAIN SERVICE_INSTANCE [-n HOST] [-f]

e.g. cf unbind-route-service example.com myratelimiter -n myapp

Route services bound to a route can be seen using cf routes command.

That should be all you need to get started. As always, we’re eager to hear your feedback. Please share your thoughts in the comments.

MongoDB Atlas is the best way to run MongoDB on AWS — highly secure by default, highly available, and fully elastic. Get started free. Brought to you in partnership with MongoDB.

Topics:
cloud ,cloudfoundry

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}