-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MAGNAT\sergey_ra
committed
Apr 23, 2024
1 parent
2edf056
commit e22ee56
Showing
25 changed files
with
677 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,51 @@ | ||
version: '3.1' | ||
services: | ||
stats-server: | ||
ewm-stats: | ||
build: ewm-stats-server | ||
image: ewm-stats_image | ||
container_name: ewm_stats_container | ||
ports: | ||
- "9090:9090" | ||
- "9090:9090" | ||
depends_on: | ||
- stats-db | ||
environment: | ||
- SPRING_DATASOURCE_URL=jdbc:postgresql://stats-db:5432/ewm_stats | ||
- SPRING_DATASOURCE_USERNAME=ewm_stats | ||
- SPRING_DATASOURCE_PASSWORD=ewm_stats | ||
- STATS_SERVER_URL=http://stats-server:9090 | ||
|
||
stats-db: | ||
image: postgres:14-alpine | ||
container_name: ewm-stats-db | ||
ports: | ||
- "6541:5432" | ||
environment: | ||
- POSTGRES_PASSWORD=ewm_stats | ||
- POSTGRES_USER=ewm_stats | ||
- POSTGRES_DB=stats | ||
|
||
ewm-service: | ||
ewm-main: | ||
build: ewm-main-service | ||
image: ewm_main_image | ||
container_name: ewm_main_container | ||
ports: | ||
- "8080:8080" | ||
|
||
depends_on: | ||
- ewm-db | ||
- ewm-stats | ||
environment: | ||
- SPRING_DATASOURCE_URL=jdbc:postgresql://main-db:5433/ewm_main | ||
- SPRING_DATASOURCE_USERNAME=ewm_main | ||
- SPRING_DATASOURCE_PASSWORD=ewm_main | ||
- STATS_SERVER_URL=http://stats-server:9090 | ||
|
||
ewm-db: | ||
image: postgres:14-alpine | ||
container_name: main-db | ||
ports: | ||
- "6542:5433" | ||
environment: | ||
- POSTGRES_PASSWORD=ewm_main | ||
- POSTGRES_USER=ewm_main | ||
- POSTGRES_DB=ewm_main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM amazoncorretto:11 | ||
COPY target/*.jar main-service.jar | ||
ENTRYPOINT ["java", "-jar", "/main-service.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<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> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>main-service</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>main-service</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>ru.practicum</groupId> | ||
<artifactId>stats-client</artifactId> | ||
<version>${project.version}</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-validation</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.postgresql</groupId> | ||
<artifactId>postgresql</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>3.8.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
14 changes: 14 additions & 0 deletions
14
main-service/src/main/java/ru/practicum/ewm/EWMMainServiceApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ru.practicum.ewm; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class EWMMainServiceApp | ||
{ | ||
public static void main( String[] args ) | ||
{ | ||
SpringApplication.run(EWMMainServiceApp.class, args); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
server.port=8080 | ||
logging.level.org.springframework.web.client.RestTemplate=info | ||
logging.level.org.apache.http=DEBUG | ||
logging.level.httpclient.wire=info | ||
spring.jpa.hibernate.ddl-auto=none | ||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL10Dialect | ||
spring.jpa.properties.hibernate.format_sql=true | ||
spring.jpa.properties.hibernate.show_sql=true | ||
spring.sql.init.mode=always | ||
#--- | ||
db.name=ewm_main | ||
spring.datasource.driverClassName=org.postgresql.Driver | ||
spring.datasource.url=jdbc:postgresql://localhost:5433/${db.name} | ||
spring.datasource.username=ewm_main | ||
spring.datasource.password=ewm_main | ||
#--- | ||
spring.config.activate.on-profile=ci,test | ||
spring.datasource.driverClassName=org.h2.Driver | ||
spring.datasource.url=jdbc:h2:mem:${db.name} | ||
spring.datasource.username=ewm_main | ||
spring.datasource.password=ewm_main | ||
spring.h2.console.enabled=true |
38 changes: 38 additions & 0 deletions
38
main-service/src/test/java/ru/practicum/ewm/EWMMainServiceAppTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package ru.practicum.ewm; | ||
|
||
import junit.framework.Test; | ||
import junit.framework.TestCase; | ||
import junit.framework.TestSuite; | ||
|
||
/** | ||
* Unit test for simple App. | ||
*/ | ||
public class EWMMainServiceAppTest | ||
extends TestCase | ||
{ | ||
/** | ||
* Create the test case | ||
* | ||
* @param testName name of the test case | ||
*/ | ||
public EWMMainServiceAppTest(String testName ) | ||
{ | ||
super( testName ); | ||
} | ||
|
||
/** | ||
* @return the suite of tests being tested | ||
*/ | ||
public static Test suite() | ||
{ | ||
return new TestSuite( EWMMainServiceAppTest.class ); | ||
} | ||
|
||
/** | ||
* Rigourous Test :-) | ||
*/ | ||
public void testApp() | ||
{ | ||
assertTrue( true ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<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> | ||
|
||
<artifactId>stats</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<name>stats</name> | ||
<url>http://maven.apache.org</url> | ||
<modules> | ||
<module>stats-client</module> | ||
<module>stats-dto</module> | ||
<module>stats-server</module> | ||
</modules> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<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>stats</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>stats-client</artifactId> | ||
<name>stats-client</name> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>ru.practicum</groupId> | ||
<artifactId>stats-dto</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
</project> |
13 changes: 13 additions & 0 deletions
13
stats/stats-client/src/main/java/ru/practicum/ewm/client/stats/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ru.practicum.ewm.client.stats; | ||
|
||
/** | ||
* Hello world! | ||
* | ||
*/ | ||
public class App | ||
{ | ||
public static void main( String[] args ) | ||
{ | ||
System.out.println( "Hello World!" ); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
stats/stats-client/src/main/java/ru/practicum/ewm/client/stats/StatsClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package ru.practicum.ewm.client.stats; | ||
|
||
public class StatsClient { | ||
// RestTemplate restTemplate; | ||
|
||
// аналог baseclient, два метода, которые умеют общаться с endpoint из statsserver | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<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>stats</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>stats-dto</artifactId> | ||
<name>stats-dto</name> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-validation</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
</project> |
Oops, something went wrong.