Skip to content

Commit

Permalink
chore: 어드민 모듈 리버스 프록싱 v2 (#270)
Browse files Browse the repository at this point in the history
* chore: nginx 리버스 프록시 설정

* chore: admin 모듈 컨테이너에 추가

* chore: 커넥션 풀 수 조정

* chore: nginx 수정

* chore: nginx 수정

* chore: blue 상태 핸들링

* chore: 엔드포인트 변경

* chore: dev nginx conf 수정

* chore: dev 브랜치 테스트
  • Loading branch information
mikekks authored Dec 3, 2024
1 parent e912fb0 commit b17d50f
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aws-cicd-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- develop
- feat/LA-20
- feat/LA-20_3

env:
REGISTRY: "docker.io"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/aws-cicd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- chore/migration

env:
REGISTRY: "docker.io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import lombok.RequiredArgsConstructor;

@RequestMapping("/admin/members")
@RequestMapping("/members")
@RequiredArgsConstructor
@RestController
public class AdminMemberController implements AdminMemberApi {
Expand Down
3 changes: 3 additions & 0 deletions layer-admin/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ spring:
username: ${AWS_PROD_DB_NAME}
password: ${AWS_PROD_DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
maximum-pool-size: 5 # 최대 pool 크기
minimum-idle: 5 # 최소 pool 크기
jpa:
hibernate:
ddl-auto: validate
Expand Down
3 changes: 3 additions & 0 deletions layer-admin/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ spring:
username: ${AWS_PROD_DB_NAME}
password: ${AWS_PROD_DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
maximum-pool-size: 5 # 최대 pool 크기
minimum-idle: 5 # 최소 pool 크기
jpa:
hibernate:
ddl-auto: validate
Expand Down
12 changes: 10 additions & 2 deletions layer-api/infra/development/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ http {
server layer-admin:3000;
}

# api.layerapp.io에 대한 서버 블록
server {
listen 80;
server_name api.layerapp.io;

location / {
proxy_pass http://layer-api;
Expand All @@ -19,9 +21,15 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

location /admin/ {
proxy_pass http://layer-admin; # Proxy to layer-admin
# admin.api.layerapp.io에 대한 서버 블록
server {
listen 80;
server_name admin-dev.layerapp.io;

location / {
proxy_pass http://layer-admin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
18 changes: 18 additions & 0 deletions layer-api/infra/production/docker-compose-blue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,23 @@ services:
- layer-api-blue
restart: always

admin-app-blue:
image: docker.io/clean01/layer-server_layer-admin:latest #
container_name: layer-admin-blue
ports:
- "3001:3000"
environment:
- TZ=Asia/Seoul
- SPRING_PROFILES_ACTIVE=prod
volumes:
- ./application-secret.properties:/config/application-secret.properties
- ./log:/log
- ./tokens:/config/tokens
networks:
- app-network
depends_on:
- layer-api-blue
restart: always

networks:
app-network:
18 changes: 18 additions & 0 deletions layer-api/infra/production/docker-compose-green.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,23 @@ services:
- layer-api-green
restart: always

admin-app-green:
image: docker.io/clean01/layer-server_layer-admin:latest #
container_name: layer-admin-green
ports:
- "3000:3000"
environment:
- TZ=Asia/Seoul
- SPRING_PROFILES_ACTIVE=prod
volumes:
- ./application-secret.properties:/config/application-secret.properties
- ./log:/log
- ./tokens:/config/tokens
networks:
- app-network
depends_on:
- layer-api-green
restart: always

networks:
app-network:
22 changes: 21 additions & 1 deletion layer-api/infra/production/nginx.blue.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ http {
server localhost:8081;
}

upstream layer-admin {
server localhost:3001;
}

# api.layerapp.io에 대한 서버 블록
server {
listen 80;
server_name api.layerapp.io;

location / {
proxy_pass http://layer-api;
Expand All @@ -16,4 +22,18 @@ http {
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}

# admin.api.layerapp.io에 대한 서버 블록
server {
listen 80;
server_name admin-prod.layerapp.io;

location / {
proxy_pass http://layer-admin;
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;
}
}
}
19 changes: 0 additions & 19 deletions layer-api/infra/production/nginx.conf

This file was deleted.

22 changes: 21 additions & 1 deletion layer-api/infra/production/nginx.green.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ http {
server localhost:8080;
}

upstream layer-admin {
server localhost:3000;
}

# api.layerapp.io에 대한 서버 블록
server {
listen 80;
server_name api.layerapp.io;

location / {
proxy_pass http://layer-api;
Expand All @@ -16,4 +22,18 @@ http {
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}

# admin.api.layerapp.io에 대한 서버 블록
server {
listen 80;
server_name admin-prod.layerapp.io;

location / {
proxy_pass http://layer-admin;
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;
}
}
}
3 changes: 3 additions & 0 deletions layer-batch/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ spring:
username: ${AWS_PROD_DB_NAME}
password: ${AWS_PROD_DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
maximum-pool-size: 5 # 최대 pool 크기
minimum-idle: 5 # 최소 pool 크기
jpa:
hibernate:
ddl-auto: validate
Expand Down

0 comments on commit b17d50f

Please sign in to comment.