Skip to content

Commit

Permalink
Merge pull request #293 from LearnsMate/feature/payment
Browse files Browse the repository at this point in the history
github-action 무중단 배포 오류로 인한 수정
  • Loading branch information
JoJeHuni authored Nov 29, 2024
2 parents 7df51a5 + e35ec64 commit bdfdb63
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 66 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
113 changes: 56 additions & 57 deletions LearnsMate/.platform/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void scheduleVocAnalysis() {
vocAiService.analyzeVocForLastWeek();
}

@Scheduled(cron = "0 * * * * *")
@Scheduled(cron = "0 0 */3 * * *")
public void scheduleCampaigns() {
List<CampaignDTO> readyCampaigns = campaignService.getReadyCampaigns(LocalDateTime.now());
for (CampaignDTO campaign : readyCampaigns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit bdfdb63

Please sign in to comment.