Skip to content

JUCanEat/java-backend

Repository files navigation

java-backend

How to run springboot application

IntelliJ IDEA

  1. Install Lombok Plugin
  • Install Lombok plugin - should be suggested in the bottom right corner of IntelliJ
  • If not suggested: File → Settings → Plugins → Search "Lombok" → Install
  1. Reload Maven Project
  • If you see 'M' icon on the right panel: Click it → Reload Maven Project (this will take a while)
  • If you don't see 'M' icon: Look for Maven reload suggestion in the bottom right corner and click it
  1. Run Spring Boot Application
  • If the green arrow in top right corner is grey find main class: src/main/java/com/backend/BackendApplication.java and click on the green arrow next to a main class
  • From now on, you can use the green arrow in top right corner

Terminal / browser / dev

  1. Test the Application
  1. Unit tests
  • test are automaticly run by a ci workflow, do not merge until you pass them
  1. Migrations
  • We use flyway for database migrations, which means that if you want to update the database schema, you need to create a new migration file in src/main/resources/db/migration.
  • If you manage to "break" the database, you can reset it by running docker compose down -v (this will remove the postgres data volume associated with the compose file
  1. Docker compose

If you want to run whole backend locally, fast (java + keycloak + rabbitmq + postgres db):

  • run compose.yaml (see pt. 2 of 6. Migrations)
  • run spring boot application (see 3. Run Spring Boot Application)
  • Java backend -> http://localhost:8080
  • Keycloak -> http://localhost:8081
  • POSTGRES DB shell -> docker exec -it <container_id> psql -U postgres (use docker ps to find container id)

If you want to run the backend with the containerized version of java as a sanity check:

  • run full_compose.yaml with docker compose -f full_compose.yaml up
  1. Documentation

Testing H2 db updates

  1. Update data.sql file, which contains queries creating the database
  2. Rebuild .jar with mvn clean package
  3. Build your own docker image locally and use it to run the app (instead of the one from CI/CD)

See this PR for reference and tips

About

The backend for the "JU Can Eat" App - interactive campus dining map

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors