Skip to content

Commit

Permalink
Merge pull request #3 from softwaremill/docker-compose
Browse files Browse the repository at this point in the history
Added Docker Compose
  • Loading branch information
Pask423 authored Jun 18, 2024
2 parents a974156 + 0f1de5e commit eee18fb
Show file tree
Hide file tree
Showing 58 changed files with 257 additions and 310 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ permissions:

jobs:
ci:
# run on 1) push, 2) external PRs, 3)
# do not run on internal, non-steward PRs since those will be run by push to branch
# run on push, external PRs do not run on internal PRs since those will be run by push to branch
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
Expand Down
18 changes: 0 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,6 @@ target/
### IntelliJ IDEA ###
.idea

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
volumes:
nats-storage:
driver: local

services:
nats:
image: nats:2.10.7
command: [ "--jetstream", "-m", "8222" ]
deploy:
resources:
limits:
memory: 2g
reservations:
memory: 2g
volumes:
- nats-storage:/data
expose:
- "4222"
- "8222"
ports:
- "4222:4222"
- "8222:8222"
162 changes: 50 additions & 112 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,42 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.softwaremill</groupId>
<artifactId>OtterJet</artifactId>
<groupId>com.softwaremill.otter</groupId>
<artifactId>jet</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<packaging>jar</packaging>

<name>Visualization of messages from a NATS JetStream server</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<spotless.plugin.version>2.41.1</spotless.plugin.version>
<testcontainers.version>1.19.3</testcontainers.version>
<junit.version>5.10.1</junit.version>
<spring-boot.version>3.2.0</spring-boot.version>
<spring-cloud.version>2023.0.0</spring-cloud.version>
<testcontainers.version>1.19.8</testcontainers.version>
<spring.boot.version>3.3.0</spring.boot.version>
<spring.cloud.version>2023.0.2</spring.cloud.version>
<feign.jackson.version>13.2.1</feign.jackson.version>
<protobuf.java.version>3.25.0</protobuf.java.version>
<grpc.version>1.64.0</grpc.version>
<javafaker.version>1.0.2</javafaker.version>
<json.version>20240303</json.version>
<jnats.version>2.18.1</jnats.version>
<slf4j-api.version>2.0.9</slf4j-api.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>${testcontainers.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${junit.version}</version>
<version>${spring.cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -56,62 +47,6 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.21.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.59.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.25.1</version>
</dependency>
<dependency>
<groupId>io.envoyproxy.protoc-gen-validate</groupId>
<artifactId>pgv-java-stub</artifactId>
<version>0.6.13</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.59.0</version>
</dependency>
<dependency>
<groupId>io.nats</groupId>
<artifactId>jnats</artifactId>
<version>2.17.1</version> <!-- Check for the latest version -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.ozark</groupId>
<artifactId>ozark</artifactId>
<version>1.0.0-m02</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand Down Expand Up @@ -143,56 +78,68 @@
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
<version>${feign.jackson.version}</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf.java.version}</version>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
<scope>test</scope>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf.java.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.nats</groupId>
<artifactId>jnats</artifactId>
<version>${jnats.version}</version> <!-- Check for the latest version -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
<!--Test-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>${javafaker.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
<version>${json.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>repackage</id>
Expand All @@ -209,18 +156,9 @@
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.plugin.version}</version>
<configuration>
<java>
<googleJavaFormat/>
</java>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.1</version>
<version>3.2.5</version>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet;
package otter.jet;

import org.springframework.boot.Banner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

public record DirectMonitoringResponse(JetStreamMonitoringResponse response)
implements MonitoringData {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

class DirectNatsMonitoringDataLoader implements NatsMonitoringDataLoader {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

public sealed interface MonitoringData
permits DirectMonitoringResponse, MonitoringNotConfiguredResponse {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package otterjet.monitoring;
package otter.jet.monitoring;

public final class MonitoringNotConfiguredResponse implements MonitoringData {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package otter.jet.monitoring;

import org.springframework.web.bind.annotation.GetMapping;

interface NatsMonitoringApiClient {
@GetMapping("/jsz?streams=true&config=true")
JetStreamMonitoringResponse getJetStreamMonitoringData();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

import feign.Feign;
import feign.Logger;
Expand All @@ -16,7 +16,7 @@
class NatsMonitoringAutoConfiguration {

@Configuration
@ConditionalOnExpression("'${nats.server.monitoring.port:}' != ''") // monitoring configured
@ConditionalOnExpression("'${nats.server.monitoring.port:}' != ''")
static class NatsMonitoringEnabledConfiguration {

@Bean
Expand Down Expand Up @@ -48,7 +48,7 @@ private static String createNatsMonitoringUrl(
}

@Configuration
@ConditionalOnExpression("'${nats.server.monitoring.port:}' == ''") // monitoring not configured
@ConditionalOnExpression("'${nats.server.monitoring.port:}' == ''")
@AutoConfigureAfter(NatsMonitoringEnabledConfiguration.class)
static class NatsMonitoringDisabledConfiguration {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

public interface NatsMonitoringDataLoader {
boolean isMonitoringEnabled();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

class NoMonitoringConfiguredDataLoader implements NatsMonitoringDataLoader {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package otterjet.monitoring;
package otter.jet.monitoring;

import java.util.List;

Expand Down
Loading

0 comments on commit eee18fb

Please sign in to comment.