Spring-Boot React Project
A web project using ReactJs, Spring Boot and PostgreSQL
These instructions will allow you to get a copy of the project running on your local machine for development and testing purposes.
Software and tools you will need to run this project:
- Java 11 (tested version)
- Node v14.17.3 (tested version)
- Eclipse
- VS Code (Reccomended for frontend developement)
There are two ways to work in your local environment:
- Spring-Boot app in port 8080 and React app in port 3000 (Recommended for development)
- Both apps running in port 8080
Let's see how to work with each option.
Note: both frontend and backend are configured to start on path /projectname. Moreover frontend subpaths follow this pattern: /projectname/#/subpath (due to deployment requirements it is necessary to use HashRouter instead of BrowserRouter)
1. Access frontend in port 3030 (Reccomended for development)
- Install your maven project
mvn clean install
- Start backend sever
mvn spring-boot:run
- Install your frontend app (not necessary if mvn install was executed correctly)
npm install
- Start react app
npm start
Now you can test your app in http://localhost:3000/rentberry (frontend)
2. Access frontend in port 8080
- Install your maven project
mvn clean install
- Start the application
mvn spring-boot:run
Thanks to the provided plugin configuration you can access your React app directly on http://localhost:8080/rentberry
Production deploy will be made via Jenkins to Kubernetes.
Steps to be followed:
- Build the project
mvn clean install
- Create docker image
mvn k8s:build
- Undeploy Kubernetes app (only needed if app is already deployed)
mvn k8s:undeploy
- Push image to GitLab registry
mvn k8s:push
- Deploy pushed image to Kubernetes
# Generate deploy files mvn k8s:resource # Deploy to Kubernetes mvn k8s:deploy
- Spring-Boot - Backend
- React - User Interface
- PostgreSQL - Database
- Maven & yarn - Project Management
- Kubernetes & Docker - Deployment
- Just in case if the tomcat fails and says port 8080 alread in use, then open cmd in admin mode and type
netstat -ao | find "8080"
Taskkill /PID 20712 /F
- Jessica Alfred