-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/16 OCI 서버 배포 및 Docker 기반 CI/CD 파이프라인 구축 #36
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
Conversation
|
""" Walkthrough이 변경 사항은 Docker 기반 배포와 CI/CD 파이프라인을 구축하기 위한 주요 인프라 파일들을 추가 및 수정합니다. Dockerfile, docker-compose, Nginx, Certbot, GitHub Actions 워크플로우, Next.js 설정 등이 포함되어 있으며, 자동화된 배포 및 인증서 관리가 가능하도록 구성되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub
participant CI
participant GHCR
participant RemoteServer
participant Nginx
participant Certbot
Developer->>GitHub: PR 생성/병합 또는 develop 브랜치 push
GitHub->>CI: CI/CD 워크플로우 트리거
CI->>CI: 의존성 설치, 타입체크, 린트, 빌드
CI->>GHCR: Docker 이미지 빌드 및 푸시
CI->>RemoteServer: SSH로 배포 스크립트 실행
RemoteServer->>GHCR: 최신 이미지 pull
RemoteServer->>Nginx: 컨테이너 재시작
Nginx->>Certbot: 인증서 갱신 요청(webroot)
Certbot->>Nginx: 인증서 갱신 후 Nginx 재시작
Developer->>GitHub: 배포 결과 확인
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(없음) Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (10)
.github/workflows/ci.yml (4)
16-16: YAML 포맷팅 문제를 수정해주세요.줄 끝에 불필요한 공백이 있습니다.
- runs-on: ubuntu-latest - + runs-on: ubuntu-latest +
22-22: YAML 포맷팅 문제를 수정해주세요.줄 끝에 불필요한 공백이 있습니다.
- fetch-depth: 0 + fetch-depth: 0
37-38: Shellcheck 경고를 수정해주세요.변수 확장 시 더블 쿼트가 필요합니다.
- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
59-59: 파일 끝에 개행 문자를 추가해주세요.YAML 표준에 따라 파일 끝에 개행 문자가 필요합니다.
- run: pnpm build + run: pnpm build +init-letsencrypt.sh (2)
5-5: 사용되지 않는 변수를 제거하거나 활용해주세요.
rsa_key_size변수가 정의되어 있지만 사용되지 않고 있습니다.-rsa_key_size=4096또는 임시 인증서 생성 시 활용하도록 수정:
- -c "openssl req -x509 -nodes -newkey rsa:1024 -days 1 \ + -c "openssl req -x509 -nodes -newkey rsa:$rsa_key_size -days 1 \
7-7: 하드코딩된 이메일 주소를 환경 변수로 변경하는 것을 고려해주세요.보안과 재사용성을 위해 이메일 주소를 환경 변수로 관리하는 것이 좋습니다.
-email="[email protected]" +email="${LETSENCRYPT_EMAIL:[email protected]}"nginx/conf.d/default.conf (1)
55-59: 정적 자산을 프록시로 우회하면 불필요한 오버헤드 발생
/_next/static경로는 Nginx가 직접 서빙하도록root/alias로 매핑하면
- 컨테이너 간 트래픽 감소
- 캐시 헤더 강제 가능
예:
- location /_next/static { - proxy_pass http://nextjs:3000; - proxy_cache_valid 60m; - add_header Cache-Control "public, immutable"; - } + location /_next/static { + alias /app/.next/static; # docker-volume 로 마운트 필요 + expires 60m; + add_header Cache-Control "public, immutable"; + }Dockerfile (1)
59-67: 헬스체크 명령이 없어 오케스트레이션 도구가 상태를 판단할 수 없습니다Docker 이미지에
HEALTHCHECK를 추가하면docker ps혹은 composehealthcheck와
연동되어 배포 스크립트가 더 신뢰성 있게 실패를 감지할 수 있습니다.+# 컨테이너 헬스체크 +HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ + CMD wget -qO- http://localhost:3000/ || exit 1nginx/nginx.conf (1)
36-40: 서버 버전 노출 방지를 위한server_tokens off;권장공격 표면 축소를 위해 전역
http블록에 아래 항목을 추가해 주십시오.+ server_tokens off;.github/workflows/deploy.yml (1)
150-157: ShellCheck SC2086: 인용 누락
curl -f http://localhost:3000에 변수는 없지만, 다른 곳(docker images | grep global-nomad | tail -n +4 ...) 등에서
단어 분할 위험이 있습니다. 정적 분석 경고를 최소화하고 안전성을 높이려면
각 명령의 변수 부분을 이중 인용해 주세요.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
.dockerignore(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/deploy.yml(1 hunks)Dockerfile(1 hunks)docker-compose.yml(1 hunks)init-letsencrypt.sh(1 hunks)next.config.ts(1 hunks)nginx/conf.d/default.conf(1 hunks)nginx/nginx.conf(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/ci.yml
37-37: shellcheck reported issue in this script: SC2086:info:1:50: Double quote to prevent globbing and word splitting
(shellcheck)
.github/workflows/deploy.yml
54-54: shellcheck reported issue in this script: SC2086:info:1:51: Double quote to prevent globbing and word splitting
(shellcheck)
54-54: shellcheck reported issue in this script: SC2086:info:2:55: Double quote to prevent globbing and word splitting
(shellcheck)
84-84: shellcheck reported issue in this script: SC2086:info:1:107: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 YAMLlint (1.37.1)
.github/workflows/ci.yml
[error] 16-16: trailing spaces
(trailing-spaces)
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 59-59: no new line character at the end of file
(new-line-at-end-of-file)
.github/workflows/deploy.yml
[error] 26-26: trailing spaces
(trailing-spaces)
[error] 32-32: trailing spaces
(trailing-spaces)
[error] 37-37: trailing spaces
(trailing-spaces)
[error] 93-93: trailing spaces
(trailing-spaces)
[error] 114-114: trailing spaces
(trailing-spaces)
[error] 117-117: trailing spaces
(trailing-spaces)
[error] 121-121: trailing spaces
(trailing-spaces)
[error] 125-125: trailing spaces
(trailing-spaces)
[error] 130-130: trailing spaces
(trailing-spaces)
[error] 134-134: trailing spaces
(trailing-spaces)
[error] 138-138: trailing spaces
(trailing-spaces)
[error] 142-142: trailing spaces
(trailing-spaces)
[error] 147-147: trailing spaces
(trailing-spaces)
[error] 158-158: trailing spaces
(trailing-spaces)
[error] 165-165: trailing spaces
(trailing-spaces)
[error] 171-171: trailing spaces
(trailing-spaces)
[error] 175-175: trailing spaces
(trailing-spaces)
[error] 190-190: no new line character at the end of file
(new-line-at-end-of-file)
🪛 Shellcheck (0.10.0)
init-letsencrypt.sh
[warning] 5-5: rsa_key_size appears unused. Verify use (or export if used externally).
(SC2034)
🔇 Additional comments (10)
.dockerignore (1)
1-52: Docker 빌드 최적화를 위한 포괄적인 .dockerignore 구성이 잘 되어 있습니다.파일 구성이 체계적이고 Docker 빌드 컨텍스트 최적화를 위한 필수 항목들이 모두 포함되어 있습니다:
- 의존성 및 빌드 아티팩트 제외
- 개발/테스트 관련 파일 제외
- 환경 설정 파일 보안 제외
- 문서 및 Docker 관련 파일 제외
.github/workflows/ci.yml (1)
1-59: CI 워크플로우 구성이 잘 되어 있습니다.pnpm 캐싱을 활용한 효율적인 CI 파이프라인이 구성되어 있고, 코드 품질 검사 단계가 적절히 포함되어 있습니다.
next.config.ts (1)
4-6: Docker 배포를 위한 standalone 모드 설정이 적절합니다.standalone 모드는 Docker 컨테이너에서 Next.js 애플리케이션을 실행하는 데 최적화된 설정입니다. 필요한 파일만 포함하여 이미지 크기를 최소화할 수 있습니다.
docker-compose.yml (4)
8-8: 환경 변수 기본값이 적절히 설정되어 있습니다.GHCR 이미지를 기본값으로 하면서 환경 변수로 오버라이드 가능한 구조가 좋습니다.
28-34: SSL 인증서 볼륨 마운트 설정이 적절합니다.Nginx와 Certbot 간의 인증서 공유를 위한 볼륨 마운트가 올바르게 구성되어 있습니다.
52-54: 네트워크 구성이 보안성을 고려하여 잘 설정되어 있습니다.커스텀 브리지 네트워크를 사용하여 서비스 간 격리와 통신을 적절히 관리하고 있습니다.
39-39: Nginx 명령어의 보안 취약점을 수정해주세요.현재 명령어는 shell injection에 취약할 수 있습니다. 더 안전한 방식으로 변경하는 것을 권장합니다.
- command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"''' + command: > + /bin/sh -c " + while :; do + sleep 6h & + wait $$! + nginx -s reload + done & + nginx -g 'daemon off;' + "Likely an incorrect or invalid review comment.
init-letsencrypt.sh (3)
36-46: 임시 인증서 생성 로직이 적절합니다.Nginx 시작을 위한 임시 자체 서명 인증서 생성이 올바르게 구현되어 있습니다.
62-84: Let's Encrypt 인증서 요청 로직이 잘 구현되어 있습니다.스테이징 모드와 프로덕션 모드를 선택할 수 있는 구조가 rate limit 회피에 도움이 됩니다.
8-9: 스테이징 모드 설정이 적절합니다.테스트 단계에서 rate limit을 회피하기 위한 스테이징 모드 활용이 좋은 접근입니다.
| # SSL 인증서 경로 (Let's Encrypt) | ||
| ssl_certificate /etc/letsencrypt/live/globalnomad.site/fullchain.pem; | ||
| ssl_certificate_key /etc/letsencrypt/live/globalnomad.site/privkey.pem; | ||
|
|
||
| # SSL 설정 | ||
| ssl_protocols TLSv1.2 TLSv1.3; | ||
| ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384; | ||
| ssl_prefer_server_ciphers off; | ||
|
|
||
| # HSTS (HTTPS 강제) | ||
| add_header Strict-Transport-Security "max-age=63072000" always; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
SSL 설정이 최소화되어 있어 세션 캐시·HSTS 옵션이 부족합니다
ssl_certificate만 지정되어 있고 세션 캐시(ssl_session_cache, ssl_session_timeout)가 빠져 있어 TLS 핸드셰이크가 매번 재협상됩니다.
또한 HSTS 헤더에 includeSubDomains; preload 가 빠져 있어 하위 도메인 혹은 프리로드 등록 시 효력이 없습니다.
+ # 성능 및 보안 강화
+ ssl_session_cache shared:SSL:10m;
+ ssl_session_timeout 1h;
- add_header Strict-Transport-Security "max-age=63072000" always;
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # SSL 인증서 경로 (Let's Encrypt) | |
| ssl_certificate /etc/letsencrypt/live/globalnomad.site/fullchain.pem; | |
| ssl_certificate_key /etc/letsencrypt/live/globalnomad.site/privkey.pem; | |
| # SSL 설정 | |
| ssl_protocols TLSv1.2 TLSv1.3; | |
| ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384; | |
| ssl_prefer_server_ciphers off; | |
| # HSTS (HTTPS 강제) | |
| add_header Strict-Transport-Security "max-age=63072000" always; | |
| # SSL 인증서 경로 (Let's Encrypt) | |
| ssl_certificate /etc/letsencrypt/live/globalnomad.site/fullchain.pem; | |
| ssl_certificate_key /etc/letsencrypt/live/globalnomad.site/privkey.pem; | |
| # SSL 설정 | |
| ssl_protocols TLSv1.2 TLSv1.3; | |
| ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384; | |
| ssl_prefer_server_ciphers off; | |
| # 성능 및 보안 강화 | |
| ssl_session_cache shared:SSL:10m; | |
| ssl_session_timeout 1h; | |
| # HSTS (HTTPS 강제) | |
| add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; |
🤖 Prompt for AI Agents
In nginx/conf.d/default.conf around lines 24 to 35, the SSL configuration lacks
session cache settings and complete HSTS options. Add ssl_session_cache and
ssl_session_timeout directives to enable TLS session caching and reduce
handshake overhead. Also, update the Strict-Transport-Security header to include
includeSubDomains and preload directives to enforce HSTS on subdomains and allow
preloading.
| # Next.js로 프록시 | ||
| location / { | ||
| proxy_pass http://nextjs:3000; | ||
| proxy_http_version 1.1; | ||
| proxy_set_header Upgrade $http_upgrade; | ||
| proxy_set_header Connection '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; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
| proxy_cache_bypass $http_upgrade; | ||
|
|
||
| # 타임아웃 설정 | ||
| proxy_connect_timeout 60s; | ||
| proxy_send_timeout 60s; | ||
| proxy_read_timeout 60s; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
프록시 헤더 및 본문 크기 제한 누락
- 업그레이드-헤더는 설정했지만
proxy_set_header X-Forwarded-Host $host가 없어 원본 호스트 정보가 유실됩니다. - 기본
client_max_body_size(1 MB) 제한을 조정하지 않으면 대용량 파일 업로드 시 413 오류가 발생합니다. - WebSocket 사용 시
proxy_buffering off;를 추가하면 지연을 줄일 수 있습니다.
+ client_max_body_size 20m;
+ proxy_set_header X-Forwarded-Host $host;
+ proxy_buffering off;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Next.js로 프록시 | |
| location / { | |
| proxy_pass http://nextjs:3000; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection '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; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| proxy_cache_bypass $http_upgrade; | |
| # 타임아웃 설정 | |
| proxy_connect_timeout 60s; | |
| proxy_send_timeout 60s; | |
| proxy_read_timeout 60s; | |
| } | |
| # Next.js로 프록시 | |
| location / { | |
| proxy_pass http://nextjs:3000; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection '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; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| proxy_cache_bypass $http_upgrade; | |
| client_max_body_size 20m; | |
| proxy_set_header X-Forwarded-Host $host; | |
| proxy_buffering off; | |
| # 타임아웃 설정 | |
| proxy_connect_timeout 60s; | |
| proxy_send_timeout 60s; | |
| proxy_read_timeout 60s; | |
| } |
🤖 Prompt for AI Agents
In nginx/conf.d/default.conf around lines 36 to 52, the proxy configuration is
missing the header 'proxy_set_header X-Forwarded-Host $host' which causes loss
of original host information; add this header to preserve it. Also, increase the
'client_max_body_size' directive to allow larger request bodies and prevent 413
errors during large file uploads. Finally, add 'proxy_buffering off;' to the
location block to reduce latency for WebSocket connections.
| # 시스템 사용자 생성 | ||
| RUN addgroup --system --gid 1001 nodejs | ||
| RUN adduser --system --uid 1001 nextjs | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
사용자·그룹 ID 불일치 가능성
addgroup --system --gid 1001 nodejs 로 그룹을 만들었지만 adduser 시 그룹을 지정하지 않아
nextjs 사용자가 기본 그룹(동일 이름)으로 생성됩니다. 아래처럼 명시적으로 연결해 주세요.
-RUN addgroup --system --gid 1001 nodejs
-RUN adduser --system --uid 1001 nextjs
+RUN addgroup --system --gid 1001 nodejs \
+ && adduser --system --uid 1001 --ingroup nodejs nextjs📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # 시스템 사용자 생성 | |
| RUN addgroup --system --gid 1001 nodejs | |
| RUN adduser --system --uid 1001 nextjs | |
| # 시스템 사용자 생성 | |
| RUN addgroup --system --gid 1001 nodejs \ | |
| && adduser --system --uid 1001 --ingroup nodejs nextjs |
🤖 Prompt for AI Agents
In the Dockerfile at lines 45 to 48, the group 'nodejs' is created with GID
1001, but the user 'nextjs' is added without specifying this group, causing a
mismatch. Fix this by explicitly assigning the 'nodejs' group to the 'nextjs'
user during creation using the appropriate adduser option to link the user to
the 'nodejs' group.
| env: | ||
| IMAGE_URL: ${{ needs.build.outputs.image-url }} | ||
| GIT_SHA: ${{ needs.build.outputs.git-sha }} | ||
| run: | | ||
| ssh -i ~/.ssh/id_rsa ${{ secrets.OCI_USERNAME }}@${{ secrets.OCI_HOST }} << 'ENDSSH' | ||
| set -e | ||
|
|
||
| echo "📦 Starting deployment..." | ||
| echo "🏷️ Image: ${IMAGE_URL}" | ||
| echo "🔖 Version: ${GIT_SHA}" | ||
|
|
||
| # 프로젝트 디렉토리로 이동 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
원격 SSH 스크립트에서 IMAGE_URL, GIT_SHA 가 비어 있습니다
env: 로 설정한 변수는 로컬 셸에만 주입되며,
ssh <<'ENDSSH' 는 작은따옴표 덕분에 로컬 확장을 막아 원격 측에는 전달되지 않습니다.
결과적으로 docker pull ${IMAGE_URL} 가 빈 문자열로 실행되어 실패합니다.
다음 중 한 가지로 해결하세요.
- 여기-문을 큰따옴표로 변경하고 변수를 로컬에서 치환
- SSH
SendEnv사용 - echo/EXPORT 방식으로 값 삽입
가장 간단한 수정 예시:
- ssh -i ~/.ssh/id_rsa ${{ secrets.OCI_USERNAME }}@${{ secrets.OCI_HOST }} << 'ENDSSH'
+ ssh -i ~/.ssh/id_rsa ${{ secrets.OCI_USERNAME }}@${{ secrets.OCI_HOST }} << ENDSSH또는:
- ssh -i ~/.ssh/id_rsa ...
+ ssh -i ~/.ssh/id_rsa -o SendEnv=IMAGE_URL -o SendEnv=GIT_SHA ...📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| env: | |
| IMAGE_URL: ${{ needs.build.outputs.image-url }} | |
| GIT_SHA: ${{ needs.build.outputs.git-sha }} | |
| run: | | |
| ssh -i ~/.ssh/id_rsa ${{ secrets.OCI_USERNAME }}@${{ secrets.OCI_HOST }} << 'ENDSSH' | |
| set -e | |
| echo "📦 Starting deployment..." | |
| echo "🏷️ Image: ${IMAGE_URL}" | |
| echo "🔖 Version: ${GIT_SHA}" | |
| # 프로젝트 디렉토리로 이동 | |
| env: | |
| IMAGE_URL: ${{ needs.build.outputs.image-url }} | |
| GIT_SHA: ${{ needs.build.outputs.git-sha }} | |
| run: | | |
| - ssh -i ~/.ssh/id_rsa ${{ secrets.OCI_USERNAME }}@${{ secrets.OCI_HOST }} << 'ENDSSH' | |
| + ssh -i ~/.ssh/id_rsa ${{ secrets.OCI_USERNAME }}@${{ secrets.OCI_HOST }} << ENDSSH | |
| set -e | |
| echo "📦 Starting deployment..." | |
| echo "🏷️ Image: ${IMAGE_URL}" | |
| echo "🔖 Version: ${GIT_SHA}" | |
| # 프로젝트 디렉토리로 이동 |
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 114-114: trailing spaces
(trailing-spaces)
🤖 Prompt for AI Agents
In .github/workflows/deploy.yml around lines 104 to 115, the environment
variables IMAGE_URL and GIT_SHA set under env are not passed into the remote SSH
session because the here-document uses single quotes, preventing variable
expansion. To fix this, change the here-document delimiter from 'ENDSSH' to
ENDSSH without quotes so that the variables are expanded locally before being
sent to the remote shell. This ensures IMAGE_URL and GIT_SHA have their intended
values during the remote commands.
|
인프라 세팅 정말 수고많으셨습니다! |
BokyungCodes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
배포 자동화 환경 구축해주신 것,, 인프라에 큰 기여 해주신 점,, 정말 감사합니다!!
너무너무 고생하셨어요 💪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/ci.yml (2)
15-23: 불필요한 공백(trailing space) 정리 필요16, 22번째 줄 끝에 불필요한 공백이 감지됩니다. YAML 파싱에는 문제 없지만 린터 경고가 계속 발생하므로 삭제를 권장합니다.
또한 EOF(62번째 줄)에도 개행이 없다고 YAMLlint가 지적하니 함께 수정해 주세요.
61-62: Build 단계만 존재—테스트 실행 검토
pnpm build만 수행되고 단위/통합 테스트 단계가 없습니다. 최소한pnpm test단계 추가 여부를 검토해 주세요. CI가 빌드 성공만으로 품질을 담보하긴 어렵습니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci.yml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/ci.yml
[error] 16-16: trailing spaces
(trailing-spaces)
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
[error] 62-62: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (1)
.github/workflows/ci.yml (1)
24-28: Node.js 22 사용 여부 재검토Node 22는 아직 LTS가 아니므로, 팀・프로덕션 환경 전체가 동일 버전을 사용 중인지 확인이 필요합니다.
만약 LTS 안정성을 선호한다면node-version: '20'(현재 LTS)로 지정하거나, 매트릭스를 사용해 LTS & Current 두 버전을 모두 테스트하도록 조정해 보세요.
| - name: Lint code | ||
| # 린트오류가 발생해도 CI가 실패하지 않도록 임시 설정 - 메인 배포때 옵션 제거 예정 | ||
| continue-on-error: true | ||
| run: pnpm lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
continue-on-error: true로 린트 무력화—배포 전 해제 계획 명시 필요
린트 단계에서 오류가 나도 CI가 통과하도록 설정되어 있습니다. 임시 설정이라고 주석을 달았지만, 실제로는 쉽게 잊혀질 수 있습니다.
- 메인 브랜치 머지 전 반드시 제거하도록 이슈/티켓에 명시하거나,
if: github.ref != 'refs/heads/main'조건으로 메인에선 실패하도록 분기하는 방식을 고려해 주세요.
🤖 Prompt for AI Agents
In .github/workflows/ci.yml around lines 56 to 59, the lint step uses
continue-on-error: true which disables failure on lint errors. To ensure this
temporary setting is not forgotten before main branch deployment, either create
an explicit issue or ticket to remove this flag before merging to main, or
modify the workflow to conditionally apply continue-on-error only on non-main
branches by adding an if condition like if: github.ref != 'refs/heads/main' so
that lint errors fail the CI on main branch.
|
인프라 세팅하시느라 고생 많으셨습니다 많이 어려워보이는데 대단하십니다! |
📌 변경 사항 개요
OCI Always Free 서버에 글로벌 노마드 프로젝트를 배포하고, Docker와 GitHub Actions를 활용한 CI/CD 파이프라인을 구축했습니다.
📝 상세 내용
1. 서버 환경 구축 문서화
2. Docker 컨테이너화
3. Nginx + SSL 인프라 구축
docker-compose.yml: 3개 서비스 구성
Nginx 설정:
도메인: globalnomad.site
4. CI/CD 파이프라인
CI
CD
배포: GHCR 배포 방식
보안: PAT 사용, 불변 태그 관리
프로세스 :
롤백 지원: 이전 버전 기록 및 복구
🔗 관련 이슈
🖼️ 스크린샷(선택사항)
💡 참고 사항
[TIL-OCI 인프라 구축] #34
Summary by CodeRabbit
Summary by CodeRabbit
새로운 기능
문서화