Skip to content

Commit

Permalink
feat: Replace Postgresql DB with H2 in-memory for Azure deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilKes committed Feb 13, 2024
1 parent 0d2de13 commit 0b51038
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 39 deletions.
22 changes: 11 additions & 11 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ services:
PORT: 4000
network_mode: host
# Database Service (Postgresql)
movieland-db:
container_name: movieland-db
image: 'postgres:13.1-alpine'
ports:
- "5432:5432"
environment:
- POSTGRES_USER=movielandadmin
- POSTGRES_PASSWORD=movielandadmin
- POSTGRES_DB=movieland_db
volumes:
- db-data:/var/lib/postgresql/data
# movieland-db:
# container_name: movieland-db
# image: 'postgres:13.1-alpine'
# ports:
# - "5432:5432"
# environment:
# - POSTGRES_USER=movielandadmin
# - POSTGRES_PASSWORD=movielandadmin
# - POSTGRES_DB=movieland_db
# volumes:
# - db-data:/var/lib/postgresql/data


movieland-prometheus:
Expand Down
30 changes: 15 additions & 15 deletions docker-compose-fullstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ services:
image: philkes/movie-land-backend:master
ports:
- "8080:8080"
depends_on:
- movieland-db
# depends_on:
# - movieland-db
environment: # Pass environment variables to the service
SPRING_DATASOURCE_URL: jdbc:postgresql://movieland-db:5432/movieland_db?useLegacyDatetimeCode=false&serverTimezone=Europe/Berlin
SPRING_DATASOURCE_USERNAME: movielandadmin
Expand Down Expand Up @@ -37,19 +37,19 @@ services:
networks:
- frontend
# Database Service (Postgresql)
movieland-db:
container_name: movieland-db
image: 'postgres:13.1-alpine'
ports:
- "5432:5432"
environment:
- POSTGRES_USER=movielandadmin
- POSTGRES_PASSWORD=movielandadmin
- POSTGRES_DB=movieland_db
volumes:
- db-data:/var/lib/postgresql/data
networks:
- backend
# movieland-db:
# container_name: movieland-db
# image: 'postgres:13.1-alpine'
# ports:
# - "5432:5432"
# environment:
# - POSTGRES_USER=movielandadmin
# - POSTGRES_PASSWORD=movielandadmin
# - POSTGRES_DB=movieland_db
# volumes:
# - db-data:/var/lib/postgresql/data
# networks:
# - backend
# App backend service
movieland-spring-admin:
container_name: movieland-spring-admin
Expand Down
10 changes: 5 additions & 5 deletions movieland-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>info.movito</groupId>
<artifactId>themoviedbapi</artifactId>
Expand All @@ -88,11 +93,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
Expand Down
13 changes: 5 additions & 8 deletions movieland-backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,18 @@ spring:
application:
name: MovieLand Backend
datasource:
driverClassName: org.postgresql.Driver
password: movielandadmin
username: movielandadmin
url: jdbc:postgresql://localhost:5432/movieland_db
driverClassName: org.h2.Driver
password: sa
username: password
url: jdbc:h2:mem:movieland_db
security:
user:
password: admin
name: admin
jpa:
hibernate:
ddl-auto: update
database-platform: org.hibernate.dialect.PostgreSQLDialect
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
database-platform: org.hibernate.dialect.H2Dialect
sql:
init:
mode: never
Expand Down

0 comments on commit 0b51038

Please sign in to comment.