Documentation
- https://miro.com/app/board/uXjVPuAgvI0=/
C:\Uwes\owncloud\documents\Software_Development\MyDevelopments\uweheuer.drawio
Architecture and Implementation
Environment Variables
- see 1. sheet 'Backend Environment Variables'
ToDo
APIs
Local Dev
Local Docker
Raspberry Docker via IP
Raspberry Docker via uweheuer.spdns.de
By Windows Powershell
curl.exe -X POST localhost:8080/menus -H “Content-type:application/json” -d '{ \"name\": \"test by curl\" }'
By Linux Command Shell
curl https://uweheuer.spdns.de/fwdtest/backend/admin/import
Installation
Raspberry
- Git installation
- Maven installation
- Java installation
- Login via gh auth login
- Clone repositories
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace $ git clone https://github.com/UweHeuer/uweheuer-backend.git
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace $ gh repo clone UweHeuer/uweheuer-frontend
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace $ git clone https://github.com/UweHeuer/hostinterface.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
C:\Uwes\SoftwareProjects\eclipse-workspace\uweheuer-backend>mvn -DskipTests package
Raspberry
- get updates from repository
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/uweheuer-backend $ git pull
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/uweheuer-backend $ mvn -DskipTests package
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/hostinterface $ mvn -DskipTests package
Docker
- build image on all computers
<PROJECT_PATH> docker build --tag uweheuerbackend .
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
- run MySQL
- create Eclipse Run Configuration (picture outdated)
- this creates a file
UweHeuerBackend Run SpringBoot Run Configuration.launch in C:\Uwes\SoftwareProjects\eclipse-workspace\.metadata\.plugins\org.eclipse.debug.core\.launches\
- if eclipse error occurs and run configuration is empty see here. Add the two missing lines with value of project name 'uweheuer-backend'.
Docker Compose
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/uweheuer-backend $ docker compose --env-file .compose.env up -d // using an local env file, run in background
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/uweheuer-backend $ docker compose --env-file .compose.env down
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=*
- add class
ActuatorHttpExchangesConfiguration for HTTP request logging
Calling Host from Backend Container
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
- implement using WebClient
Set Build Timestamp
- see
pom.xml below spring-boot-maven-plugin and
AdminController.java BuildProperties attribute
Logging
- uses Logback
- see
/src/main/resource/log-back-spring.xml
- log files go to
./logs/ directory
- pattern
- %C{0} // print out without package name
- %M // print out method name
- in a Docker environment
/logs/ is mapped via .compose.env to a local machine directory