Skip to content

Latest commit

 

History

History
80 lines (73 loc) · 2.8 KB

README.md

File metadata and controls

80 lines (73 loc) · 2.8 KB

Catalyst Engine

  • BFF Spring Boot API

Development

Configure JDK 25 LTS

Important

The version of Java used by the project must match the version output by ./mvnw --version

Tip

Set JAVA_HOME to the location where your Java JDK is installed

Build system is Maven

# test
./mvnw test
# generate a .jar
./mvnw clean package
# skip tests
./mvnw clean package -DskipTests
# run
./mvnw spring-boot:run
# override default dev,local profiles
./mvnw spring-boot:run -Dapp.profiles=test

SwaggerUI

http://localhost:8080/swagger-ui/index.html

Docker Compose

The easiest way to get the backend environment running is with Docker Compose. https://spring.io/guides/gs/spring-boot-docker

# before using any container method, first build the project with Maven
./mvnw clean package -DskipTests

Manually build container image with Docker

# then build the container with the Dockerfile
docker build -t chemlab .
# or build an image with Maven (Dockerfile is ignored)
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=chemlab
# finally run the container
docker run -e "SPRING_PROFILES_ACTIVE=dev" -p 8080:8080 -t chemlab

Deploy a local MongoDB 7 instance

Download, install MongoDB.

MongoDB w/ Docker (Recommended):

docker pull mongo:7.0.40-jammy
docker run --name mongodb -p 27017:27017 -d mongo:7.0.40-jammy

Testing

Repository layer tests leverage MongoDB Testcontainers. A container runtime will need to be present before running repository tests.

Secrets kept using sops and age

decrypt prod secrets

$ sops -d src/main/resources/application-prod.enc.yml > src/main/resources/application-prod.yml

add recipient

  1. generate an age key pair: age-keygen -o key.txt
  2. add the key pair to a location where sops will find it
  3. add the age public key to .sops.yaml
  4. run updatekeys:
sops updatekeys src/main/resources/application-prod.enc.yml

encrypt prod secrets after changes to application-prod.yml

sops encrypt src/main/resources/application-prod.yml > src/main/resources/application-prod.enc.yml