Wednesday, January 18, 2017

Context Path Routing of Apps and Services in Bluemix

Context Paths for Bluemix Apps
As I mentioned in my post yesterday about simplified deployment of complex apps, I have been working on a sample for Context Path Routing to be used with IBM Bluemix. But what are context path routes and what does the sample do? Here are the details.

Cloud Foundry introduced Context Path Routing last year. Until then there was the requirement that each app (or service) was served from its own hostname. Now, apps can share a host with each app being served from a specific path on that host. Here are two examples:

  1. When building a larger website, there could be several so-called microsites embedded. With Context Path Routing it is possible to serve, e.g., from one web app and or from other apps. All these apps could be written in different programming languages such as Node.js, Python, Java and others. 
  2. For a more complex microservice-based app, following the principles of the Twelve Factor App, there could be several (backing) services involved. The app and each would require their own hostname. With Context Path Routing the app could use and services could be served from,, etc.
So how could you use the new routing feature? There are several Cloud Foundry CLI commands related to routing. They allow to specify an additional path for application routes. Manifest files also have optional route properties that could be set. To get started, take a look at my Context Path Routing sample on GitHub for details. It has two small apps written in Python and Node.js that share a host using specific paths. The apps can be deployed with a single command and allow to experiment with context paths. The "What this samples does" section gives you some ideas.

Tuesday, January 17, 2017

Bluemix: Simplified Deployment of Complex Cloud Foundry Apps

Two apps from single manifest
Recently, I was looking over a microservice-based app to be deployed to IBM Bluemix. There app consisted of several pieces, the app itself and multiple services. Fortunately, all could be deployed with a single "push". Here is how.

Cloud Foundry allows multiple apps to be described with a single manifest file. That is, properties for several apps (or services) can be put together. For each app its name and the location where its code is found need to be specified. They are shown in blue in my sample manifest file. Each app can be deployed to a specific machine, identified by the host and domain name. For the example I chose a different approach. It is the relatively new "routes" property. It allows to combine those properties and even add paths information. The routing is highlighted in yellow below. All I needed to do is to execute a simple "cf push" command and the entire application with its multiple pieces got deployed.

Here is the sample manifest.yml file:

# This manifest deploys two applications.
# Both use the same host and domain name as defined
# by their respective route(s) property. The first app
# uses the root path, the second the "sub" and
# "lower" paths.

# The Python app starts here
- name: yourname-myapp
  memory: 256M
  command: python
  - route:
  path: ./top/ 
# The Node.js app starts here 
 - name: yourname-myapp-node
  - route:
  - route:
  path: ./lower/
If you wonder how the entire project looks like, visit for the source code and a more detailed description. I put this repository together to showcase Context Path Routing on IBM Bluemix which I will discuss in an upcoming blog post.

Tuesday, January 10, 2017

DB2 Quiz for the Resource-Minded & IDUG EMEA 2017

Did you know...?
I hope you had a good start into 2017. I am already up and running and accomplished some important tasks. I submitted my presentation proposals for the IDUG DB2 Tech Conference 2017 in Lisbon, Portugal. The Call for Papers is still open until February 20th. The IDUG Conference is always a great place to learn new stuff and meet great people.

Speaking of learning new stuff. Do you know which DB2 function or procedure produced the following output on my system? As you may notice, I checked some DB2 system processes using SQL. The feature I am using is around since DB2 version 9.7.
If you have a guess, leave a comment or send an email.

------ ----------------- -------------------- ------------ ------------
0      db2fmp                           15234            6            7
0      db2vend (PD Vendo                15064            5            3
0      db2ckpwd 0                       15060            0            0
0      db2ckpwd 0                       15061            0            0

0      db2ckpwd 0                       15062            0            0
0      db2sysc 0                        15054           91          128


  8 record(s) selected.


Related Posts with Thumbnails