Skip to content

Commit 51c4f87

Browse files
authored
feat: use mongodb instead of embedded mongo (#105)
1 parent 89b8dea commit 51c4f87

File tree

5 files changed

+42
-3
lines changed

5 files changed

+42
-3
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build image
2-
FROM maven:3.8.6-openjdk-18 as builder
2+
FROM maven:3.8-eclipse-temurin-17-focal AS builder
33
ENV HOME=/usr/local/src
44
RUN mkdir -p $HOME
55
WORKDIR $HOME
@@ -27,7 +27,7 @@ RUN mv target /target
2727
RUN mv agent /agent
2828

2929
# production image
30-
FROM maven:3.8.6-openjdk-18
30+
FROM maven:3.8-eclipse-temurin-17-focal
3131
COPY --from=builder /target/diffy.jar /diffy.jar
3232
COPY --from=builder /agent/opentelemetry-javaagent.jar /opentelemetry-javaagent.jar
3333
ENTRYPOINT ["java", "-javaagent:opentelemetry-javaagent.jar", "-jar", "diffy.jar"]

docker-compose-dependencies.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
version: "3.8"
22

33
services:
4+
mongodb:
5+
image: mongo
6+
container_name: mongodb
7+
environment:
8+
- MONGO_INITDB_ROOT_USERNAME=root
9+
- MONGO_INITDB_ROOT_PASSWORD=pass12345
10+
ports:
11+
- 27017:27017
12+
healthcheck:
13+
test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
14+
interval: 10s
15+
timeout: 10s
16+
retries: 10
17+
restart: unless-stopped
418

519
loki:
620
image: grafana/loki:2.2.0

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
version: "3.8"
22

33
services:
4+
mongodb:
5+
image: mongo
6+
container_name: mongodb
7+
environment:
8+
- MONGO_INITDB_ROOT_USERNAME=root
9+
- MONGO_INITDB_ROOT_PASSWORD=pass12345
10+
ports:
11+
- 27017:27017
12+
healthcheck:
13+
test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
14+
interval: 10s
15+
timeout: 10s
16+
retries: 10
17+
restart: unless-stopped
418

519
loki:
620
image: grafana/loki:2.2.0
@@ -56,6 +70,11 @@ services:
5670
- "8880:8880"
5771
# env_file: "./diffy.env"
5872
environment:
73+
spring.data.mongodb.authentication-database: admin
74+
spring.data.mongodb.host: "mongodb"
75+
spring.data.mongodb.port: 27017
76+
spring.data.mongodb.username: root
77+
spring.data.mongodb.password: pass12345
5978
candidate: "candidate:5000"
6079
master.primary: "primary:5000"
6180
master.secondary: "secondary:5000"
@@ -86,6 +105,7 @@ services:
86105
- ./data/logs:/app/logs
87106
depends_on:
88107
- tempo
108+
- mongodb
89109
- primary
90110
- secondary
91111
- candidate

localdev.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
spring.data.mongodb.authentication-database=admin
2+
spring.data.mongodb.host=http://localhost
3+
spring.data.mongodb.port=27017
4+
spring.data.mongodb.username=root
5+
spring.data.mongodb.password=pass12345
16
candidate=localhost:9000
27
master.primary=localhost:9100
38
master.secondary=localhost:9200

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
<groupId>org.springframework.boot</groupId>
114114
<artifactId>spring-boot-starter-webflux</artifactId>
115115
</dependency>
116-
<!-- For osx M1 Chip support see https://github.com/opendiffy/diffy/issues/68 -->
117116
<dependency>
118117
<groupId>io.netty</groupId>
119118
<artifactId>netty-resolver-dns-native-macos</artifactId>
@@ -154,6 +153,7 @@
154153
<groupId>de.flapdoodle.embed</groupId>
155154
<artifactId>de.flapdoodle.embed.mongo</artifactId>
156155
<version>3.4.9</version>
156+
<scope>test</scope>
157157
</dependency>
158158
<dependency>
159159
<groupId>org.springframework.boot</groupId>

0 commit comments

Comments
 (0)