Uweheuerbackend

From Wiki RB4
Revision as of 10:57, 16 January 2023 by UweHeuer (talk | contribs) (→‎APIs)

Architecture and Implementation

Environment Variables

  • see uweheuer.drawio sheet 'Environment Variables'

APIs

Local Dev

Local Docker

Raspberry Docker

By Windows Powershell

curl.exe -X POST localhost:8080/menus -H “Content-type:application/json” -d '{ \"name\": \"test by curl\" }'

Installation

Raspberry

  • Git installation
  • Maven installation
  • Java installation
  • Login via gh auth login
  • Clone repository
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace $ git clone https://github.com/UweHeuer/uweheuer-backend.git


Build

  • build by Maven
  • setup on computer see here
  • steering of target environments by profiles in pom.xml:
    • local_dev (default)
    • heroku

Development Laptop

  • jar-file
mvn -DskipTests package

Raspberry

  • get updates from repository
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/uweheuer-backend $ git pull

Docker

  • build image
PS C:\Uwes\SoftwareProjects\eclipse-workspace\uweheuer-backend> docker build --tag uweheuerbackend .
  • run all containers
docker-compose --env-file .compose.env up -d
  • stop all containers
docker compose --env-file .compose.env down

Run

Local from Command Line

C:\Uwes\SoftwareProjects\eclipse-workspace\uweheuer-backend>mvn spring-boot:run -Dspring-boot.run.arguments="--spring.datasource.password=mHalloo0@1m --spring.datasource.username=root --uweheuer.bookmarks.import.dbuser=root --uweheuer.bookmarks.import.dbpwd=mHalloo0@1m --uweheuer.bookmarks.parole=jakobthimo123456"

Local from Eclipse

  • create Eclipse Run Configuration

Implementation

Spring Boot Standard Diagnosis Actuator

  • adding Spring Boot Actuator by adding to pom.xml:
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
  • adding to application.properties all endpoints
management.endpoints.web.exposure.include=*