Skip to content

Commit 503f614

Browse files
authored
Merge pull request #58 from DDD-Community/chore/caddy-frontend-serving
chore(infra): Caddy 로 FE 정적 서빙 분기 + frontend/current 부트스트랩
2 parents 062b528 + f71aa55 commit 503f614

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ jobs:
5555
sudo docker pull "$APP_IMAGE"
5656
cd /opt/ddd-be
5757
umask 077
58-
58+
59+
# Frontend bootstrap precondition (FE 팀 release 패턴: /opt/admin/frontend/current 가 symlink 여야 함)
60+
# 최초 1회 VM 부트스트랩이 누락되면 여기서 실패 — docs/admin-deploy.md §A 참고
61+
if [ ! -e /opt/admin/frontend/current ]; then
62+
echo "ERROR: /opt/admin/frontend/current 가 없습니다. VM 1회 부트스트랩이 필요합니다."
63+
echo " ssh dddstudy1@<VM> 후 docs/admin-deploy.md §A 의 5줄 실행"
64+
exit 1
65+
fi
66+
5967
# Create GCP Service Account Key file
6068
echo "$GCP_SERVICE_ACCOUNT_JSON" > gcp-key.json
6169

Caddyfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
admin.dddstudy.kr {
2-
reverse_proxy app:3000
2+
# 백엔드: API + Swagger
3+
@backend {
4+
path /api/* /api-docs*
5+
}
6+
reverse_proxy @backend app:3000
7+
8+
# 프론트엔드: 정적 파일 + SPA fallback (history 모드 지원)
9+
root * /srv/frontend
10+
# SPA 라우팅, 새로고침 시 404 안나게하기위해
11+
try_files {path} /index.html
12+
# 정적 파일 서빙 핸들러를 활성화
13+
file_server
314
}

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ services:
4343
- "443:443"
4444
volumes:
4545
- ./Caddyfile:/etc/caddy/Caddyfile
46+
- /opt/admin/frontend/current:/srv/frontend:ro
4647
- caddy_data:/data
4748
- caddy_config:/config
4849
depends_on:

0 commit comments

Comments
 (0)