Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ“¦ chore: Netlify 쒅속성 제거λ₯Ό μœ„ν•œ NGINX μ„€μ • λ³€κ²½ 및 FE CD 슀크립트 μž‘μ„± #294

Merged
merged 3 commits into from
Dec 24, 2024

Conversation

asn6878
Copy link
Member

@asn6878 asn6878 commented Dec 20, 2024

πŸ“‹ μž‘μ—… λ‚΄μš©

nginx.conf μ„€μ •νŒŒμΌ 이동

ν”„λ‘œμ νŠΈ λ‚΄μ—μ„œ nginx 섀정을 ν•˜κ³ , μ§κ΄€μ μœΌλ‘œ 관리할 수 μžˆλ„λ‘ 루트 디렉토리 내에 nginx μ„€μ • νŒŒμΌμ„ λ§Œλ“€μ—ˆμŠ΅λ‹ˆλ‹€.
κ·Έ ν›„, /etc/nginx 경둜 λ‚΄μ—μ„œ 루트 λ””λ ‰ν† λ¦¬μ˜ conf νŒŒμΌμ„ include 처리 ν•΄ μ£Όμ—ˆμŠ΅λ‹ˆλ‹€.

# /etc/nginx/nginx.conf
http {
        ...
	include /var/web05-Denamu/nginx.conf;
}

index.html 및 vite 정적 λΉŒλ“œ νŒŒμΌμ„ NGINXμ—μ„œ λ°˜ν™˜ν•˜λ„λ‘ λ³€κ²½

기쑴에 Netlifyμ—μ„œ λ°˜ν™˜ν•˜λ˜ μ •μ νŒŒμΌμ„ NGINXμ—μ„œ λ°˜ν™˜ν•  수 μžˆλ„λ‘ λΌμš°νŒ… 처리 ν•΄λ‘μ—ˆμŠ΅λ‹ˆλ‹€.

    # 정적 파일 μ„œλΉ™ - FE λΉŒλ“œ 파일
    location / {
        root /var/web05-Denamu/client/dist;
        index index.html;  # κΈ°λ³Έ 파일 μ„€μ •
        try_files $uri /index.html;  # SPA 지원
    }

    # 정적 파일 μ„œλΉ™
	location /files {
		alias /var/web05-Denamu/static/;
		try_files $uri $uri/ =404; # 파일이 μ—†μœΌλ©΄ 404 λ°˜ν™˜
	}
...

/ 루트 경둜둜 λ“€μ–΄μ˜€λŠ” μš”μ²­λ“€μ€ client/dist λ‚΄ νŒŒμΌλ“€(index.html, css 및 λ‹€μ–‘ν•œ js νŒŒμΌλ“€)을 λ°˜ν™˜ν•©λ‹ˆλ‹€.
ν˜„μž¬ https://www.api.denamu.site/ 경둜둜 μ ‘μ†ν•΄λ³΄μ‹œλ©΄, public-was μΈμŠ€ν„΄μŠ€μ—μ„œ FE μ •μ νŒŒμΌλ“€μ„ λ°˜ν™˜ν•΄μ£ΌλŠ” μƒνƒœμž„μ„ ν™•μΈν•˜μ‹€ 수 있으며, React Route μ—­μ‹œ μ •μƒμ μœΌλ‘œ λ™μž‘ν•˜λŠ” 것을 보싀 수 μžˆμŠ΅λ‹ˆλ‹€.

Client νŒŒμΌλ“€μ—μ„œ API μš”μ²­μ‹œ μ‚¬μš©λ˜λŠ” baseURL λ³€κ²½

Important

@jungmyunggi @junyeokk baseURL λ³€κ²½ λ‚΄μš© ν™•μΈν•˜μ‹œκΈ° λ°”λžλ‹ˆλ‹€.

image
public-was μΈμŠ€ν„΄μŠ€ μ„œλ²„λ‘œ κ°€λŠ” μš”μ²­μ€ 기쑴에 A λ ˆμ½”λ“œλ₯Ό ν™œμš©ν•΄ api prefixλ₯Ό 톡해 ꡬ뢄해 ν”„λ‘μ‹œλ₯Ό μ§„ν–‰μ€‘μ΄μ—ˆμŠ΅λ‹ˆλ‹€.

  • BE & 정적 파일 μš”μ²­ 경둜 : api.denamu.site -> public-was μΈμŠ€ν„΄μŠ€ Public IP
  • FE μš”μ²­ 경둜 : denamu.site -> : denamu.netlify.app

λ³Έ PR이 λ³‘ν•©λ˜λ©΄, FE μš”μ²­μ„ public-was에 μœ„μž„ν•˜μ˜€μœΌλ―€λ‘œ netlify 둜 λ§€ν•‘ν•˜λŠ” 경둜λ₯Ό μ œκ±°ν•  μ˜ˆμ •μž…λ‹ˆλ‹€.

  • 톡합 μš”μ²­ 경둜 : denamu.site -> public-was μΈμŠ€ν„΄μŠ€ Public IP
  • FE μš”μ²­ 경둜 : denamu.site -> : denamu.netlify.app

ClientμΈ‘ CD Actions 슀크립트 μž‘μ„±

Client μΈ‘ μ½”λ“œμ— μ—…λ°μ΄νŠΈκ°€ μžˆμ„ μ‹œ, npm run μ»€λ§¨λ“œλ₯Ό 톡해 배포λ₯Ό μˆ˜ν–‰ν•˜λŠ” Github Actions 슀크립트λ₯Ό μž‘μ„±ν–ˆμŠ΅λ‹ˆλ‹€.

μΆ”ν›„ λ³€κ²½ λ°©μ•ˆ

ν˜„ μƒν™©μ—μ„œ CloudFlareλ₯Ό μ œκ±°ν•˜κΈ° μœ„ν•΄, SSLμΈμ¦μ„œ, denamu.site DNS λΌμš°νŒ… λ³€κ²½ (ν˜„μž¬λŠ” CloudFlare둜 μ„€μ •λ˜μ–΄ μžˆμ§€λ§Œ, μ΄μ œλŠ” κ°€λΉ„μ•„ λ„€μž„μ„œλ²„μ—μ„œ λ‹€μ΄λ ‰νŠΈλ‘œ Public IP둜 가도둝 λ³€κ²½ν•΄μ•Ό ν•©λ‹ˆλ‹€.) λ“±μ˜ 좔가적인 μ²˜λ¦¬κ°€ ν•„μš”ν•©λ‹ˆλ‹€.

ν˜„μž¬ μ •μ νŒŒμΌ μ„œλΉ™ 방식은 κ²°κ΅­ μ„œλ²„μ— λΆ€ν•˜λ₯Ό μ£ΌλŠ” 방식이기에, 쑰금 더 κ°œμ„ ν•  여지가 μžˆλ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€. (Object Storage ν˜Ήμ€ S3 μ‚¬μš©ν•˜κΈ°.) ν—ˆλ‚˜ 일단은 μ΄λ ‡κ²Œ κ°œμ„ μ„ ν•˜μžκ³  이야기가 λ‚˜μ™”λ˜ κ²ƒμœΌλ‘œ κΈ°μ–΅ν•΄ μ§„ν–‰ν•΄λ³΄μ•˜μŠ΅λ‹ˆλ‹€. 이견 μžˆμœΌμ‹œλ©΄ νŽΈν•˜κ²Œ λ§μ”€ν•΄μ£Όμ„Έμš” πŸ˜„

@asn6878 asn6878 added πŸ”§ Chore μ„ΈνŒ… κ΄€λ ¨ πŸ”¨ Refactor λ¦¬νŒ©ν† λ§ (ꡬ쑰 λ³€κ²½) labels Dec 20, 2024
@asn6878 asn6878 self-assigned this Dec 20, 2024
Copy link
Collaborator

@Jo-Minseok Jo-Minseok left a comment

Choose a reason for hiding this comment

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

ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€~ κ³ μƒν•˜μ…¨μ–΄μš” NGINX μ„€μ • 파일 μ•ˆμ—μ„œ λ‹€λ₯Έ μ„€μ • νŒŒμΌμ„ κ°€μ Έμ˜€κ²Œλ„ ν•  수 μžˆκ΅°μš” 처음 μ•Œμ•˜μŠ΅λ‹ˆλ‹€.

Copy link
Collaborator

@CodeVac513 CodeVac513 left a comment

Choose a reason for hiding this comment

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

LGTM!

@asn6878 asn6878 merged commit f0507aa into main Dec 24, 2024
1 check passed
@asn6878 asn6878 deleted the chore/nginx-conf branch December 26, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ”§ Chore μ„ΈνŒ… κ΄€λ ¨ πŸ”¨ Refactor λ¦¬νŒ©ν† λ§ (ꡬ쑰 λ³€κ²½)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants