Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore:setup docker compose #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ log

cms-db-schema/liquibase.properties
ledgers-db/liquibase.properties
.env
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,24 @@ The **Webank Online Banking System** is a middleware service designed to connect
mvn clean install
mvn spring-boot:run
```

5. **Access API Documentation**:
4**Access API Documentation**:
- The OpenAPI documentation will be available at `http://localhost:8080/swagger-ui.html` (or the port specified for each module).

## Starting application with Docker Compose

1. Whilst inside the project root directory, Run the command
```bash
docker compose up --build
```
2. Access the API documentation at
```bash
http://localhost:9200/swagger-ui.html
```
3. you can stop the application with
```bash
docker compose down
```

## Usage
- **User Registration**:
- Make a `POST` request to `/register` with `phoneNumber` and `publicKey`.
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "9200:8080"
environment:
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL}
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}
depends_on:
- db

db:
image: postgres:15
container_name: postgres_container
ports:
- "5433:5432"
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
14 changes: 12 additions & 2 deletions online-banking-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,22 @@
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.4</version>
</dependency>

<!-- <dependency>-->
<!-- <groupId>com.h2database</groupId>-->
<!-- <artifactId>h2</artifactId>-->
<!-- </dependency>-->

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
22 changes: 8 additions & 14 deletions online-banking-app/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
# H2 Database Configuration
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:testdb
spring.profiles.active=postgres
spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/online_banking_db}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres}
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres}

# Swagger Configuration
springdoc.api-docs.path=/api-docs
springdoc.swagger-ui.path=/swagger-ui.html

# Additional Settings (if needed)
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=

# Hibernate DDL auto (update, create-drop, validate, etc.)
# Configure the JPA and Hibernate settings
spring.jpa.hibernate.ddl-auto=update
spring.cloud.compatibility-verifier.enabled=false
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

26 changes: 13 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<maven-pmd-plugin.version>3.21.0</maven-pmd-plugin.version>
<owasp.dependency.check.version>11.1.0</owasp.dependency.check.version>
<!-- <owasp.dependency.check.version>11.1.0</owasp.dependency.check.version>-->

<!-- Spring-related versions -->
<spring-boot-dependencies.version>3.3.5</spring-boot-dependencies.version>
Expand Down Expand Up @@ -494,21 +494,21 @@
</executions>
</plugin>

<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${owasp.dependency.check.version}</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<!-- <plugin>-->
<!-- <groupId>org.owasp</groupId>-->
<!-- <artifactId>dependency-check-maven</artifactId>-->
<!-- <version>${owasp.dependency.check.version}</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- <failBuildOnCVSS>5</failBuildOnCVSS>-->
<!-- </configuration>-->
</plugin>
<!-- </plugin>-->

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down