Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2e68f2e
refactor(stats-service): remove Feign client and dependencies
Peppe-Ronin Sep 22, 2025
3b7eb4c
build: scaffold new stats aggregation modules
Peppe-Ronin Sep 22, 2025
0e56e05
build(compose): update services for new architecture
Peppe-Ronin Sep 22, 2025
014b92d
feat(serialization): add Avro/Protobuf schemas and generation
Peppe-Ronin Sep 22, 2025
6753a61
refactor: shorten root package name to 'ewm'
Peppe-Ronin Sep 22, 2025
382f586
feat(collector): implement gRPC endpoint for event collection
Peppe-Ronin Sep 22, 2025
30750be
fix(serialization): use SpecificDatumWriter for Avro serialization
Peppe-Ronin Sep 22, 2025
ef217c7
refactor(collector): decouple Kafka producer from controller
Peppe-Ronin Sep 23, 2025
6cc340c
feat(aggregator): implement core logic for similarity computation
Peppe-Ronin Sep 23, 2025
01aef6d
chore(aggregator): improve logging for similarity calculation
Peppe-Ronin Sep 23, 2025
a392d60
feat(aggregator): implement in-memory DAL and optimize data access
Peppe-Ronin Sep 23, 2025
26dcbd1
build(serialization): replace kafka_2.13 with kafka-clients
Peppe-Ronin Sep 23, 2025
2231c83
refactor(aggregator): simplify Kafka listener configuration
Peppe-Ronin Sep 25, 2025
85919bd
feat(analyzer): scaffold service and configure Kafka consumers
Peppe-Ronin Sep 25, 2025
40f9ce5
chore(collector): remove unused 'postgres' profile
Peppe-Ronin Sep 25, 2025
c020c75
feat(analyzer): define service layer and domain repository interfaces
Peppe-Ronin Sep 25, 2025
633cfd9
chore(config): extract recommendation hyperparameters to shared YAML
Peppe-Ronin Sep 25, 2025
e024383
refactor(analyzer): enhance domain entities and repository interfaces
Peppe-Ronin Sep 25, 2025
a451421
feat(analyzer): implement core services for recommendations and score…
Peppe-Ronin Sep 25, 2025
ce9596d
chore(analyzer): externalize static constants to YAML configuration
Peppe-Ronin Sep 25, 2025
31ac8ce
chore(analyzer): add logging to RecommendationsService
Peppe-Ronin Sep 25, 2025
ba48752
fix(build): update Protobuf dependencies to address DoS vulnerability
Peppe-Ronin Sep 26, 2025
e17f057
fix(core): correct AutoConfiguration imports path
Peppe-Ronin Sep 26, 2025
cfa50e6
chore(build): group dependencies by category in root POM
Peppe-Ronin Sep 26, 2025
dd5672f
feat(stats-client): initialize and implement gRPC wrapper clients
Peppe-Ronin Sep 26, 2025
f035bf8
chore(collector): set server port to 0 to avoid conflicts
Peppe-Ronin Sep 26, 2025
5ddc8c3
feat(stats-client): finalize client with aspect-based user action log…
Peppe-Ronin Sep 26, 2025
1add079
feat(request-service): integrate stats-client for user action logging
Peppe-Ronin Sep 26, 2025
4e4c60f
refactor(dto): replace event 'views' with 'rating'
Peppe-Ronin Sep 26, 2025
fc57bd3
refactor(analyzer): broaden collection type in interaction count methods
Peppe-Ronin Sep 26, 2025
f6918f0
refactor(event-service): replace event views logic with ratings
Peppe-Ronin Sep 26, 2025
6ac29ae
feat(request-service): add method to check user participation status
Peppe-Ronin Sep 26, 2025
87d7d0f
feat(event-service): add recommendation and like endpoints
Peppe-Ronin Sep 26, 2025
fe93396
build(docker): add Dockerfiles for aggregator, analyzer, and collector
Peppe-Ronin Sep 26, 2025
51c419f
refactor(protobuf): refine schemas and ruin enum definitions
Peppe-Ronin Sep 27, 2025
6dfd557
chore(analyzer): update recommendation action weights
Peppe-Ronin Sep 27, 2025
c8174d6
chore(build): remove unused test dependencies
Peppe-Ronin Sep 27, 2025
fe0f0f0
docs: update README with new architecture details
Peppe-Ronin Sep 27, 2025
808fa6e
chore(eureka): set prefer-ip-address for CI compatibility
Peppe-Ronin Sep 27, 2025
84a9930
chore: remove remaining stats-service configs and imports
Peppe-Ronin Sep 27, 2025
09f245d
chore(eureka): adjust settings for CI pipeline compatibility
Peppe-Ronin Sep 27, 2025
c7000de
fix(aggregator): ensure accurate event similarity recalculation
Peppe-Ronin Sep 27, 2025
0db3635
chore: code cleanup
Peppe-Ronin Sep 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .run/ewm-db.run.xml → .run/ewm-infra.run.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ewm-db" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<configuration default="false" name="ewm-infra" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<deployment type="docker-compose.yml">
<settings>
<option name="services">
<list>
<option value="ewm-db" />
<option value="kafka" />
</list>
</option>
<option name="sourceFilePath" value="compose.yaml" />
Expand Down
108 changes: 47 additions & 61 deletions README.md

Large diffs are not rendered by default.

171 changes: 122 additions & 49 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
services:
# ===================================================================
# INFRASTRUCTURE SERVICES
# ===================================================================
discovery-server:
build: infra/discovery-server
container_name: ewm-discovery-server
Expand Down Expand Up @@ -49,24 +52,122 @@ services:
EUREKA_URI: http://discovery-server:8761/eureka/
PORT: 8080

stats-server:
build: core/stats-service/stats-server
container_name: ewm-stats-server
# ===================================================================
# KAFKA AND DATABASE
# ===================================================================
kafka:
image: confluentinc/confluent-local:7.4.10
hostname: kafka
container_name: ewm-kafka
ports:
- "9092:9092"
restart: unless-stopped
environment:
KAFKA_NODE_ID: 1
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092'
KAFKA_PROCESS_ROLES: 'broker,controller'
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:29093'
KAFKA_LISTENERS: 'PLAINTEXT://0.0.0.0:29092,CONTROLLER://kafka:29093,PLAINTEXT_HOST://0.0.0.0:9092'
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
healthcheck:
test: [ "CMD-SHELL", "kafka-topics --bootstrap-server localhost:9092 --list" ]
interval: 10s
timeout: 5s
retries: 5

kafka-init-topics:
image: confluentinc/confluent-local:7.4.3
container_name: kafka-init-topics
depends_on:
kafka:
condition: service_healthy
command: >
bash -c "
echo 'Waiting for Kafka to be ready...' &&
cub kafka-ready -b kafka:29092 1 20 &&
echo 'Kafka is ready!' &&
kafka-topics --create --topic stats.user-actions.v1 --partitions 1 --replication-factor 1 --if-not-exists --bootstrap-server kafka:29092 &&
kafka-topics --create --topic stats.events-similarity.v1 --partitions 1 --replication-factor 1 --if-not-exists --bootstrap-server kafka:29092
"

ewm-db:
image: postgres:16.1
container_name: ewm-main-db
ports:
- "5432:5432"
environment:
POSTGRES_USER: ewm_user
POSTGRES_PASSWORD: ewm_password
POSTGRES_DB: ewm_db
volumes:
- main_db_data:/var/lib/postgresql/data
- ./init-scripts/init.sql:/docker-entrypoint-initdb.d/01-schema.sql
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB} -p 5432" ]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s

# ===================================================================
# BUSINESS LOGIC SERVICES
# ===================================================================
collector-service:
build: core/collector
container_name: ewm-collector-service
depends_on:
discovery-server:
condition: service_healthy
config-server:
condition: service_healthy
kafka:
condition: service_healthy
restart: unless-stopped
environment:
EUREKA_URI: http://discovery-server:8761/eureka/
KAFKA_BOOTSTRAP_SERVERS: kafka:29092

aggregator-service:
build: core/aggregator
container_name: ewm-aggregator-service
depends_on:
discovery-server:
condition: service_healthy
config-server:
condition: service_healthy
kafka:
condition: service_healthy
restart: unless-stopped
environment:
EUREKA_URI: http://discovery-server:8761/eureka/
KAFKA_BOOTSTRAP_SERVERS: kafka:29092

analyzer-service:
build: core/analyzer
container_name: ewm-analyzer-service
depends_on:
discovery-server:
condition: service_healthy
config-server:
condition: service_healthy
ewm-db:
condition: service_healthy
ports:
- "9090:9090"
kafka:
condition: service_healthy
restart: unless-stopped
environment:
EUREKA_URI: http://discovery-server:8761/eureka/
SPRING_DATASOURCE_URL: jdbc:postgresql://ewm-db:5432/ewm_stats_db
SPRING_DATASOURCE_USERNAME: ewm_user
SPRING_DATASOURCE_PASSWORD: ewm_password
JAVA_OPTS: -Duser.timezone=UTC
POSTGRES_HOST: ewm-db
POSTGRES_USER: ewm_user
POSTGRES_PASSWORD: ewm_password
KAFKA_BOOTSTRAP_SERVERS: kafka:29092

event-service:
build: core/event-service
Expand All @@ -78,15 +179,13 @@ services:
condition: service_healthy
ewm-db:
condition: service_healthy
stats-server:
condition: service_started
ports:
- "8081:8081"
environment:
EUREKA_URI: http://discovery-server:8761/eureka/
SPRING_DATASOURCE_URL: jdbc:postgresql://ewm-db:5432/ewm_event
SPRING_DATASOURCE_USERNAME: ewm_user
SPRING_DATASOURCE_PASSWORD: ewm_password
POSTGRES_HOST: ewm-db
POSTGRES_USER: ewm_user
POSTGRES_PASSWORD: ewm_password
JAVA_OPTS: -Duser.timezone=UTC

user-service:
Expand All @@ -99,15 +198,13 @@ services:
condition: service_healthy
ewm-db:
condition: service_healthy
stats-server:
condition: service_started
ports:
- "8082:8082"
environment:
EUREKA_URI: http://discovery-server:8761/eureka/
SPRING_DATASOURCE_URL: jdbc:postgresql://ewm-db:5432/ewm_user
SPRING_DATASOURCE_USERNAME: ewm_user
SPRING_DATASOURCE_PASSWORD: ewm_password
POSTGRES_HOST: ewm-db
POSTGRES_USER: ewm_user
POSTGRES_PASSWORD: ewm_password
JAVA_OPTS: -Duser.timezone=UTC

request-service:
Expand All @@ -120,15 +217,13 @@ services:
condition: service_healthy
ewm-db:
condition: service_healthy
stats-server:
condition: service_started
ports:
- "8083:8083"
environment:
EUREKA_URI: http://discovery-server:8761/eureka/
SPRING_DATASOURCE_URL: jdbc:postgresql://ewm-db:5432/ewm_request
SPRING_DATASOURCE_USERNAME: ewm_user
SPRING_DATASOURCE_PASSWORD: ewm_password
POSTGRES_HOST: ewm-db
POSTGRES_USER: ewm_user
POSTGRES_PASSWORD: ewm_password
JAVA_OPTS: -Duser.timezone=UTC

comment-service:
Expand All @@ -141,36 +236,14 @@ services:
condition: service_healthy
ewm-db:
condition: service_healthy
stats-server:
condition: service_started
ports:
- "8084:8084"
environment:
EUREKA_URI: http://discovery-server:8761/eureka/
SPRING_DATASOURCE_URL: jdbc:postgresql://ewm-db:5432/ewm_comment
SPRING_DATASOURCE_USERNAME: ewm_user
SPRING_DATASOURCE_PASSWORD: ewm_password
JAVA_OPTS: -Duser.timezone=UTC

ewm-db:
image: postgres:16.1
container_name: ewm-main-db
ports:
- "5432:5432"
environment:
POSTGRES_HOST: ewm-db
POSTGRES_USER: ewm_user
POSTGRES_PASSWORD: ewm_password
POSTGRES_DB: ewm_db
volumes:
- main_db_data:/var/lib/postgresql/data
- ./init-scripts/init.sql:/docker-entrypoint-initdb.d/01-schema.sql
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB} -p 5432" ]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
JAVA_OPTS: -Duser.timezone=UTC

volumes:
stats_db_data: {}
main_db_data: {}
main_db_data: { }
File renamed without changes.
73 changes: 73 additions & 0 deletions core/aggregator/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<parent>
<groupId>ru.practicum</groupId>
<artifactId>core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>aggregator</artifactId>
<packaging>jar</packaging>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>ru.practicum</groupId>
<artifactId>serialization</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ru.practicum.ewm.aggregator;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import ru.practicum.ewm.aggregator.application.config.RecommendationProperties;

@SpringBootApplication
@EnableConfigurationProperties(RecommendationProperties.class)
public class AggregatorApplication {

public static void main(String[] args) {
SpringApplication.run(AggregatorApplication.class, args);
}
}
Loading