Configuration
This document describes all configuration options available in Eventara.
Application Configuration
Configuration is managed through src/main/resources/application.properties.
Database Configuration
# Database Connection
spring.datasource.url=jdbc:postgresql://localhost:5432/eventara
spring.datasource.username=postgres
spring.datasource.password=mysecretpassword
spring.datasource.driver-class-name=org.postgresql.Driver
# Hibernate/JPA
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=trueConfiguration Options
| Property | Description | Default | Production Value |
|---|---|---|---|
| spring.datasource.url | PostgreSQL connection URL | localhost:5432/eventara | Your DB URL |
| spring.datasource.username | Database username | postgres | Your username |
| spring.datasource.password | Database password | mysecretpassword | Secure password |
| spring.jpa.show-sql | Log SQL statements | true | false |
| spring.jpa.hibernate.ddl-auto | Schema generation | none | none |
Flyway Migration
# Flyway Configuration
spring.flyway.enabled=true
spring.flyway.locations=classpath:/db/migration| Property | Description | Default |
|---|---|---|
| spring.flyway.enabled | Enable Flyway migrations | true |
| spring.flyway.locations | Migration script location | classpath:/db/migration |
Kafka Configuration
# Kafka Bootstrap Servers
spring.kafka.bootstrap-servers=${SPRING_KAFKA_BOOTSTRAP_SERVERS:localhost:9093}
# Producer Configuration
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
spring.kafka.producer.acks=all
spring.kafka.producer.retries=3
spring.kafka.producer.properties.linger.ms=10
spring.kafka.producer.properties.batch.size=16384
# Consumer Configuration
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.group-id=eventara-consumer-group
spring.kafka.consumer.properties.spring.json.trusted.packages=*Kafka Properties
Producer:
| Property | Description | Default | Notes |
|---|---|---|---|
| acks | Acknowledgment level | all | all = wait for all replicas |
| retries | Number of retries | 3 | Retry on transient failures |
| linger.ms | Batch delay | 10 | Wait 10ms to batch messages |
| batch.size | Batch size in bytes | 16384 | 16KB batch size |
Consumer:
| Property | Description | Default | Notes |
|---|---|---|---|
| auto-offset-reset | Offset reset strategy | earliest | Start from beginning if no offset |
| group-id | Consumer group ID | eventara-consumer-group | Shared across instances |
Kafka Topics
# Topic Names
eventara.kafka.topics.events-raw=eventara.events.raw
eventara.kafka.topics.events-processed=eventara.events.processed| Property | Description | Default |
|---|---|---|
| eventara.kafka.topics.events-raw | Raw events topic | eventara.events.raw |
| eventara.kafka.topics.events-processed | Processed events topic | eventara.events.processed |
Application Properties
# Application Name
spring.application.name=eventara-ingestion-serviceDocker Compose Configuration
Service Ports
| Service | Internal Port | External Port | Description |
|---|---|---|---|
| postgres | 5432 | 5432 | PostgreSQL database |
| zookeeper | 2181 | 2181 | Zookeeper coordination |
| kafka | 9092, 9093 | 9092, 9093 | Kafka broker |
| kafka-ui | 8080 | 8090 | Kafka UI |
| springboot | 8080 | 8080 | API server |
| dashboard | 5173 | 5173 | React dashboard |
Environment Variables
PostgreSQL
postgres:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_DB: eventaraKafka
kafka:
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: INTERNAL://0.0.0.0:9092,EXTERNAL://0.0.0.0:9093
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://localhost:9093
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_NUM_PARTITIONS: 3
KAFKA_DEFAULT_REPLICATION_FACTOR: 1
KAFKA_LOG_RETENTION_HOURS: 168 # 7 daysDashboard Configuration
Environment Variables
Create eventara-dashboard/.env:
# API URL
VITE_API_URL=http://localhost:8080
# WebSocket URL (optional, defaults to API URL)
VITE_WS_URL=http://localhost:8080/wsVite Configuration
File: eventara-dashboard/vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
host: true,
},
build: {
outDir: 'dist',
sourcemap: false,
},
});Logging Configuration
Log Levels
Add to application.properties:
# Root logger
logging.level.root=INFO
# Eventara packages
logging.level.com.eventara=DEBUG
# Spring Framework
logging.level.org.springframework=INFO
logging.level.org.springframework.kafka=WARN
# Hibernate
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
# Kafka
logging.level.org.apache.kafka=WARNLog Format
# Console output pattern
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} - %msg%n
# File output
logging.file.name=logs/eventara.log
logging.file.max-size=10MB
logging.file.max-history=30Security Configuration
CORS
Currently configured in controllers:
@CrossOrigin(origins = "*")
@RestController
public class RuleController {
// ...
}Production: Configure globally in application.properties:
# CORS Configuration
spring.web.cors.allowed-origins=https://your-domain.com
spring.web.cors.allowed-methods=GET,POST,PUT,DELETE,OPTIONS
spring.web.cors.allowed-headers=*
spring.web.cors.allow-credentials=trueAuthentication
Current State: No authentication implemented.
Production Setup (Example):
# JWT Configuration
eventara.jwt.secret=${JWT_SECRET}
eventara.jwt.expiration=3600000 # 1 hour in ms
# OAuth2 (if using)
spring.security.oauth2.client.registration.google.client-id=${GOOGLE_CLIENT_ID}
spring.security.oauth2.client.registration.google.client-secret=${GOOGLE_CLIENT_SECRET}Performance Tuning
Connection Pool
Add to application.properties:
# HikariCP Configuration
spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.idle-timeout=600000
spring.datasource.hikari.max-lifetime=1800000JVM Options
Set via environment variable or command line:
# Memory
-Xms512m # Initial heap size
-Xmx2g # Maximum heap size
# Garbage Collection
-XX:+UseG1GC # Use G1 garbage collector
-XX:MaxGCPauseMillis=200 # Target max GC pause time
# Other
-XX:+HeapDumpOnOutOfMemoryError # Dump heap on OOM
-XX:HeapDumpPath=/tmp/heapdump.hprofKafka Performance
# Producer throughput
spring.kafka.producer.properties.compression.type=snappy
spring.kafka.producer.properties.max.in.flight.requests.per.connection=5
# Consumer throughput
spring.kafka.consumer.properties.fetch.min.bytes=1
spring.kafka.consumer.properties.fetch.max.wait.ms=500
spring.kafka.consumer.properties.max.partition.fetch.bytes=1048576Metrics Configuration
Actuator (Optional)
To expose Spring Boot Actuator endpoints:
<!-- Add to pom.xml -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency># Actuator Configuration
management.endpoints.web.exposure.include=health,metrics,info
management.endpoint.health.show-details=always
management.metrics.export.prometheus.enabled=trueConfiguration Profiles
Development Profile
Create application-dev.properties:
# Show SQL
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
# Debug logging
logging.level.com.eventara=DEBUG
# Local Kafka
spring.kafka.bootstrap-servers=localhost:9093Activate:
java -jar app.jar --spring.profiles.active=devProduction Profile
Create application-prod.properties:
# Disable SQL logging
spring.jpa.show-sql=false
# Production logging
logging.level.root=WARN
logging.level.com.eventara=INFO
# Production Kafka
spring.kafka.bootstrap-servers=${KAFKA_SERVERS}Activate:
java -jar app.jar --spring.profiles.active=prodEnvironment Variable Override
All properties can be overridden with environment variables:
# Property: spring.datasource.password
# Environment variable: SPRING_DATASOURCE_PASSWORD
export SPRING_DATASOURCE_PASSWORD=secure_password
export SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka1:9092,kafka2:9092,kafka3:9092
java -jar eventara.jarDocker Compose:
springboot:
environment:
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
SPRING_KAFKA_BOOTSTRAP_SERVERS: kafka1:9092,kafka2:9092Validation
Check Configuration
# View active configuration
curl http://localhost:8080/actuator/env
# View specific property
curl http://localhost:8080/actuator/env/spring.datasource.urlTest Connections
# Test database connection
docker exec springboot psql -h postgres -U postgres -d eventara -c "SELECT 1"
# Test Kafka connection
docker exec springboot kafka-broker-api-versions --bootstrap-server kafka:9092Configuration Best Practices
- Use Environment Variables: Don’t hardcode secrets
- Profile-Specific Configs: Separate dev/prod configurations
- Connection Pooling: Configure appropriately for load
- Logging Levels: Debug in dev, WARN in prod
- Monitor Metrics: Enable actuator in production
- Security: Never commit passwords to version control
- Backup Configs: Keep configuration backups
- Document Changes: Track configuration changes
Default Values Reference
Quick reference of all default values:
# Database
spring.datasource.url=jdbc:postgresql://localhost:5432/eventara
spring.datasource.username=postgres
spring.datasource.password=mysecretpassword
# Kafka
spring.kafka.bootstrap-servers=localhost:9093
spring.kafka.producer.acks=all
spring.kafka.consumer.group-id=eventara-consumer-group
# Topics
eventara.kafka.topics.events-raw=eventara.events.raw
# Application
spring.application.name=eventara-ingestion-service
server.port=8080
# Dashboard
VITE_API_URL=http://localhost:8080Last updated on