-
Notifications
You must be signed in to change notification settings - Fork 7
[천수] sprint11 #86
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
Merged
The head ref may contain hidden characters: "\uCC9C\uC218-sprint11"
Merged
[천수] sprint11 #86
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a6604fb
refactor(image): Change env variable ENV to NODE_ENV
Seracine 37cbede
feat(docker): Add docker related files
Seracine 031dcb8
feat(ci/cd): Add ci.yml
Seracine ffdbe6a
fix(ci/cd) Add CI branch
Seracine acff147
fix(ci/cd): Fix indent
Seracine a57c990
fix(ci/cd): Fix test command
Seracine 1cdfb96
fix(ci/cd): Divide github action condition
Seracine 9279a2b
feat(ci/cd: Add AWS_Deploy cd
Seracine 70953ef
docs(README.md): Add sprint11 info
Seracine 80c83ef
docs(README.md): Update sprint11 info
Seracine 60becbc
feat(ci/cd): Add pr branch on ci
Seracine 818ddea
refactor(ci/cd): Change secret to hardcode on ci
Seracine 30bdc0c
refactor(ci/cd): Remove ci on push condition
Seracine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Dependencies | ||
| node_modules | ||
|
|
||
| # Environment | ||
| .env | ||
| .env.test | ||
|
|
||
| /generated/prisma | ||
| uploads/ | ||
| .dest | ||
| coverage | ||
|
|
||
| # sprint sub | ||
| infra | ||
| http | ||
|
|
||
| # Docker | ||
| Dockerfile | ||
| .dockerignore | ||
| docker-compose.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: cd | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| AWS_deploy: | ||
| runs-on: ubuntu-latest | ||
| environment: AWS_Deploy | ||
| steps: | ||
| # EC2 배포 | ||
| - name: Deploy to EC2 | ||
| uses: appleboy/ssh-action@v1.2.2 | ||
| with: | ||
| host: ${{ secrets.EC2_HOST }} | ||
| username: ${{ secrets.EC2_USER }} | ||
| key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
| port: 22 | ||
| script: | | ||
| cd ~/3-sprint-mission # EC2 인스턴스 내 프로젝트 경로로 진입 | ||
| git pull origin main # 코드 최신화 | ||
| npm install | ||
| npm run build # ts -> js | ||
| npm run prisma:migrate # Prisma 마이그레이션 | ||
| pm2 restart codeit-sprint10 # 이전 스프린트10때 프로세스 이름을 codeit-sprint10으로 설정했음 | ||
| echo "✅ Deployment successful!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: ci | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main, 천수] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| DATABASE_URL: postgresql://postgres:test_password@localhost:5432/test_db?schema=public | ||
| JWT_SECRET: test_secret | ||
| PORT: 3000 | ||
| NODE_ENV: develop #production만 아니면 로직은 동일 | ||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres | ||
| env: | ||
| POSTGRES_PASSWORD: test_password | ||
| POSTGRES_DB: test_db | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| ports: | ||
| - 5432:5432 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v5 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Type Check | ||
| run: npx tsc --noEmit | ||
|
|
||
| - name: Prisma migrate | ||
| run: npm run prisma:migrate | ||
|
|
||
| - name: Run Tests | ||
| run: npm run jest:test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # node js 환경 준비 | ||
| FROM node:22.16.0 | ||
|
|
||
| # 소스코드 다운로드 | ||
| COPY . /panda-market | ||
|
|
||
| # 소스코드 디렉토리 이동 | ||
| WORKDIR /panda-market | ||
|
|
||
| # 의존성 패키지 설치 (npm ci) | ||
| RUN npm ci | ||
|
|
||
| # 소스코드 빌드 | ||
| RUN npm run build | ||
|
|
||
| # 환경 변수 정의 | ||
| ENV PORT=3000 | ||
| ENV NODE_ENV='develop' | ||
|
|
||
| # 서버 실행 | ||
| CMD sh -c "npm run prisma:migrate && npm run start" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: panda-market | ||
| services: | ||
| panda-market-app: | ||
| image: seracine/panda-market-app:1.0.0 | ||
| restart: always # 에러 발생시 재시작 | ||
| build: | ||
| tags: | ||
| - seracine/panda-market-app:1.0.0 | ||
| - seracine/panda-market-app:latest | ||
| dockerfile: Dockerfile | ||
| pull: true | ||
| context: . | ||
| container_name: panda-market-app | ||
| ports: | ||
| - "3000:3000" | ||
| networks: | ||
| - panda-network | ||
| volumes: | ||
| - panda-app-volume:/panda-market/uploads | ||
| env_file: # env 파일로 환경변수 주입 | ||
| - .env | ||
| depends_on: | ||
| panda-market-postgres-db: | ||
| condition: service_healthy | ||
| panda-market-postgres-db: | ||
| image: postgres | ||
| restart: always # 에러 발생시 재시작 | ||
| container_name: panda-market-postgres | ||
| volumes: | ||
| - panda-db-volume:/var/lib/postgresql/data | ||
| networks: | ||
| - panda-network | ||
| environment: # 환경변수 파라미터 직접 전달 | ||
| - POSTGRES_PASSWORD=1234 | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
| interval: 1m30s | ||
| timeout: 30s | ||
| retries: 5 | ||
| start_period: 30s | ||
|
|
||
| networks: | ||
| panda-network: | ||
| name: panda-network | ||
|
|
||
| volumes: | ||
| panda-app-volume: | ||
| name: panda-app-volume | ||
| panda-db-volume: | ||
| name: panda-db-volume |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
db host 도 환경변수로 처리하는 것이 안전합니다!
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.
여기 있는 모든 민감한 정보들은 환경변수로 처리하시는게 좋을 것 같습니다.
db host, jwt_secret db_password 등