Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stat svc #40

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 12 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
HELP.md
*.class
*.log
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
hs_err_pid*
replay_pid*
out/
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

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

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

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

### VS Code ###
.vscode/
36 changes: 33 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
version: '3.1'
services:
stats-server:
build:
context: stats/stats-server
dockerfile: Dockerfile
container_name: stats-server
ports:
- "9090:9090"
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://stats-db:5432/ewm-stats
- SPRING_DATASOURCE_USERNAME=test
- SPRING_DATASOURCE_PASSWORD=test


stats-db:
image: postgres:14-alpine
image: postgres:16.1
container_name: postgres-stats-ewm
ports:
- "6542:5432"
environment:
- POSTGRES_DB=ewm-stats
- POSTGRES_USER=test
- POSTGRES_PASSWORD=test

ewm-service:
build:
context: main-service/
dockerfile: Dockerfile
container_name: main-server
ports:
- "8080:8080"
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://stats-db:5432/ewm-main
- SPRING_DATASOURCE_USERNAME=test
- SPRING_DATASOURCE_PASSWORD=test

ewm-db:
image: postgres:14-alpine
image: postgres:16.1
container_name: postgres-main-ewm
ports:
- "6543:5432"
environment:
- POSTGRES_DB=ewm-main
- POSTGRES_USER=test
- POSTGRES_PASSWORD=test
23 changes: 22 additions & 1 deletion ewm-main-service-spec.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"openapi": "3.0.1",
"info": {
"title": "Main service API",
"description": "Documentation \"Explore With Me\" API v1.0",
"title": "\"Explore With Me\" API сервер",
"version": "1.0"
},
"servers": [
Expand Down Expand Up @@ -479,6 +480,7 @@
"name": "from",
"required": false,
"schema": {
"minimum": 0,
"type": "integer",
"format": "int32",
"default": 0
Expand Down Expand Up @@ -634,6 +636,7 @@
"name": "from",
"required": false,
"schema": {
"minimum": 0,
"type": "integer",
"format": "int32",
"default": 0
Expand Down Expand Up @@ -803,6 +806,7 @@
"name": "from",
"required": false,
"schema": {
"minimum": 0,
"type": "integer",
"format": "int32",
"default": 0
Expand Down Expand Up @@ -943,6 +947,7 @@
"name": "from",
"required": false,
"schema": {
"minimum": 0,
"type": "integer",
"format": "int32",
"default": 0
Expand Down Expand Up @@ -1074,6 +1079,8 @@
"name": "text",
"required": false,
"schema": {
"maxLength": 7000,
"minLength": 1,
"type": "string"
}
},
Expand Down Expand Up @@ -1146,6 +1153,7 @@
"name": "from",
"required": false,
"schema": {
"minimum": 0,
"type": "integer",
"format": "int32",
"default": 0
Expand Down Expand Up @@ -1287,6 +1295,7 @@
"name": "from",
"required": false,
"schema": {
"minimum": 0,
"type": "integer",
"format": "int32",
"default": 0
Expand Down Expand Up @@ -2098,6 +2107,8 @@
"example": 1
},
"name": {
"maxLength": 50,
"minLength": 1,
"type": "string",
"description": "Название категории",
"example": "Концерты"
Expand Down Expand Up @@ -2441,6 +2452,8 @@
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 1,
"type": "string",
"description": "Название категории",
"example": "Концерты"
Expand Down Expand Up @@ -2476,6 +2489,8 @@
"default": false
},
"title": {
"maxLength": 50,
"minLength": 1,
"type": "string",
"description": "Заголовок подборки",
"example": "Летние концерты"
Expand Down Expand Up @@ -2559,11 +2574,15 @@
"type": "object",
"properties": {
"email": {
"maxLength": 254,
"minLength": 6,
"type": "string",
"description": "Почтовый адрес",
"example": "[email protected]"
},
"name": {
"maxLength": 250,
"minLength": 2,
"type": "string",
"description": "Имя",
"example": "Иван Петров"
Expand Down Expand Up @@ -2624,6 +2643,8 @@
"example": true
},
"title": {
"maxLength": 50,
"minLength": 1,
"type": "string",
"description": "Заголовок подборки",
"example": "Необычные фотозоны"
Expand Down
3 changes: 3 additions & 0 deletions main-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM amazoncorretto:21
COPY target/*.jar main.jar
ENTRYPOINT ["java","-jar","/main.jar"]
59 changes: 59 additions & 0 deletions main-service/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?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>explore-with-me</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<groupId>ru.practicum.yandex</groupId>
<artifactId>main-service</artifactId>

<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.yandex</groupId>
<artifactId>stats-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<mainClass>ru.practicum.exploreWithMe.ExploreWithMeMain</mainClass>
</manifest>
</archive>
</configuration>
</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,11 @@
package ru.practicum.exploreWithMe;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ExploreWithMeMain {
public static void main(String[] args) {
SpringApplication.run(ExploreWithMeMain.class, args);
}
}
3 changes: 3 additions & 0 deletions main-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
server.port=8080

stats-server.url=http://localhost:9090
14 changes: 9 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<version>3.3.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<name>Explore With Me</name>
<modules>
<module>stats</module>
<module>main-service</module>
</modules>

<groupId>ru.practicum</groupId>
<artifactId>explore-with-me</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<java.version>11</java.version>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -63,7 +67,7 @@
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.7.0.0</version>
<version>4.8.5.0</version>
<configuration>
<effort>Max</effort>
<threshold>High</threshold>
Expand All @@ -79,7 +83,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.12</version>
<configuration>
<output>file</output>
</configuration>
Expand Down
28 changes: 28 additions & 0 deletions stats/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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>explore-with-me</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<groupId>ru.practicum.yandex</groupId>
<artifactId>stats</artifactId>
<packaging>pom</packaging>

<modules>
<module>stats-client</module>
<module>stats-dto</module>
<module>stats-server</module>
</modules>

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

</project>
Loading
Loading