diff --git a/build.gradle b/build.gradle index 054cdc0..66af489 100644 --- a/build.gradle +++ b/build.gradle @@ -30,9 +30,13 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-webflux' - // db + // mysql runtimeOnly 'com.mysql:mysql-connector-j' + // redis + implementation 'org.springframework.boot:spring-boot-starter-data-redis' + implementation 'org.springframework.session:spring-session-data-redis' + // test testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' diff --git a/docker-compose.yml b/docker-compose.yml index b1fccc2..a3cf7ce 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,6 +25,19 @@ services: cpus: "2" memory: 2GB + redis: + image: redis:latest + container_name: redis-session + ports: + - "6379:6379" + networks: + - dev + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + app: build: . container_name: spring-app @@ -112,6 +125,7 @@ services: volumes: mysql_data: + redis_data: grafana_data: promtail_data: diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index fe9979f..20ff2fe 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -4,5 +4,8 @@ MYSQL_USER=knu-chatbot_user MYSQL_PASSWORD=knu-chatbot123 MYSQL_DATABASE=knu-chatbot +REDIS_HOST=localhost +REDIS_PORT=6379 + DISCORD_WEBHOOK_URL=discord_webhook_url DISCORD_ENVIRONMENT=dev \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c755a96..3d95064 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -15,6 +15,11 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect spring.jpa.properties.hibernate.default_batch_fetch_size=1000 +# redis +spring.session.store-type: redis +spring.data.redis.host=${REDIS_HOST} +spring.data.redis.port=${REDIS_PORT} + # Monitoring management.endpoints.web.exposure.include=health,info,prometheus management.metrics.tags.application=knuchatbot @@ -23,5 +28,6 @@ spring.jpa.properties.hibernate.session_factory.statement_inspector=knu_chatbot. logging.file.name=/logs/app.log +# discord discord.environment=${DISCORD_ENVIRONMENT} discord.webhook-url=${DISCORD_WEBHOOK_URL} \ No newline at end of file