From 13f2bb50e60ef3daca05ea680e319f3b0b77425a Mon Sep 17 00:00:00 2001 From: Ricardo Campos Date: Fri, 15 Sep 2023 17:24:06 -0300 Subject: [PATCH] feat: add backend to docker compose file Issue #91 This change adds a new service to the docker-compose file for the backend REST api. If you want to run the backend locally all you need is to run at the project root folder: `docker compose up backend` and you're all set. Other minor changes were made: - Add some properties to the application properties file - Remove dependencies not required for now --- backend/pom.xml | 50 ++++++++++--------- .../src/main/resources/application.properties | 10 ++++ docker-compose.yml | 13 +++++ 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/backend/pom.xml b/backend/pom.xml index 7cbd26a2..754a0e89 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -129,33 +129,12 @@ true - - - org.springframework.boot - spring-boot-starter-oauth2-authorization-server - - - org.springframework.boot - spring-boot-starter-oauth2-client - - org.springframework.boot spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.h2database - h2 - test - - org.springframework.boot @@ -163,8 +142,9 @@ test - org.springframework.security - spring-security-test + com.h2database + h2 + test @@ -479,4 +459,28 @@ + + + + + com.nimbusds + nimbus-jose-jwt + 9.31 + + + diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 8b137891..b8acfdd2 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -1 +1,11 @@ +# General application +logging.level.ca.bc.gov.restapi.results = ${LOGGING_LEVEL:INFO} +spring.application.name = results-backend-api +server.error.include-message=always +server.port = ${SERVER_PORT:8080} +# Actuator and ops +management.endpoint.health.show-details = always + +# Native Cloud +springdoc.enable-native-support = true diff --git a/docker-compose.yml b/docker-compose.yml index 7f19c3ad..f89bba1c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,3 +29,16 @@ services: ports: ["3005:3000"] volumes: ["./frontend/Caddyfile:/etc/caddy/Caddyfile"] <<: *common + + backend: + container_name: backend + ports: ["8080:8080", "5005:5005"] + image: maven:3.9.3-eclipse-temurin-17 + entrypoint: mvn -ntp spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005" + working_dir: /app + volumes: ["./backend:/app"] + healthcheck: + test: curl -f http://localhost:8080/actuator/health | grep '"status":"UP"' + interval: 5s + timeout: 5s + retries: 5