diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0407e6ae..cedfcafa 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -65,6 +65,30 @@ jobs: properties: hibernate: '[format_sql]': true + + mail: + host: \${SPRING_MAIL_SMTP_HOST} + username: \${SMTP_USERNAME} + password: \${SMTP_PASSWORD} + port: \${SMTP_PORT} + properties: + mail: + smtp: + auth: true + starttls: + enable: true + + data: + redis: + host: \{REDIS_HOST} + port: \{REDIS_PORT} + lettuce: + pool: + max-active: 50 + max-idle: 25 + min-idle: 5 + time-between-eviction-runs: 2000ms + openai: model: gpt-4o secret-key: \${SECRET_KEY} @@ -88,6 +112,12 @@ jobs: RDS_PASSWORD: ${{ secrets.RDS_PASSWORD }} SECRET_KEY: ${{ secrets.SECRET_KEY }} TOKEN_SECRET: ${{ secrets.JWT_SECRET }} + SMTP_USERNAME: ${{ secrets.SMTP_USERNAME }} + SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }} + SMTP_PORT: ${{ secrets.SMTP_PORT }} + SPRING_MAIL_SMTP_HOST: ${{ secrets.SPRING_MAIL_SMTP_HOST }} + REDIS_HOST: ${{ secrets.REDIS_HOST }} + REDIS_PORT: ${{ secrets.REDIS_PORT }} - name: Build with Gradle run: ./gradlew clean build -x test diff --git a/LearnsMate/.platform/nginx.conf b/LearnsMate/.platform/nginx.conf index 4b3528c5..00977d23 100644 --- a/LearnsMate/.platform/nginx.conf +++ b/LearnsMate/.platform/nginx.conf @@ -1,58 +1,57 @@ -user nginx; -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; -worker_processes auto; -worker_rlimit_nofile 33282; - -events { - use epoll; - worker_connections 1024; - multi_accept on; -} - http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - include conf.d/*.conf; - - map $http_upgrade $connection_upgrade { - default "upgrade"; - } - - upstream springboot { - server 127.0.0.1:8080; - keepalive 1024; - } - - server { - listen 80 default_server; - listen [::]:80 default_server; - - location / { - proxy_pass http://springboot; - proxy_http_version 1.1; - proxy_set_header Connection $connection_upgrade; - proxy_set_header Upgrade $http_upgrade; - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - - access_log /var/log/nginx/access.log main; - - client_header_timeout 60; - client_body_timeout 60; - keepalive_timeout 60; - gzip off; - gzip_comp_level 4; - - # Include the Elastic Beanstalk generated locations - include conf.d/elasticbeanstalk/healthd.conf; - } -} \ No newline at end of file + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + include conf.d/*.conf; + + map $http_upgrade $connection_upgrade { + default "upgrade"; + } + + upstream springboot { + server 127.0.0.1:5000; # Elastic Beanstalk 내부 포트 + keepalive 64; + } + + server { + listen 80 default_server; + listen [::]:80 default_server; + + location / { + proxy_pass http://springboot; + proxy_http_version 1.1; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Upgrade $http_upgrade; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /actuator/health { + proxy_pass http://springboot/actuator/health; + proxy_http_version 1.1; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Upgrade $http_upgrade; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + access_log /var/log/nginx/access.log main; + + client_header_timeout 60; + client_body_timeout 60; + keepalive_timeout 60; + gzip on; + gzip_comp_level 4; + + # Include the Elastic Beanstalk generated locations + include conf.d/elasticbeanstalk/healthd.conf; + } +} diff --git a/LearnsMate/src/main/java/intbyte4/learnsmate/common/config/EmailConfig.java b/LearnsMate/src/main/java/intbyte4/learnsmate/common/config/EmailConfig.java index 7181b896..48012500 100644 --- a/LearnsMate/src/main/java/intbyte4/learnsmate/common/config/EmailConfig.java +++ b/LearnsMate/src/main/java/intbyte4/learnsmate/common/config/EmailConfig.java @@ -12,22 +12,22 @@ @Configuration public class EmailConfig { - @Value("${spring.mail.smtp.host}") + @Value("${spring.mail.host}") private String host; - @Value("${spring.mail.smtp.port}") + @Value("${spring.mail.port}") private int port; - @Value("${spring.mail.smtp.username}") + @Value("${spring.mail.username}") private String username; - @Value("${spring.mail.smtp.password}") + @Value("${spring.mail.password}") private String password; - @Value("${spring.mail.smtp.properties.mail.smtp.auth}") + @Value("${spring.mail.properties.mail.smtp.auth}") private boolean auth; - @Value("${spring.mail.smtp.properties.mail.smtp.ssl.enable}") + @Value("${spring.mail.properties.mail.smtp.starttls.enable}") private boolean sslEnable; @Bean @@ -42,8 +42,8 @@ public JavaMailSender mailSender() { Properties props = mailSender.getJavaMailProperties(); props.put("mail.transport.protocol", "smtp"); props.put("mail.smtp.auth", auth); - props.put("mail.smtp.ssl.enable", sslEnable); - props.put("mail.smtp.ssl.trust", host); + props.put("mail.smtp.starttls.enable", sslEnable); + props.put("mail.smtp.starttls.trust", host); return mailSender; } diff --git a/LearnsMate/src/main/java/intbyte4/learnsmate/common/config/SchedulerConfig.java b/LearnsMate/src/main/java/intbyte4/learnsmate/common/config/SchedulerConfig.java index ee12f994..63c9b3ff 100644 --- a/LearnsMate/src/main/java/intbyte4/learnsmate/common/config/SchedulerConfig.java +++ b/LearnsMate/src/main/java/intbyte4/learnsmate/common/config/SchedulerConfig.java @@ -50,7 +50,7 @@ public void scheduleVocAnalysis() { vocAiService.analyzeVocForLastWeek(); } - @Scheduled(cron = "0 * * * * *") + @Scheduled(cron = "0 0 */3 * * *") public void scheduleCampaigns() { List readyCampaigns = campaignService.getReadyCampaigns(LocalDateTime.now()); for (CampaignDTO campaign : readyCampaigns) { diff --git a/LearnsMate/src/main/java/intbyte4/learnsmate/security/WebSecurity.java b/LearnsMate/src/main/java/intbyte4/learnsmate/security/WebSecurity.java index f4173c55..c072bd7f 100644 --- a/LearnsMate/src/main/java/intbyte4/learnsmate/security/WebSecurity.java +++ b/LearnsMate/src/main/java/intbyte4/learnsmate/security/WebSecurity.java @@ -62,6 +62,7 @@ protected SecurityFilterChain configure(HttpSecurity http) throws Exception { // HttpSecurity 설정 http.authorizeHttpRequests((authz) -> authz + .requestMatchers("/actuator/health").permitAll() .requestMatchers(new AntPathRequestMatcher("/error")).permitAll() .requestMatchers(new AntPathRequestMatcher("/swagger-ui/index.html", "GET")).permitAll() .requestMatchers(new AntPathRequestMatcher("/swagger-ui/**", "GET")).permitAll()