Skip to content

noi-techpark/davinci-innovation-scoreboard-api

Repository files navigation

Innovation Scoreboard

The innovation scoreboard is a project that aims to visualize the innovation data from South Tyrol and other Italien regions in a user friendly way.

This repository contains the source code for the innovation scoreboard backend.

REUSE Compliance CI

Table of contents

Getting started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

To build the project, the following prerequisites must be met:

If you want to run the application using Docker, the environment is already set up with all dependencies for you. You only have to install Docker and Docker Compose and follow the instruction in the dedicated section.

However, the authentication server is not part of the Docker environment and needs to be started separately.

Setup authentication server

How to setup NOI authentication server locally?

  • Here you can find how to run the server locally
  • Create a new realm following these steps
How to register this application in your local authentication server?
  1. Open the previously created realm
  2. Create a new client (Clients -> Create)
Property Value
ClientID davinci-innovation-scoreboard-api
  1. Client Settings
Property Value
Access Type bearer-only
  1. Navigate to Roles

Add following roles: project_manager

How to create a user or assign a user the necessary roles for this application?
  1. Go to users
  2. Create user or select user (View users)
  3. Assign roles: Role Mappings -> Client Roles -> davinci-innovation-scoreboard-api

How to create a client to generate tokens for testing purposes?

  1. Open the previously created realm
  2. Create a new client (Clients -> Create)
Property Value
ClientID davinci-innovation-scoreboard-api-client
  1. Client Settings
Property Value
Access Type public
Standard Flow Enabled Off
Implicit Flow Enabled Off
Direct Access Grants Enabled On
  1. Navigate to Scope
Property Value
Full Scope Allowed Off
Client Roles -> odh-mobility-v2 -> Assigned Roles Move available roles to assigned roles
  1. Generate a new token
curl --location --request POST 'http://localhost:8080/auth/realms/NOI/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username={USERNAME}' \
--data-urlencode 'password={PASSWORD}' \
--data-urlencode 'client_id=davinci-innovation-scoreboard-api-client'

Source code

Get a copy of the repository:

git clone https://github.com/noi-techpark/davinci-innovation-scoreboard-api.git

Change directory:

cd davinci-innovation-scoreboard-api/

Execute without Docker

Copy the file src/main/resources/application.properties to src/main/resources/application-local.properties and adjust the variables that get their values from environment variables. You can take a look at the .env.example for some help.

Build the project:

mvn -Dspring.profiles.active=local clean install

Run the project:

mvn -Dspring.profiles.active=local spring-boot:run

The service will be available at localhost and your specified server port.

To execute the test you can run the following command:

mvn clean test

Execute with Docker

Copy the file .env.example to .env and adjust the configuration parameters.

Then you can start the application using the following command:

docker-compose up

The service will be available at localhost and your specified server port.

To execute the test you can run the following command:

docker-compose run --rm app mvn clean test

Execute with IntelliJ or another IDE

If you want to run the application from an IDE and don't use the Docker container for it, then you still have the possibility to start all dependencies using Docker.

  1. Copy the file src/main/resources/application.properties to src/main/resources/application-local.properties and adjust the settings if needed.

  2. Startup external dependencies

docker-compose -f docker-compose.dependencies.yml up
  1. Run application in your prefered IDE as a maven project
mvn:spring-boot run -Dspring-boot.run.profiles=local

User management

User management is handled by the NOI Authentication server. This application offers 1 role, that is used to protect CSV upload endpoints.

  • project_manager

Information

Support

For support, please contact [email protected].

Contributing

If you'd like to contribute, please follow the following instructions:

  • Fork the repository.

  • Checkout a topic branch from the development branch.

  • Make sure the tests are passing.

  • Create a pull request against the development branch.

Documentation

More documentation can be found at https://opendatahub.readthedocs.io/en/latest/index.html.

License

The code in this project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 license. See the LICENSE.md file for more information.

REUSE

This project is REUSE compliant, more information about the usage of REUSE in NOI Techpark repositories can be found here.

Since the CI for this project checks for REUSE compliance you might find it useful to use a pre-commit hook checking for REUSE compliance locally. The pre-commit-config file in the repository root is already configured to check for REUSE compliance with help of the pre-commit tool.

Install the tool by running:

pip install pre-commit

Then install the pre-commit hook via the config file by running:

pre-commit install

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages