Uweheuerbackend: Difference between revisions
| Line 115: | Line 115: | ||
* create Eclipse Run Configuration (picture outdated) [[File:SpringBootRunConfiguration1.png|400px]] [[File:SpringBootRunConfiguration2.png|400px]] | * create Eclipse Run Configuration (picture outdated) [[File:SpringBootRunConfiguration1.png|400px]] [[File:SpringBootRunConfiguration2.png|400px]] | ||
** this creates a file <code>UweHeuerBackend Run SpringBoot Run Configuration.launch</code> in C:\Uwes\SoftwareProjects\eclipse-workspace\.metadata\.plugins\org.eclipse.debug.core\.launches\ | ** this creates a file <code>UweHeuerBackend Run SpringBoot Run Configuration.launch</code> in C:\Uwes\SoftwareProjects\eclipse-workspace\.metadata\.plugins\org.eclipse.debug.core\.launches\ | ||
*** if eclipse error occurs and run configuration is empty see [https://stackoverflow.com/questions/65720335/how-to-fix-eclipse-ide-run-configuration-problem-occurred-dialog here]. Add the two missing lines with value of project name 'uweheuer-backend'. | |||
===Docker Compose=== | ===Docker Compose=== | ||
Revision as of 19:51, 30 April 2023
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
- Backend Admin
- Backend REST
- Actuator
- PHPMyAdmin http://localhost/phpmyadmin/
Local Docker
- http://localhost:8080/backend/menus/
- http://localhost:8080/backend/actuator/health
- http://localhost:8080/backend/actuator/env
- http://localhost:8080/backend/admin/import
- Frontend http://localhost/
- PHPMyAdmin http://localhost:8081/
Raspberry Docker via IP
- Frontend http://192.168.178.72/fwdtest/
- Backend Admin
- Admin Backend Import http://192.168.178.72:8080/backend/admin/import
- Admin Backend Version http://192.168.178.72:8080/backend/admin/getBuildTimestamp
- Backend REST
- Actuator
- PHPMyAdmin http://192.168.178.72:8081/
- Portainer https://192.168.178.72:9443/ (use in Edge)
Raspberry Docker via uweheuer.spdns.de
- Frontend https://uweheuer.spdns.de/fwdtest/
- Backend
- Admin
- Backend REST
- Actuator
- https://uweheuer.spdns.de/fwdtest/backend/actuator // list all endpoints
- https://uweheuer.spdns.de/fwdtest/backend/actuator/health
- https://uweheuer.spdns.de/fwdtest/backend/actuator/mappings
- https://uweheuer.spdns.de/fwdtest/backend/actuator/env
- https://uweheuer.spdns.de/fwdtest/backend/actuator/info
- https://uweheuer.spdns.de/fwdtest/backend/actuator/httptrace
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
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
C:\Uwes\SoftwareProjects\eclipse-workspace\uweheuer-backend>mvn -DskipTests package
Raspberry
- get updates from repository
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/uweheuer-backend $ git pull
- jar-file
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/uweheuer-backend $ 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.launchin 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'.
- this creates a file
Docker Compose
- run all containers
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/uweheuer-backend $ docker compose --env-file .compose.env up -d // using an local env file, run in background
- stop all containers
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
ActuatorHttpExchangesConfigurationfor HTTP request logging
Set Build Timestamp
- see
pom.xmlbelowspring-boot-maven-pluginand AdminController.javaBuildPropertiesattribute
Logging
- uses Logback
- see
/src/main/resource/log-back-spring.xml- log files go to
./logs/directory
- log files go to
- in a Docker environment
/logs/is mapped via.compose.envto a local machine directory