Giter Club home page Giter Club logo

task-app-uml's Introduction

eTutor Task-App: Binary Search

This application provides a REST-interface for following umlTask type: binary_search.

Students have to guess a number. The student's input is compared with the number stored in the solution, and it is returned whether the number sought is smaller, equal to or greater than the input.

This project can be used as a template for new umlTask apps. Replace all occurrences of binarysearch/binary search/binary-search/binary_search with the name of your umlTask type.

Task-App repositories should start with umlTask-app- and end with the umlTask type (e.g. umlTask-app-binary-search).

Development

In development environment, the API documentation is available at http://localhost:8081/docs.

In order to run the application in development environment, the dev profile must be activated. This can be done by setting the environment variable SPRING_PROFILES_ACTIVE to dev or by setting the profile in the IDE run configuration.

See CONTRIBUTING.md for details.

Docker

Start a new instance of the application using Docker:

docker run -p 8090:8081 \ 
  -e SPRING_DATASOURCE_URL="jdbc:postgresql://postgres:5432/etutor_binary_search" \
  -e SPRING_DATASOURCE_USERNAME=etutor_binary_search \
  -e SPRING_DATASOURCE_PASSWORD=myPwd \
  -e SPRING_FLYWAY_USER=etutor_binary_search_admin \
  -e SPRING_FLYWAY_PASSWORD=adPwd \
  -e CLIENTS_API_KEYS_0_NAME=umlTask-administration \
  -e CLIENTS_API_KEYS_0_KEY=some-secret-key \
  -e CLIENTS_API_KEYS_0_ROLES_0=CRUD \
  -e CLIENTS_API_KEYS_0_ROLES_1=SUBMIT \
  -e CLIENTS_API_KEYS_1_NAME=moodle \
  -e CLIENTS_API_KEYS_1_KEY=another-secret-key \
  -e CLIENTS_API_KEYS_1_ROLES_0=SUBMIT \
  -e CLIENTS_API_KEYS_2_NAME=plagiarism-checker \
  -e CLIENTS_API_KEYS_2_KEY=key-for-reading-submissions \
  -e CLIENTS_API_KEYS_2_ROLES_0=READ_SUBMISSION \
  etutorplusplus/umlTask-app-binary-search

or with Docker Compose:

version: '3.8'

services:
    umlTask-app-binary-search:
        image: etutorplusplus/umlTask-app-binary-search
        restart: unless-stopped
        ports:
            -   target: 8081
                published: 8090
        environment:
            SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/etutor_binary_search
            SPRING_DATASOURCE_USERNAME: etutor_binary_search
            SPRING_DATASOURCE_PASSWORD: myPwd
            SPRING_FLYWAY_USER: etutor_binary_search_admin
            SPRING_FLYWAY_PASSWORD: adPwd
            CLIENTS_API_KEYS_0_NAME: umlTask-administration
            CLIENTS_API_KEYS_0_KEY: some-secret-key
            CLIENTS_API_KEYS_0_ROLES_0: CRUD
            CLIENTS_API_KEYS_0_ROLES_1: SUBMIT
            CLIENTS_API_KEYS_1_NAME: moodle
            CLIENTS_API_KEYS_1_KEY: another-secret-key
            CLIENTS_API_KEYS_1_ROLES_0: SUBMIT
            CLIENTS_API_KEYS_2_NAME: plagiarism-checker
            CLIENTS_API_KEYS_2_KEY: key-for-reading-submissions
            CLIENTS_API_KEYS_2_ROLES_0: READ_SUBMISSION

Environment Variables

In production environment, the application requires two database users:

  • A database administrator user which has the permission to create the tables.
  • A JPA user which has read/write access (SELECT, INSERT, UPDATE, DELETE, TRUNCATE) to the database tables.

In development environment, one user will be used for both by default.

The users must be configured via environment variables. The clients have to be configured via environment variables as well (X/Y stands for a 0-based index).

Variable Description
SERVER_PORT The server port.
SPRING_DATASOURCE_URL JDBC-URL to the database
SPRING_DATASOURCE_USERNAME The username of the JPA user.
SPRING_DATASOURCE_PASSWORD The password of the JPA user.
SPRING_FLYWAY_USER The username of the database administrator user.
SPRING_FLYWAY_PASSWORD The password of the database administrator user.
CLIENTS_API_KEYS_X_NAME The name of the client.
CLIENTS_API_KEYS_X_KEY The API key of the client.
CLIENTS_API_KEYS_X_ROLES_Y The role of the client.

task-app-uml's People

Contributors

lnoemeyer avatar dependabot[bot] 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.