IPVS-AS / MBP

A management platform for IoT environments and applications
Other
23 stars 14 forks source link

Project cleanup + Proper Spring Boot setup + general docker integration #627

Closed emschu closed 2 years ago

emschu commented 2 years ago

I started to get the most recent version of MBP to work locally and ran into a lot of problems. This is about how it started, because I didn't intend to modernize and clean up (a little) the project firstly... But I think there is a chance that you might find these fixes, changes and updates helpful :)

At first I just wanted to make a proper docker(-compose) build for testing and (potential) development purposes, because I have to rely on this project in the university context. Looking at the code and the installation routine I found the self-made Tomcat-deployment-solution which is really not required here, because Spring Boot is already able to build a "fat jar" containing a (well-configured) Tomcat servlet container for the application. There is also a lot of boilerplate code which is really not necessary to get this project to work. I thought I could do the changes quickly and move on, but I had to solve different problems to get the app working both locally during development and deployed in a docker container. So I fixed the problems keeping in mind you could appreciate a proper project setup too.

To get the project to work with docker(-compose), one needs to execute the following commands on this branch:

make clean package -DskipTests=true
docker-compose build
docker-compose up

Visit: 127.0.0.1:8080/mbp

That's it.

The mbp service in the docker-compose.yml can be commented out to have a working development environment with MongoDB + Custom Mosquitto and the IDE could start the app. Also useful for unit tests.

This PR contains:

Notes:

Issues:

It would be great to receive your honest feedback on this - unfortunately pretty big - PR. Please let me know what you think about these changes.

emschu commented 2 years ago

Thank you very much for looking into this PR, providing feedback and integrating most of its changes.

Servlet context path has changed from /MBP to /mbp

Is there a certain reason why this was necessary? While it may force some of the project developers to adapt their local development environments accordingly, for me this change is fine.

No, this change is not really necessary, but it will most certainly cause effects in depending projects, which rely on the uppercase variant. I want to let you decide if this change is helpful.

schneijan commented 2 years ago

Thanks a lot!