Skip to content

Commit

Permalink
[ANCHOR-391] Use Postgres in reference server (#1274)
Browse files Browse the repository at this point in the history
### Description

This adds a Postgres DB for the reference server.

### Context

We need a persistent data store for permanent deployment.

### Testing

- `./gradlew test`

### Documentation

N/A

### Known limitations

N/A
  • Loading branch information
philipliu authored Feb 27, 2024
1 parent ccc7840 commit 67bad92
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/sub_essential_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 sep24-reference-ui" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 reference-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 reference-db" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 wallet-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 platform" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 custody-server" | sudo tee -a /etc/hosts
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sub_extended_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 sep24-reference-ui" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 reference-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 reference-db" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 wallet-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 platform" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 custody-server" | sudo tee -a /etc/hosts
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sub_jacoco_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
sudo echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 sep24-reference-ui" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 reference-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 reference-db" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 wallet-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 platform" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 custody-server" | sudo tee -a /etc/hosts
Expand Down
1 change: 1 addition & 0 deletions docs/01 - Contributing/A - Development Environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ communicate with each other.
127.0.0.1 kafka
127.0.0.1 sep24-reference-ui
127.0.0.1 reference-server
127.0.0.1 reference-db
127.0.0.1 wallet-server
127.0.0.1 platform
127.0.0.1 custody-server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ object ServiceContainer {

private val database =
Database.connect(
"jdbc:h2:mem:test;DB_CLOSE_DELAY=-1",
driver = "org.h2.Driver",
user = "sa",
password = ""
"jdbc:postgresql://reference-db:5433/postgres",
driver = "org.postgresql.Driver",
user = "postgres",
password = "password"
)
private val customerRepo = JdbcCustomerRepository(database)
private val quotesRepo = JdbcQuoteRepository(database)
Expand Down
8 changes: 8 additions & 0 deletions service-runner/src/main/resources/common/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,11 @@ services:
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password

reference-db:
image: postgres:15.2-alpine
ports:
- "5433:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
5 changes: 5 additions & 0 deletions service-runner/src/main/resources/docker-compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ services:
extends:
file: common/docker-compose.yaml
service: sep24-reference-ui
reference-db:
hostname: reference-db
extends:
file: common/docker-compose.yaml
service: reference-db
6 changes: 6 additions & 0 deletions service-runner/src/main/resources/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
service: reference-server
depends_on:
- kafka
- reference-db

sep24-reference-ui:
extends:
Expand All @@ -45,3 +46,8 @@ services:
extends:
file: common/docker-compose.yaml
service: db

reference-db:
extends:
file: common/docker-compose.yaml
service: reference-db

0 comments on commit 67bad92

Please sign in to comment.