Skip to content

Commit a000da8

Browse files
committed
#21 Added postgres database for persistence
1 parent 4377790 commit a000da8

File tree

6 files changed

+91
-11
lines changed

6 files changed

+91
-11
lines changed

backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ COPY pom.xml /tmp/
33
RUN mvn -B dependency:go-offline -f /tmp/pom.xml -s /usr/share/maven/ref/settings-docker.xml
44
COPY src /tmp/src/
55
WORKDIR /tmp/
6-
RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml package
6+
RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml package -DargLine="-Dspring.profiles.active=local"
77

88
FROM java:8-jre-alpine
99

backend/docker-compose.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,34 @@ version: '3.7'
33
services:
44
openvalidation-ide-backend:
55
image: openvalidation-ide-backend:latest
6-
build:
6+
environment:
7+
- SPRING_PROFILES_ACTIVE=dev
8+
- OPENVALIDATION_IDE_DB=postgres
9+
- OPENVALIDATION_IDE_DB_NAME=openvalidation_ide
10+
- OPENVALIDATION_IDE_DB_USER=openvalidation_ide
11+
- OPENVALIDATION_IDE_DB_PW=_OPeN_VALiDAtION_IdE
12+
build:
713
context: .
14+
depends_on:
15+
- postgres
816
ports:
917
- '8080:8080'
18+
networks:
19+
- openvalidation_ide_backend
20+
21+
postgres:
22+
image: postgres:10.1
23+
volumes:
24+
- openvalidation_ide_db:/var/lib/postgresql/data
25+
environment:
26+
- PGDATA=/var/lib/postgresql/data/pgdata
27+
- POSTGRES_DB=openvalidation_ide
28+
- POSTGRES_USER=openvalidation_ide
29+
- POSTGRES_PASSWORD=_OPeN_VALiDAtION_IdE
30+
networks:
31+
- openvalidation_ide_backend
32+
volumes:
33+
openvalidation_ide_db: {}
34+
35+
networks:
36+
openvalidation_ide_backend:

backend/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@
6868
<scope>runtime</scope>
6969
</dependency>
7070

71+
<dependency>
72+
<groupId>org.postgresql</groupId>
73+
<artifactId>postgresql</artifactId>
74+
<scope>runtime</scope>
75+
</dependency>
76+
7177
<dependency>
7278
<groupId>org.springdoc</groupId>
7379
<artifactId>springdoc-openapi-ui</artifactId>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
spring:
2+
datasource:
3+
url: jdbc:postgresql://${OPENVALIDATION_IDE_DB}:5432/${OPENVALIDATION_IDE_DB_NAME}
4+
username: ${OPENVALIDATION_IDE_DB_USER}
5+
password: ${OPENVALIDATION_IDE_DB_PW}

backend/src/main/resources/application.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
spring:
2+
application:
3+
name: openvalidation-ide-backend
4+
profiles:
5+
active: local
6+
# Hibernate ddl auto
7+
jpa:
8+
hibernate:
9+
ddl-auto: update
10+
properties:
11+
hibernate:
12+
jdbc:
13+
lob:
14+
non_contextual_creation: true
115
springdoc:
216
version: '@org.springdoc.version@'
317
api-docs:

docker-compose.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,44 @@
1-
version: '3.7'
1+
version: "3.7"
22

33
services:
4+
openvalidation-ide-frontend:
5+
image: openvalidation-ide-frontend:latest
6+
build:
7+
context: ./frontend
8+
ports:
9+
- "80:80"
10+
411
openvalidation-ide-backend:
512
image: openvalidation-ide-backend:latest
6-
build:
13+
build:
714
context: ./backend
15+
environment:
16+
- SPRING_PROFILES_ACTIVE=dev
17+
- OPENVALIDATION_IDE_DB=postgres
18+
- OPENVALIDATION_IDE_DB_NAME=openvalidation_ide
19+
- OPENVALIDATION_IDE_DB_USER=openvalidation_ide
20+
- OPENVALIDATION_IDE_DB_PW=_OPeN_VALiDAtION_IdE
821
ports:
9-
- '8080:8080'
22+
- "8080:8080"
23+
depends_on:
24+
- postgres
25+
networks:
26+
- openvalidation_ide_backend
1027

11-
openvalidation-ide-frontend:
12-
image: openvalidation-ide-frontend:latest
13-
build:
14-
context: ./frontend
15-
ports:
16-
- '80:80'
28+
postgres:
29+
image: postgres:10.1
30+
volumes:
31+
- openvalidation_ide_db:/var/lib/postgresql/data
32+
environment:
33+
- PGDATA=/var/lib/postgresql/data/pgdata
34+
- POSTGRES_DB=openvalidation_ide
35+
- POSTGRES_USER=openvalidation_ide
36+
- POSTGRES_PASSWORD=_OPeN_VALiDAtION_IdE
37+
networks:
38+
- openvalidation_ide_backend
39+
40+
volumes:
41+
openvalidation_ide_db: {}
42+
43+
networks:
44+
openvalidation_ide_backend:

0 commit comments

Comments
 (0)