docker compose

This commit is contained in:
jinho jeong
2022-06-27 16:03:39 +09:00
parent 5e15f1eb2e
commit a96d385186
6 changed files with 66 additions and 24 deletions

View File

@@ -41,23 +41,32 @@ One Day Lifetime SNS
│ │ │ │ ├── dto
│ │ │ │ └── exception
│ │ ├── global
│ │ ├── common
│ │ │ ├── request
│ │ │ └── response
│ │ ├── common
│ │ │ ├── request
│ │ │ └── response
│ │ │ ├── config
│ │ │ │ ├── RedisConfig.java
│ │ │ │ ├── BatchConfig.java
│ │ │ │ ├── MongoConfig.java
│ │ │ │ └── security
│ │ │ │ ├── InterceptorConfig.java
│ │ │ │ └── WebSecurityConfig.java
│ │ │ ├── error
│ │ │ │ ├── GlobalExceptionHandler.java
│ │ │ │ └── exception
│ │ │ │ ├── NotFoundException.java
│ │ │ └── util
│ │ │ ├── LoginCheckInterceptor.java
│ │ │ └── BatchScheduler.java
│ │ └── infra
│ │ ├── config
│ │ │ ├── RedisConfig.java
│ │ │ ── BatchConfig.java
│ │ │ ├── MongoConfig.java
│ │ │ └── security
│ │ │ ├── InterceptorConfig.java
│ │ ── WebSecurityConfig.java
│ │ ├── error
│ │ │ ├── GlobalExceptionHandler.java
│ │ │ └── exception
│ │ │ ├── NotFoundException.java
│ │ └── util
│ │ ├── LoginCheckInterceptor.java
│ │ ├── BatchScheduler.java
│ │ │ ├── KafkaConsumerConfig.java
│ │ │ ── KafkaProducerConfig.java
│ │ ├── dto
│ │ │ └── PostMessage.java
│ │ └── kafka
│ │ ── KafkaPublisher.java
│ │ └── KafkaSubscriber.java
│ └── resources
│ ├── application-local.yml
│ ├── application-prod.yml
@@ -69,5 +78,5 @@ One Day Lifetime SNS
```bash
git clone https://github.com/zzzinho/Oneul.git
gradle bootJar
docker compose up --build -d
docker compose up --build
```

View File

@@ -1,13 +1,14 @@
version: "3"
version: "3.7"
services:
oneul:
build: .
ports:
- 8080:8080
- 5555:5555
depends_on:
- mysql
- redis
- mongodb
- kafka
mysql:
image: mysql
@@ -26,4 +27,23 @@ services:
mongodb:
image: mongo
ports:
- 27017:27017
- 27017:27017
zookeeper:
image: zookeeper:3.4
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka:2.12-2.4.0
depends_on:
- zookeeper
ports:
- "9092:9092"
environment:
KAFKA_LISTENERS: OUTSIDE://kafka:9092,INSIDE://localhost:9093
KAFKA_ADVERTISED_LISTENERS: OUTSIDE://kafka:9092,INSIDE://localhost:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: OUTSIDE:PLAINTEXT,INSIDE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: OUTSIDE
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_CREATE_TOPICS: "post:1:1"

View File

@@ -12,9 +12,6 @@ import com.example.oneul.domain.post.domain.Post;
import com.example.oneul.domain.post.dto.PostDTO;
import com.example.oneul.domain.post.service.command.PostCommandService;
@RestController
@RequestMapping(value = "/post")
public class PostCommandApi {

View File

@@ -19,7 +19,7 @@ public class KafkaSubscriber {
this.postQueryRepository = postQueryRepository;
}
@KafkaListener(topics = "post", groupId = "post", containerFactory = "postListener")
@KafkaListener(topics = "post", containerFactory = "postListener")
public void listen(PostMessage postMessage){
log.info("message listen: " + postMessage.toString());

View File

@@ -23,8 +23,14 @@ spring:
host: mongodb
port: 27017
database: oneul
kafka:
bootstrap-servers: kafka:9092
consumer:
group-id: post
auto-offset-reset: earliest
server:
port: 5555
servlet:
session:
timeout: 60

View File

@@ -16,6 +16,16 @@ spring:
redis:
host: localhost
port: 6379
data:
mongodb:
host: mongodb
port: 27017
database: oneul
kafka:
bootstrap-servers: localhost:9092
consumer:
group-id: post
auto-offset-reset: earliest
server:
servlet: