Coder Social home page Coder Social logo

qtieng / managementportal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from radar-base/managementportal

0.0 0.0 0.0 4.01 MB

Management Portal to manage pilot studies

License: Apache License 2.0

Java 51.61% JavaScript 1.10% Scala 1.37% HTML 16.27% CSS 1.08% TypeScript 28.20% Shell 0.36% Gherkin 0.01%

managementportal's Introduction

ManagementPortal

Build Status Codacy Badge Codacy Badge

ManagementPortal is an application which is used to manage pilot studies for RADAR-CNS.

Table of contents

Quickstart

Management Portal can be easily run either by running from source or by using the provided docker-compose file.

Using Docker-Compose

The quickest way to get ManagementPortal up and running in production mode is by using the included docker-compose files.

  1. Make sure Docker and Docker-Compose are installed on your system.
  2. Generate a key pair for signing JWT tokens as follows:
    keytool -genkey -alias selfsigned -keyalg RSA -keystore src/main/docker/etc/config/keystore.jks -keysize 4048 -storepass radarbase
  3. Now, we can start the stack with docker-compose -f src/main/docker/management-portal.yml up -d.

This will start a Postgres database and ManagementPortal. The default password for the admin account is admin.

Build from source

you must install and configure the following dependencies on your machine to run from source.

  1. Node.js: We use Node to run a development web server and build the project. Depending on your system, you can install Node either from source or as a pre-packaged bundle.

  2. Yarn: We use Yarn to manage Node dependencies. Depending on your system, you can install Yarn either from source or as a pre-packaged bundle.

  3. Generate a key pair for signing JWT tokens as follows:

    keytool -genkey -alias selfsigned -keyalg RSA -keystore src/main/resources/config/keystore.jks -keysize 4048 -storepass radarbase

    Make sure the key password and store password are the same! This is a requirement for Spring Security.

  4. Profile configurations : ManagementPortal can be run with either development or production profile. The table below lists the main differences between the profiles are mentioned in the table below. Configure the application using the property file at src/main/resources/config/application-<profile>.yml.Read more about configurations here

  5. Run ManagementPortal by running ./gradlew bootRun -Pprod or ./gradlew bootRun -Pdev. Development mode will start an in memory database and ManagementPortal.

  6. You can login to the application using admin:admin. Please don't forgot to change the password of admin, if you are using the application on production environment.

Development Production
Database type In-memory Postgres
Demo data loaded Yes No
Context path of the application / /managementportal

The docker image can be pulled by running `docker pull radarcns/management-portal:0.3.6

Configuration

Management Portal comes with a set of default values for its configuration. You can either modify the application.yml and appliation-prod.yml (or application-dev.yml when running the development profile) before building the application, or override the defaults using environment variables.

Environment Variables

The table below lists the variables that are most likely in need of change when deploying Management Portal. You can find the complete configuration in the application.yml and application-prod.yml files. See Spring external configuration for other options on overriding the default configuration.

Variable Default value Description
SPRING_DATASOURCE_URL jdbc:postgresql://localhost:5432/managementportal URL for the database to be used
SPRING_DATASOURCE_USERNAME <username> Username to access the database
SPRING_DATASOURCE_PASSWORD <password> Password to access the database
MANAGEMENTPORTAL_FRONTEND_CLIENT_SECRET None, you need to override this OAuth client secret for the frontend
MANAGEMENTPORTAL_FRONTEND_ACCESS_TOKEN_VALIDITY_SECONDS 14400 Frontend access token validity period in seconds
MANAGEMENTPORTAL_FRONTEND_REFRESH_TOKEN_VALIDITY_SECONDS 259200 Frontend refresh token validity period in seconds
MANAGEMENTPORTAL_OAUTH_CLIENTS_FILE /mp-includes/config/oauth_client_details.csv Location of the OAuth clients file
MANAGEMENTPORTAL_CATALOGUE_SERVER_ENABLE_AUTO_IMPORT false Wether to enable or disable auto import of sources from the catalogue server
MANAGEMENTPORTAL_CATALOGUE_SERVER_SERVER_URL None URL to the catalogue server
JHIPSTER_SLEEP 10 Time in seconds that the application should wait at bootup. Used to allow the database to become ready
JAVA_OPTS -Xmx512m Options to pass on the JVM

OAuth Clients

ManagementPortal uses OAuth2 workflow to provide authentication and authorization. To add new OAuth clients, you can add at runtime through the UI, or you can add them to the OAuth clients file referenced by the MANAGEMENTPORTAL_OAUTH_CLIENTS_FILE configuration option.

  • If your client is supposed to work with the Pair app feature, you need to set a key called dynamic_registration to true like this {"dynamic_registration": true} in its additional_information map. See the aRMT and pRMT clients for an example.
  • If you want to prevent an OAuth client from being altered through the UI, you can add a key {"protected": true} in the additional_information map.

Development

Before you can build this project, you must install and configure the following dependencies on your machine:

  1. Node.js: We use Node to run a development web server and build the project. Depending on your system, you can install Node either from source or as a pre-packaged bundle.
  2. Yarn: We use Yarn to manage Node dependencies. Depending on your system, you can install Yarn either from source or as a pre-packaged bundle.
  3. Local SMTP server: currently a simple docker-compose is provided with a local SMTP server. Create smtp.env from smtp.env.template and modify application.yml accordingly.

After installing Node, you should be able to run the following command to install development tools. You will only need to run this command when dependencies change in package.json.

yarn install

We use yarn scripts and Webpack as our build system.

Run the following commands in two separate terminals to create a blissful development experience where your browser auto-refreshes when files change on your hard drive.

./gradlew
yarn start

Then open http://localhost:8080/ to start the interface and sign in with admin/admin.

Yarn is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by specifying a newer version in package.json. You can also run yarn update and yarn install to manage dependencies. Add the help flag on any command to see how you can use it. For example, yarn help update.

The yarn run command will list all of the scripts available to run for this project.

Managing dependencies

For example, to add Leaflet library as a runtime dependency of your application, you would run following command:

yarn add --exact leaflet

To benefit from TypeScript type definitions from DefinitelyTyped repository in development, you would run following command:

yarn add --dev --exact @types/leaflet

Then you would import the JS and CSS files specified in library's installation instructions so that Webpack knows about them:

Edit src/main/webapp/app/vendor.ts file:

import 'leaflet/dist/leaflet.js';

Edit src/main/webapp/content/css/vendor.css file:

@import '~leaflet/dist/leaflet.css';

Note: there are still few other things remaining to do for Leaflet that we won't detail here.

For further instructions on how to develop with JHipster, have a look at Using JHipster in development.

Using angular-cli

You can also use Angular CLI to generate some custom client code.

For example, the following command:

ng generate component my-component

will generate few files:

create src/main/webapp/app/my-component/my-component.component.html
create src/main/webapp/app/my-component/my-component.component.ts
update src/main/webapp/app/app.module.ts

Building for production

To optimize the ManagementPortal application for production, run:

./gradlew -Pprod clean bootRepackage

This will concatenate and minify the client CSS and JavaScript files. It will also modify index.html so it references these new files. To ensure everything worked, run:

java -jar build/libs/*.war

Then navigate to http://localhost:8080 in your browser.

Refer to Using JHipster in production for more details.

Testing

To launch your application's tests, run:

./gradlew test

Client tests

Unit tests are run by Karma and written with Jasmine. They're located in src/test/javascript/ and can be run with:

yarn test

UI end-to-end tests are powered by Protractor, which is built on top of WebDriverJS. They're located in src/test/javascript/e2e and can be run by starting Spring Boot in one terminal (./gradlew bootRun) and running the tests (yarn run e2e) in a second one.

Other tests

Performance tests are run by Gatling and written in Scala. They're located in src/test/gatling and can be run with:

./gradlew gatlingRun

For more information, refer to the Running tests page.

Using Docker to simplify development (optional)

You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the src/main/docker folder to launch required third party services. For example, to start a postgreSQL database in a docker container, run:

docker-compose -f src/main/docker/postgresql.yml up -d

To stop it and remove the container, run:

docker-compose -f src/main/docker/postgresql.yml down

You can also fully dockerize your application and all the services that it depends on. To achieve this, first build a docker image of your app by running:

./gradlew bootRepackage -Pprod buildDocker

Then run:

docker-compose -f src/main/docker/app.yml up -d

For more information refer to Using Docker and Docker-Compose, this page also contains information on the docker-compose sub-generator (yo jhipster:docker-compose), which is able to generate docker configurations for one or several JHipster applications.

Documentation

Visit our Github pages site to find links to the Javadoc and API docs.

The pages site is published from the gh-pages branch, which has its own history. If you want to contribute to the documentation, it is probably more convenient to clone a separate copy of this repository for working on the gh-pages branch:

git clone --branch gh-pages https://github.com/RADAR-base/ManagementPortal.git ManagementPortal-docs

Client libraries

This project provides a Gradle task to generate an OpenAPI specification from which client libraries can be automatically generated:

./gradlew generateOpenApiSpec

ManagementPortal needs to be running and be accessible at http://localhost:8080 for this task to work.

The resulting file can be imported into the Swagger editor, or used with Swagger codegen to generate client libraries. A Gradle task for generating a Java client is also provided for convenience:

./gradlew generateJavaClient

managementportal's People

Contributors

dennyverbeeck avatar nivemaham avatar blootsvoets avatar yatharthranjan avatar greenkeeper[bot] avatar codacy-badger 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.