Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/Dev_CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,25 @@ jobs:
uses: actions/download-artifact@v4
with:
name: app-artifact
path: ~/app
path: ~/app/staging

- name: Download deploy scripts
uses: actions/download-artifact@v4
with:
name: deploy-scripts
path: ~/app/scripts/

- name: Replace application to latest
run: sudo sh ~/app/scripts/replace-new-version.sh
- name: Setup log directory
run: |
sudo mkdir -p /home/ubuntu/logs
sudo chown -R ubuntu:ubuntu /home/ubuntu/logs
chmod 755 /home/ubuntu/logs

- name: Make deploy script executable
run: chmod +x ~/app/scripts/zero-downtime-deploy.sh

- name: Health Check
run: sh ~/app/scripts/health-check.sh
- name: Zero Downtime Deployment
run: sh ~/app/scripts/zero-downtime-deploy.sh

- name: Send Discord Alert on Failure
if: failure()
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/Prod_CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,25 @@ jobs:
uses: actions/download-artifact@v4
with:
name: app-artifact
path: ~/app
path: ~/app/staging

- name: Download deploy scripts
uses: actions/download-artifact@v4
with:
name: deploy-scripts
path: ~/app/scripts/

- name: Replace application to latest
run: sudo sh ~/app/scripts/replace-new-version.sh
- name: Setup log directory
run: |
sudo mkdir -p /home/ubuntu/logs
sudo chown -R ubuntu:ubuntu /home/ubuntu/logs
chmod 755 /home/ubuntu/logs

- name: Make deploy script executable
run: chmod +x ~/app/scripts/zero-downtime-deploy.sh

- name: Health Check
run: sh ~/app/scripts/health-check.sh
- name: Zero Downtime Deployment
run: sh ~/app/scripts/zero-downtime-deploy.sh

- name: Send Discord Alert on Failure
if: failure()
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ out/

### application-local.yml
/src/main/resources/application-local.yml
.serena
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ dependencies {
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'

// Websocket
implementation 'org.springframework.boot:spring-boot-starter-websocket'

// JWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-gson:0.11.5'

// Excel Export
implementation 'org.apache.poi:poi-ooxml:5.2.3'
implementation 'org.apache.poi:poi:5.2.3'

// Logging
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml"
Expand All @@ -71,7 +70,7 @@ dependencies {
testImplementation("com.navercorp.fixturemonkey:fixture-monkey-starter:1.1.11")

// Rest Docs & Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0'
testImplementation 'io.rest-assured:rest-assured:5.5.0'
testImplementation 'org.springframework.restdocs:spring-restdocs-restassured'
testImplementation 'com.epages:restdocs-api-spec-mockmvc:0.18.2'
Expand Down
34 changes: 34 additions & 0 deletions nginx/api.dev.debate-timer.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
upstream debate_timer_backend {
server 127.0.0.1:8080;
keepalive 32;
}

server {
server_name api.dev.debate-timer.com;

location / {
proxy_pass http://debate_timer_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/api.dev.debate-timer.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/api.dev.debate-timer.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
if ($host = api.dev.debate-timer.com) {
return 308 https://$host$request_uri;
} # managed by Certbot

listen 80;
listen [::]:80;
server_name api.dev.debate-timer.com;
return 404; # managed by Certbot
}
Comment on lines +25 to +34

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

HTTP에서 HTTPS로 리디렉션하는 로직을 더 간단하고 효율적으로 개선할 수 있습니다. server 블록 내에서 if 문을 사용하는 것은 일반적으로 성능과 가독성 측면에서 권장되지 않습니다. if 문 없이 return을 직접 사용하여 리디렉션하는 것이 좋습니다. 이 제안은 nginx/api.prod.debate-timer.com 파일에도 동일하게 적용됩니다.

server {
    listen 80;
    listen [::]:80;
    server_name api.dev.debate-timer.com;
    return 308 https://$host$request_uri; # managed by Certbot
}

34 changes: 34 additions & 0 deletions nginx/api.prod.debate-timer.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
upstream debate_timer_backend {
server 127.0.0.1:8080;
keepalive 32;
}

server {
server_name api.prod.debate-timer.com;

location / {
proxy_pass http://debate_timer_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/api.prod.debate-timer.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/api.prod.debate-timer.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
if ($host = api.prod.debate-timer.com) {
return 308 https://$host$request_uri;
} # managed by Certbot

listen 80;
listen [::]:80;
server_name api.prod.debate-timer.com;
return 404; # managed by Certbot
}
Loading
Loading