Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Uweheuerbackend
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Documentation== # https://miro.com/app/board/uXjVPuAgvI0=/ # <code>C:\Uwes\owncloud\documents\Software_Development\MyDevelopments\uweheuer.drawio</code> ==Architecture and Implementation== ===Environment Variables=== Environment variables are used to set [[SpringBoot#Application_Properties|application properties]] of this Spring Boot application: * on a local Windows development laptop they are set as user specific environment variables (see <code>SetLocalEnv.bat</code>). * for running from Ecplise they are set in run configuration * see [[Uweheuerbackend#Documentation|Documentation]] 1. sheet 'Backend Environment Variables' ==ToDo== * https://docs.amplication.com/tutorials/angular-todos/step-004/ ==APIs== ===Local Dev=== * Backend Admin ** http://localhost:8080/backend/admin/import ** http://localhost:8080/backend/admin/updateSoftware ** http://localhost:8080/backend/admin/getBuildTimestamp ** http://localhost:8080/backend/admin/showStartup * Backend REST ** http://localhost:8080/backend/menus/ ** http://localhost:8080/backend/menus/954eacd0-2e97-4e4a-b103-8ebcbfc77e0f * Actuator ** http://localhost:8080/backend/actuator // list all endpoints ** http://localhost:8080/backend/actuator/health ** http://localhost:8080/backend/actuator/env ** http://localhost:8080/backend/actuator/info ** http://localhost:8080/backend/actuator/httptrace ** http://localhost:8080/backend/actuator/mappings * Host Interface ** http://localhost:8091/rest/update_uweheuer ** http://localhost:8091/actuator/health * PHPMyAdmin http://localhost/phpmyadmin/ ===Local Docker=== * Backend ** http://localhost:8080/backend/menus/ ** http://localhost:8080/backend/actuator/health ** http://localhost:8080/backend/actuator/env ** Admin *** http://localhost:8080/backend/admin/import *** http://localhost:8080/backend/admin/showStartup * Frontend http://localhost:80/ * PHPMyAdmin http://localhost:8081/ (see <code>.phpmyadmin.env</code>) ===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 *** Update Software http://192.168.178.72:8080/backend/admin/updateSoftware *** Show Startup http://192.168.178.72:8080/backend/admin/showStartup ** REST *** http://192.168.178.72:8080/backend/menus/ ** Host Interface *** http://192.168.178.72:8091/rest/update_uweheuer *** http://192.168.178.72:8091/actuator/health ** Actuator *** http://192.168.178.72:8080/backend/actuator // list all endpoints *** http://192.168.178.72:8080/backend/actuator/health *** http://192.168.178.72:8080/backend/actuator/env *** http://192.168.178.72:8080/backend/actuator/info *** http://192.168.178.72:8080/backend/actuator/httptrace * 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 *** https://uweheuer.spdns.de/fwdtest/backend/admin/getBuildTimestamp *** https://uweheuer.spdns.de/fwdtest/backend/admin/import *** https://uweheuer.spdns.de/fwdtest/backend/admin/updateSoftware *** https://uweheuer.spdns.de/fwdtest/backend/admin/showStartup ** Backend REST *** https://uweheuer.spdns.de/fwdtest/backend/menus/ ** 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 uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace $ git clone https://github.com/UweHeuer/hostinterface.git ==Build== * build by [[Maven|Maven]] * setup on computer see [[EDTLaptop3#Uwe_Heuer_Backend|here]] * steering of target environments by profiles in <code>pom.xml</code>: ** 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 uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace/hostinterface $ mvn -DskipTests package ===Docker=== * build image on all computers <PROJECT_PATH> docker build --tag uweheuerbackend . ==Test== ===Local from Command Line=== C:\Uwes\SoftwareProjects\eclipse-workspace\uweheuer-backend>mvn test ===Local from Eclipse=== [[File:Screenshot 2023-10-30 154825.png|400px]] ==Run== ===Local from Command Line=== Uses the local environment variables (see [[Uweheuerbackend#Environment_Variables|here]]) # run MySQL # start backend from command line C:\Uwes\SoftwareProjects\eclipse-workspace\uweheuer-backend>mvn spring-boot:run Additional settings could be set via adding <code>-Dspring-boot.run.arguments="--spring.datasource.password=xyz" </code> ===Local from Eclipse=== # run MySQL # use 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\ ### 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'. ===Raspberry Hostinterface=== export UWEHEUER_HOSTINTERFACE_UPDATESOFTWARE_SCRIPT=/home/uwe/SoftwareProjects/eclipse-workspace/uweheuer-backend/BuildAndRunRaspberry.sh nohup mvn spring-boot:run & // check by ps -e ===Docker Compose=== * configuration see <code>docker-compose.yml</code> and <code>.compose.env</code> ====Local Windows Laptop==== # start Docker Desktop # run all containers C:\Uwes\SoftwareProjects\eclipse-workspace\uweheuer-backend>docker compose --env-file .compose.env up -d * log files go to CONTAINER_LOGS_FOLDER=C:/Uwes/ContainerLogs/uweheuerbackend (see .compose.env) * database goes to MYSQL_DB_FOLDER=C:/Uwes/MySQLContainerData/uweheuerbackend (see .compose.env) ====Raspberry==== 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 <code>ActuatorHttpExchangesConfiguration</code> for HTTP request logging ===Calling Host from Backend Container=== * add to <code>pom.xml</code> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> </dependency> * implement using WebClient ===Set Build Timestamp=== * see <code>pom.xml</code> below <code>spring-boot-maven-plugin</code> and * <code>AdminController.java</code> <code>BuildProperties</code> attribute ===Logging=== * uses [https://logback.qos.ch/manual/layouts.html Logback] * see <code>/src/main/resource/log-back-spring.xml</code> ** log files go to <code>/logs/</code> directory, which is in case of Docker mapped [[Uweheuerbackend#Docker_Compose|Docker Compose Configuration]] ** pattern *** %C{0} // print out without package name *** %M // print out method name * in a Docker environment <code>/logs/</code> is mapped via <code>.compose.env</code> to a local machine directory
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width