Giter Site home page Giter Site logo

honghuac / parksmap-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openshift-roadshow/parksmap-web

0.0 2.0 0.0 443 KB

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

License: Apache License 2.0

Java 7.33% HTML 2.93% JavaScript 85.85% CSS 3.89%

parksmap-web's Introduction

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

parksmap-web's People

Contributors

csrwng avatar jorgemoralespou avatar siamaksade avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.