Skip to content

Commit

Permalink
feat: use mongodb instead of embedded mongo (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio authored Oct 23, 2024
1 parent 89b8dea commit 51c4f87
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build image
FROM maven:3.8.6-openjdk-18 as builder
FROM maven:3.8-eclipse-temurin-17-focal AS builder
ENV HOME=/usr/local/src
RUN mkdir -p $HOME
WORKDIR $HOME
Expand Down Expand Up @@ -27,7 +27,7 @@ RUN mv target /target
RUN mv agent /agent

# production image
FROM maven:3.8.6-openjdk-18
FROM maven:3.8-eclipse-temurin-17-focal
COPY --from=builder /target/diffy.jar /diffy.jar
COPY --from=builder /agent/opentelemetry-javaagent.jar /opentelemetry-javaagent.jar
ENTRYPOINT ["java", "-javaagent:opentelemetry-javaagent.jar", "-jar", "diffy.jar"]
Expand Down
14 changes: 14 additions & 0 deletions docker-compose-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
version: "3.8"

services:
mongodb:
image: mongo
container_name: mongodb
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=pass12345
ports:
- 27017:27017
healthcheck:
test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
interval: 10s
timeout: 10s
retries: 10
restart: unless-stopped

loki:
image: grafana/loki:2.2.0
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
version: "3.8"

services:
mongodb:
image: mongo
container_name: mongodb
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=pass12345
ports:
- 27017:27017
healthcheck:
test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
interval: 10s
timeout: 10s
retries: 10
restart: unless-stopped

loki:
image: grafana/loki:2.2.0
Expand Down Expand Up @@ -56,6 +70,11 @@ services:
- "8880:8880"
# env_file: "./diffy.env"
environment:
spring.data.mongodb.authentication-database: admin
spring.data.mongodb.host: "mongodb"
spring.data.mongodb.port: 27017
spring.data.mongodb.username: root
spring.data.mongodb.password: pass12345
candidate: "candidate:5000"
master.primary: "primary:5000"
master.secondary: "secondary:5000"
Expand Down Expand Up @@ -86,6 +105,7 @@ services:
- ./data/logs:/app/logs
depends_on:
- tempo
- mongodb
- primary
- secondary
- candidate
Expand Down
5 changes: 5 additions & 0 deletions localdev.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
spring.data.mongodb.authentication-database=admin
spring.data.mongodb.host=http://localhost
spring.data.mongodb.port=27017
spring.data.mongodb.username=root
spring.data.mongodb.password=pass12345
candidate=localhost:9000
master.primary=localhost:9100
master.secondary=localhost:9200
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<!-- For osx M1 Chip support see https://github.com/opendiffy/diffy/issues/68 -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
Expand Down Expand Up @@ -154,6 +153,7 @@
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>3.4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down

0 comments on commit 51c4f87

Please sign in to comment.