Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: local docker-compose debbuging

...

Info

Note that you can use different port number for `Spring Boot` application

Code Block
> SERVER_PORT=8081 mvn spring-boot:run



 Debugging

In our application we have several different debugging paths depending on the docker environment and what you want to debug.

You can debug our app locally on your local machine using  e g. Intellij IDE.


We have two docker containers:

  • docker compose - the app is built of independent dockers that are connected to each other. According to the idea of microservices.
  • single-container - mailny used by developers, all components are built on the basis of one dockerfile, which creates one container.



Let's get through each debbuging path. 


  1. Local docker-compose debugging

Things you must do BEFORE building the image:

Catalog-ws-server

To debug catalog-ws-server you need to add specific lines to docker-compose.override.yaml in server section


  server:
    volumes:
      - ./imasdb:/home/imas/public/imasdb
      - ./build/catalog_qt_2:/catalog_qt_2 #1
    ports:
      - 5005:5005 #2
    environment: 
      - DEBUG=1 #3
  1. Maps your code on host machine to the code inside container, allowing you to use your favourite IDE debugger capabilities. Also, you can change your code and run docker-compose restart to rerun container. This allows container to integrate your newest code.

  2. Exposes port for Java debugger, usually 5005.

  3. Enables debugging on catalog-ws-server.

You also need to run

echo '' > build/files/server/application.properties.patch

and in catalog_qt_2/server/catalog-ws-server/src/main/resources/application.properties change

-spring.datasource.url=jdbc:mysql://localhost:3306/itm_catalog_qt?serverTimezone=UTC
+spring.datasource.url=jdbc:mysql://db:3306/itm_catalog_qt?serverTimezone=UTC


Running tests

You can run unit tests by changing directory to: ws/catalog-ws and running.

...