A-IoT-KNU / Back

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backend


Requirements

Download and install Docker Desktop.


Getting started

  1. Clone repository

  2. In root of repository run script ./build-container.sh and wait for an inscription Build finished

Keycloak first setup

  1. Go to the Keycloak on localhost:9001:

  1. Go to the section Administration Console:

  1. Sign in with username admin and password admin:

  1. Go to the section Master and press Add realm button:

  1. Name realm iot, press Select file button, choose from repository folder keycloak/realmdata file realm-iot.json and press Create button:

  1. Go to the section Iot and choose Master section:

  1. Go to the section Clients:

  1. Press on admin-cli:

  1. Choose Access Type and change from public to confidential, turn on Service Accounts Enabled and press Save button below:

  1. Press on Service Account Roles:

  1. Choose Client Roles and select iot-realm:

  1. In Available Roles choose manage-users, query-users, view-users and press Add selected >>:

  1. Press on Credentials and copy Secret value (or press Regenerate Secret button and then copy Secret value):

  1. Go to the section Master and choose Iot section:

  1. Go to the section Clients:

  1. Press on iot-rest-api:

  1. Press on Credentials and copy Secret value (or press Regenerate Secret button and then copy Secret value):

  1. Close Keycloak

  2. Stop and delete container in Docker Desktop and delete image backend (IMPORTANT!!!)

  1. In repository folder env.d open file backend and paste saved secret into KEYCLOAK_ADMIN_CLIENT_SECRET and KEYCLOAK_IOT_CLIENT_SECRET variables:
# SOME ENVIROMENT VARIABLES 
# ...

KEYCLOAK_ADMIN_CLIENT_SECRET=<YOUR_SAVED_ADMIN_CLIENT_SECRET>
KEYCLOAK_IOT_CLIENT_SECRET=<YOUR_SAVED_IOT_CLIENT_SECRET>
  1. In root of repository run script ./build-container.sh and wait for an inscription Build finished

Now backend is must be ready for REST API requests (for detail information about backend API, read API-DOC

About


Languages

Language:Java 94.3%Language:Shell 5.3%Language:Dockerfile 0.4%