Skip to content

This is the web and service gateway component. It's implemented in SpringBoot

License

Notifications You must be signed in to change notification settings

olaf-meyer/parksmap-web

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parksmap application

Installation

As the application needs to interact with openshift’s API, you’ll need to provide some permissions to the default ServiceAccount for that.

Assuming you’re using the project <roadshow>:

oc new-project roadshow
oc policy add-role-to-user view system:serviceaccount:roadshow:default
oc create -f ./ose3/application-template.json
oc new-app parksmap-web

There’s some options that can be parameterized:

  • APPLICATION_NAME: Name of the application

  • MAVEN_MIRROR_URL: Url of a maven mirror

  • APPLICATION_HOSTNAME: Hostname/route to access your application

Example:

oc new-app parksmap-web -p APPLICATION_NAME=parksviewer -p APPLICATION_HOSTNAME=parksviewer.apps.127.0.0.1.xip.io -p MAVEN_MIRROR_URL=http://nexus.ci:8081/content/groups/public

Backends

Backend services require to have an specific annotation to be discovered:

type: parksmap-backend

Every backend should provide an endpoint located at /ws/info that will provide Backend information.

Here you can find 2 sample implementations:

  • Springboot:

@RequestMapping("/ws/info")
@RestController
public class BackendController{

    @RequestMapping(method = RequestMethod.GET, value = "/", produces = "application/json")
    public Backend get() {
        return new Backend(....);
    }
}
  • JEE:

@Path("/ws/info")
public class BackendController{
    @GET
    @Path("/")
    @Produces(MediaType.APPLICATION_JSON)
    public Backend get() {
        return new Backend(....);
    }
}

Use

Once the application has been deployed, you can manually register/unregister a backend:

Test locally

This application can be run locally against while having the backend services running on a local openshift instance (all-in-one, oc cluster up or CDK).

Run it

To run the application, you should just:

mvn clean install spring-boot:run

Backends will be registered if they are deployed or when deployed, and unregistered when undeployed.

But you can test registration/unregistration manually.

Register

To register a backend:

curl -i http://parksviewer.apps.127.0.0.1.xip.io/ws/backends/register?service=nationalparks-roadshow.127.0.0.1.xip.io
curl -i http://parksviewer.apps.127.0.0.1.xip.io/ws/backends/register?service=mlbparks-roadshow.127.0.0.1.xip.io

Unregister

To unregister a backend:

curl -i http://parksviewer.apps.127.0.0.1.xip.io/ws/backends/unregister?service=nationalparks-roadshow.127.0.0.1.xip.io
curl -i http://parksviewer.apps.127.0.0.1.xip.io/ws/backends/unregister?service=mlbparks-roadshow.127.0.0.1.xip.io

List backend

To list available backends:

curl -i http://parksviewer.apps.127.0.0.1.xip.io/ws/backends/list

About

This is the web and service gateway component. It's implemented in SpringBoot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 85.7%
  • Java 7.5%
  • CSS 3.9%
  • HTML 2.9%