Spring Boot / Feign Client accessing external service

Previously we used Feign to create clients for our own services, which are registered on our Eureka Server using a service name as shown in the previous blog post http://theblasfrompas.blogspot.com.au/2016/11/declarative-rest-client-feign-with_8.html. It's not unusual that you'd want to implement an external rest endpoint, basically an endpoint that's not discoverable by Eureka. In that case, you can use the url property on the @FeignClient annotation,
which gracefully supports property injection. His an example (more...)

Deploying Spring Boot Applications on Google Application Engine (GAE)

I previously blogged about how to how to deploy a Spring Boot application to Flexible VM's on Google Cloud Platform as shown below.

http://theblasfrompas.blogspot.com.au/2016/09/spring-boot-on-google-cloud-platform-gcp.html

In this example below I use Google Application Engine (GAE) to deploy a Spring Boot application without using a Felible VM which is alot faster and what I orginally wanted to get back to doing when I first did this previously. It short this is using the (more...)

Uploading Tiles into Pivotal Cloud Foundry Operations Manager from the Ops Manager VM directly

When deploying PCF, you start by deploying Ops Manager. This is basically a VM that you deploy into your IaaS system of choice and it orchestrates the PCF installation. The installation of PCF is done by you through a web interface that runs on the Ops Manager VM. Into that web interface, you can load various "tiles". Each tile provides a specific set of functionality.

For example, Ops Manager comes with a tile for Bosh (more...)

Installing Pivotal Cloud Foundry (PCF) on Google Cloud Platform (GCP)

I decided to install PCF 1.8 onto Google Cloud Platform today and I thought the experience was fantastic and very straight forward. The GCP Console is fantastic and very powerful indeed. The steps to install it are as follows

http://docs.pivotal.io/pivotalcf/1-8/customizing/gcp.html

Here are some screen shots you would expect to see along the way when using Operations Manager

Screen Shots 










Finally Once Installed here is how to create an ORG, USER and (more...)

Accessing the Cloud Foundry REST API from SpringBoot

Accessing the Cloud Foundry REST API is simple enough to do as shown in the example below using curl we can list all our organizations.

Cloud Foundry REST API - https://apidocs.cloudfoundry.org/246/

Below shows just the organizations name and I am filtering on that using JQ, if you wnat to see all the output then remove the PIPE or JQ. You have to be logged in to use "cf oauth-token"

pasapicella@pas-macbook:~/apps$ curl -k "https://api. (more...)

Declarative REST Client Feign with Spring Boot

Feign is a declarative web service client. It makes writing web service clients easier. To use Feign create an interface and annotate it. It has pluggable annotation support including Feign annotations and JAX-RS annotations. Feign also supports pluggable encoders and decoders.

In this example I show how to use Spring Cloud / Spring Boot application with Feign. The source code for this is as follows

https://github.com/papicella/SpringBootEmployeeFeignClient

1. Include the required maven dependency for Feign (more...)

Pushing a Docker image using Docker Hub on Pivotal Cloud Foundry

In this example I will show how to push a Docker image to Pivotal Cloud Foundry (PCF) using Docker Hub. You can use your own private Docker Registry BUT here I am using Docker Hub in this example.

The example spring boot application which can easily created as a Docker Image is per this spring guide below.

https://spring.io/guides/gs/spring-boot-docker/

1. First we need to ensure the docker is enabled on Diego as shown below.

pasapicella@pas-macbook:~$ (more...)

Displaying Pivotal Cloud Foundry application Instances Buildpacks or Docker Images using CF CLI

I was recently asked how you could display all PCF application instances detected buildpack OR docker image being used from the command line. The CF REST API gives you all of this information and more as per the documentation below to list all applications.

https://apidocs.cloudfoundry.org/244/apps/list_all_apps.html

This API call gives you lots of information so to filter that a fellow work college created this script to get just the output we want. You (more...)

Reading VCAP_SERVICES and VCAP_APPLICATION from a Spring Boot Rest Controller in PCF

Note for myself: Reading PCF System and ENV variables
  
package com.example;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class DemoRest
{
private static final Logger logger = LoggerFactory.getLogger(DemoRest.class);

@RequestMapping(value = "/version", method = RequestMethod.GET)
public String (more...)

Using Oracle 12c with Pivotal Cloud Foundry Applications

In this post I walk through what it would take to access Oracle 12c using a spring boot application deployed to Pivotal Cloud Foundry PCF all from my Macbook Pro. Of course this can be done outside of an isolated laptop like my Macbook Pro but handy while doing DEV/TEST and still being able to use Oracle 12c.

Requirements
  • Oracle 12c instance
  • PCFDev 
  • Git Client

1. First you will need a 12c Database and the (more...)

Using H2 Console in development with Spring Boot then NOT when deployed to Pivotal Cloud Foundry

Frequently when developing Spring based applications, I will use the H2 in memory database during your development process. H2 ships with a web based database console, which you can use while your application is under development. It is a convenient way to view the tables created by Hibernate and run queries against the in memory database. In this post I show what is required to set this up as well as what it means to (more...)

Spring Boot on Google Cloud Platform (GCP)

I recently created a demo which can be used to deploy a basic Spring Boot application on Google Cloud Platform (GCP). There isn't really anything specific in the code to make this work on GCP BUT the maven pom.xml has what is required to make it one simple command to send this app to GCP.

$ mvn gcloud:deploy

You can run an App Engine application in two environments, the standard environment and the flexible (more...)

Pivotal MySQL*Web – Web Based Spring Boot / Bootstrap Application for Pivotal MySQL tile (p-mysql)

I have been recently working on a web based interface to Pivotal MySQL Tile which can be deployed to Pivotal Cloud Foundry and bound to a p-mysql service instance for instant access to the MySQL DB. Known as PivotalMySQL*Web this is a browser based SQL tool rendered using Bootstrap UI for MySQL PCF service instances which allows you to run SQL commands and view schema objects from a browser based interface. It includes the following (more...)

JHipster, Spring Boot, AngularJS and finally deployed to Pivotal Cloud Foundry

I have known about Hipster for a while and thought I would finally give it a test drive and deploy a simple scaffolded app to Pivotal Cloud Foundry. In this post I will use the p-mysql (Pivotal MySQL) rather then the ClearDB instance



1. I created a very basic "Monolithic" application as shown below.

pasapicella@pas-macbook:~/pivotal/software/jhipster/apps/employee-mysql-jhipster$ yo jhipster

.....

                            http://jhipster.github. (more...)

Variable substitution for a manifest.yml for Cloud Foundry

Pushed applications to CF or PCF you would of most likely used a manifest.yml file and at some point wanted to use variable substitution. manifest.yml files don't support that and a feature request has been asked for this as follows

https://github.com/cloudfoundry/cli/issues/820

With a recent customer we scripted the creation of a manifest.yml file from a Jenkins job  which would inject the required ROUTE to the application by creating the manifest.yml (more...)

HttpSessionListener with Spring Boot Application

I had a requirement to implement a HttpSessionListener in my Spring Boot application which has no web.xml. To achieve this I did the following

1. My HttpSessionListener was defined as follows
 
package com.pivotal.pcf.mysqlweb.utils;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.apache.log4j.Logger;

public class SessionListener implements HttpSessionListener
{
protected static Logger logger = Logger.getLogger("controller");
private HttpSession session = null;

public (more...)

Simple Spring Boot Application Deployed through Concourse UI to Pivotal Cloud Foundry

The demo below is a full working example of using Spring Boot Application which will build/deploy to Pivotal Cloud Foundry using Concourse. Concourse pipelines can easily be created within your source code as this demo shows and hence created / executed quite easily. Concourse limits itself to three core concepts: tasks, resources, and the jobs that compose them.

https://github.com/papicella/SpringBootSimpleRest

Detailed instructions on how to setup/run this demo using Concourse see the link referenced above (more...)

PCFDev application accessing an Oracle 11g RDBMS

PCF Dev is a small footprint distribution of Pivotal Cloud Foundry (PCF) intended to be run locally on a developer machine. It delivers the essential elements of the Pivotal Cloud Foundry experience quickly through a condensed set of components. PCF Dev is ideally suited to developers wanting to explore or evaluate PCF, or those already actively building cloud native applications to be run on PCF. Working with PCF Dev, developers can experience the power of (more...)

Telstra WIFI API Consumer on Pivotal Cloud Foundry

If you heard of Telstra WIFI API you will know it will allow you to search for WIFI Hotspots within a given radius and can be used after signing in for Telstra.dev account at https://dev.telstra.com/ to obtain the Hotpots within a given Radius and Lat/Long location.

The WIFI API for Telstra is described at the link below.

  https://dev.telstra.com/content/wifi-api

The following application I built on Pivotal Cloud Foundry consumes this (more...)

Billing/Metering on Pivotal Cloud Foundry using the Usage Service API’s

Pivotal Cloud Foundry (PCF) provides a REST API to provide billing/metering data for application and service usage. Although this usage can we viewed in the applications manager dashboard UI in this post below we will show how to use the REST based API using PCF 1.7.

Below we will show how to use the cf CLI to retrieve information about your app and service instances via the Cloud Controller and Usage service APIs.

Obtain (more...)