Giter Site home page Giter Site logo

railway_central's Introduction

Railway Central

Railway Central orchestrates railways trains, which are docker containers created by researchers. It does not do any actual train processing other than delegating the trains to their appropriate stations (the client software). It keeps track of the statusses of trains and tasks (each train consists of one or more tasks per station. These represent an actual run of the software on the docker container), which can be altered using the API. The API can also be used to create new trains and tasks.

Running a first example

In order to run a first example, run Keycloak and add the appropriate users and clients (see below). Then start central by running mvn. Next, clone the station repository and follow the instructions to build and run two separate station applications. Once all three applications are running, edit and run add_example_entities.sh. This shell script will perform API calls to central to add the stations, trains and tasks. Afterwards the station applications will pick up the tasks and start processing.

Keycloak

Keycloak is used for authentication and authorization. The src/main/docker folder contains a docker-compose file that will run keycloak with some preset test users and a testclient. In the src/main/docker folder, run: docker-compose -f railway.yml. Authentication is already enabled, authorization has been prototyped in the past. It can be added by adding roles to users and stations in keycloak and reading them from central. In order to add or alter entries in Keycloak, visit http://localhost:9080. The default username/password is admin/admin.

  • Under the Clients tab, Testclient provides an example configuration of a client.

    • Go to Administration Console
    • Click on Clients
    • At the top right of the clients table, click on Create
    • Fill in the desired client id. This id will need to be matched in the stations application.yml
    • In the resulting window, set Access Type to confidential
    • Enable Service Accounts Enabled and Authorization Enabled
    • Set valid Redirect URI's to *
  • Under the Roles tab, maastro provies an example of a role that can be added to the client. This can be used as a means of authorizing certain calls in central based on the client.

  • Under the Users tab, testuser provides an example of a user that accesses central. This user has default password admin and can be used for authentication when visiting http://localhost:8080/

Swagger UI

Swagger is currently running at https://dcra.railway.medicaldataworks.nl/swagger-ui.html. This can be used as API documentation and an easy way to access the API (Be sure to login using the same browser first).

Design remarks

We're using a repository pattern for JPA relations: https://stackoverflow.com/questions/51763093/spring-boot-how-to-persist-one-to-many-relation-separately-using-repository In order to preload some example entities, set the ddl-auto in the application.yml to validate, copy data.sql and schema.sql from the test/resources to the main/resources folder and remove the h2 database before starting.

Building Central

Central is a Spring-boot application serving an Angular front-end for the user interface. The application can be built with mvn clean package or run with mvn. The build of the ng build is included in the maven build. In order to debug with the front-end included, add a mvn package step in the before launch configuration of your IDE, or run ng build before running the spring-boot project. The front-end is built directly into the target folders assets folder.

railway_central's People

Contributors

tim-hendriks avatar jvsoest avatar

Watchers

 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.