diff --git a/README.md b/README.md
index 18a246e..d36813d 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
# java-explore-with-me
-Template repository for ExploreWithMe project.
+Итоговый проект учебного курса. май 2025. гр. 53.
diff --git a/docker-compose.yml b/docker-compose.yml
index be96142..a02f49e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,14 +1,56 @@
+version: '3.1'
services:
+ stats-db:
+ image: postgres:16.1
+ container_name: postgres-stat
+ ports:
+ - "5432:5432"
+ environment:
+ - POSTGRES_PASSWORD=statdb
+ - POSTGRES_USER=statdb
+ - POSTGRES_DB=statdb
+ healthcheck:
+ test: pg_isready -q -d $$POSTGRES_DB -U $$POSTGRES_USER
+ timeout: 5s
+ interval: 5s
+ retries: 10
+
stats-server:
+ build: stats-server
+ image: stats-server
+ container_name: stats-server
ports:
- "9090:9090"
-
- stats-db:
- image: postgres:16.1
+ depends_on:
+ - stats-db
+ environment:
+ - SPRING_DATASOURCE_URL=jdbc:postgresql://stats-db:5432/statdb
+ - SPRING_DATASOURCE_USERNAME=statdb
+ - SPRING_DATASOURCE_PASSWORD=statdb
ewm-service:
+ build: ewm-service
+ image: ewm-service
+ container_name: ewm-service
ports:
- "8080:8080"
+ depends_on:
+ - stats-server
+ environment:
+ - STATSERVER_URL=http://stats-server:9090
ewm-db:
image: postgres:16.1
+ container_name: postgres-ewm
+ ports:
+ - "5434:5434"
+ environment:
+ - POSTGRES_PASSWORD=statewm
+ - POSTGRES_USER=statewm
+ - POSTGRES_DB=statewm
+ healthcheck:
+ test: pg_isready -q -d $$POSTGRES_DB -U $$POSTGRES_USER
+ timeout: 5s
+ interval: 5s
+ retries: 10
+
diff --git a/ewm-service/Dockerfile b/ewm-service/Dockerfile
new file mode 100644
index 0000000..0ff1817
--- /dev/null
+++ b/ewm-service/Dockerfile
@@ -0,0 +1,5 @@
+FROM eclipse-temurin:21-jre-jammy
+VOLUME /tmp
+ARG JAR_FILE=target/*.jar
+COPY ${JAR_FILE} app.jar
+ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar /app.jar"]
\ No newline at end of file
diff --git a/ewm-service/README.md b/ewm-service/README.md
new file mode 100644
index 0000000..f6eea04
--- /dev/null
+++ b/ewm-service/README.md
@@ -0,0 +1 @@
+# ewm-service
\ No newline at end of file
diff --git a/ewm-service/pom.xml b/ewm-service/pom.xml
new file mode 100644
index 0000000..9eb9b4f
--- /dev/null
+++ b/ewm-service/pom.xml
@@ -0,0 +1,79 @@
+
+
+ 4.0.0
+
+ ru.practicum
+ explore-with-me
+ 0.0.1-SNAPSHOT
+
+
+ ewm-service
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+
+ ru.practicum
+ stat-dto
+ 0.0.1-SNAPSHOT
+ compile
+
+
+
+ ru.practicum
+ stat-client
+ 0.0.1-SNAPSHOT
+ compile
+
+
+
+
+
+ 21
+ 21
+ UTF-8
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ewm-service/src/main/java/ru/practicum/evmsevice/EwmServiceApp.java b/ewm-service/src/main/java/ru/practicum/evmsevice/EwmServiceApp.java
new file mode 100644
index 0000000..20b8584
--- /dev/null
+++ b/ewm-service/src/main/java/ru/practicum/evmsevice/EwmServiceApp.java
@@ -0,0 +1,11 @@
+package ru.practicum.evmsevice;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class EwmServiceApp {
+ public static void main(String[] args) {
+ SpringApplication.run(EwmServiceApp.class, args);
+ }
+}
diff --git a/ewm-service/src/main/java/ru/practicum/evmsevice/client/StatsClient.java b/ewm-service/src/main/java/ru/practicum/evmsevice/client/StatsClient.java
new file mode 100644
index 0000000..811b2a1
--- /dev/null
+++ b/ewm-service/src/main/java/ru/practicum/evmsevice/client/StatsClient.java
@@ -0,0 +1,38 @@
+package ru.practicum.evmsevice.client;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.util.DefaultUriBuilderFactory;
+import ru.practicum.statclient.BaseClient;
+import ru.practicum.statdto.HitDto;
+
+import java.util.Map;
+
+@Component
+public class StatsClient extends BaseClient {
+ private static final String PREFIX_HIT = "/hit";
+ private static final String PREFIX_STATS = "/stats";
+
+ @Autowired
+ public StatsClient(@Value("${statserver.url}") String serverUrl, RestTemplateBuilder builder) {
+ super(
+ builder
+ .uriTemplateHandler(new DefaultUriBuilderFactory(serverUrl))
+ .requestFactory(() -> new HttpComponentsClientHttpRequestFactory())
+ .build()
+ );
+ }
+
+ public void post(HitDto dto) {
+ makeAndSendRequest(HttpMethod.POST, PREFIX_HIT, null, dto);
+ }
+
+ public ResponseEntity