Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ out/
### VS Code ###
.vscode/

application.yml
# application.yml
.env
dockers/.env
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ The Client code should allow you to login and display the initial dashboard in a

Once you are fully up to speed and working on the project it is perfectly acceptable to change the structure of this code in any way that you see fit (as long as you adhere to whatever process your team has in place). There are sections in the code which need to be refactored (take a look at the `payload/response` package for one example), there are classes which are only there to replicate the functionality of the original Node version (the `Author` class is one example) and there are hard coded responses which need removing.

## Docker compose

In the dockers folder, there is a docker compose file.
You need to fill in the .env file for it to work, but then you only need to do `docker compose up` to run the project.
In the .env file you can also select what branch you want to run, you can comment this out if you want to run the main branch.

## Enjoy!

Once you have your teams set up, enjoy working on the code.

We look forward to seeing what you manage to produce from it!
We look forward to seeing what you manage to produce from it!
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,19 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}

// jar {
// duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// manifest {
// attributes 'Main-Class': 'com.booleanuk.api.Main'
// }
// archiveFileName.set('server.jar')

// from {
// configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
// }
// }

bootJar {
archiveFileName.set('server.jar')
}
6 changes: 6 additions & 0 deletions dockers/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
POSTGRES_USER=devuser
POSTGRES_PASSWORD=devpassword
POSTGRES_DB=devdb
SERVERBRANCH=Add-docker-compose
# CLIENTBRANCH=main
JWT_SECRET=""
51 changes: 51 additions & 0 deletions dockers/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
services:
postgres:
image: postgres:17
container_name: postgres_docker
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- db-data:/etc/data


spring-app:
build:
dockerfile: dockerfileServer
args:
BRANCH: "${SERVERBRANCH:-main}"
container_name: my-spring-app
ports:
- "4000:4000"
environment:
SERVER_PORT: 4000
SERVER_ADDRESS: 0.0.0.0
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB}
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER}
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD}
BOOLEANUK_APP_JWTSECRET: ${JWT_SECRET}
BOOLEANUK_APP_JWTEXPIRATIONMS: 86400000
command: ["java", "-jar", "server.jar"]
depends_on:
- postgres

react:
build:
dockerfile: dockerfileClient
args:
BRANCH: "${CLIENTBRANCH:-main}"
container_name: react-client
ports:
- "3000:3000"
environment:
REACT_APP_API_URL: http://localhost:4000
command: ["npm", "start"]
depends_on:
- postgres
- spring-app

volumes:
db-data:
15 changes: 15 additions & 0 deletions dockers/dockerfileClient
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:22

RUN apt-get update && apt-get install git -y

ARG BRANCH=main

RUN git clone --branch $BRANCH https://github.com/boolean-uk/java-team-dev-client-2508-team-2.git /app


WORKDIR /app

RUN npm install

EXPOSE 3000
# ENTRYPOINT [ "npm", "run" ]
19 changes: 19 additions & 0 deletions dockers/dockerfileServer
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM mcr.microsoft.com/openjdk/jdk:21-ubuntu AS build

RUN apt-get update && apt-get install git -y

ARG BRANCH=main

RUN git clone --branch $BRANCH https://github.com/boolean-uk/java-team-dev-server-2508-team-2
WORKDIR java-team-dev-server-2508-team-2

RUN chmod +x gradlew
RUN ./gradlew build

FROM mcr.microsoft.com/openjdk/jdk:21-ubuntu
COPY --from=build java-team-dev-server-2508-team-2/build/libs/*.jar server.jar


EXPOSE 4000

# ENTRYPOINT [ "java", "-jar", "server.jar" ]
8 changes: 8 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
spring:
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true
show-sql: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@SpringBootTest
class TeamDevSimApplicationTests {

@Test
void contextLoads() {
}
// @Test
// void contextLoads() {
// }

}