Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
git## 요구사항

### 인증
### 인증
- [x] User 스키마를 작성해 주세요.
- [x] id, email, nickname, image, password, createdAt, updatedAt 필드를 가집니다.
- [x] 회원가입 API를 만들어 주세요.
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test
on:
pull_request:
#branches: ["main", "develop"]
branches: ["**"]

jobs:
typecheck:
runs-on: ubuntu-latest

steps:
- name: 소스코드 받아오기
uses: actions/checkout@v4

- name: Node.js 설정하기
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: 의존성 설치
run: npm install

- name: Prisma 준비하기
run: npx prisma generate

- name: 타입체크
run: npx tsc --noEmit
test:
needs: typecheck
runs-on: ubuntu-latest
steps:
- name: 소스코드 받아오기
uses: actions/checkout@v4

- name: Node.js 설정하기
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: 의존성 설치
run: npm install

- name: Prisma 준비하기
run: npx prisma generate

- name: 테스트 실행하기
run: npm test
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:24-alpine AS builder

WORKDIR /build
COPY . .

RUN npm install
RUN npx prisma generate
RUN npm run build

EXPOSE 3000

ENTRYPOINT ["npm", "start"]
26 changes: 26 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: panda-market

services:
db:
image: postgres:latest
container_name: panda-market-db
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: panda-market
ports:
- "5432:5432"
volumes:
- panda-market-db/var/lib/postgresql
app:
build: .
container_name: panda-market-app
environment:
- DATABASE_URL=postgresql://postgres:postgres@localhost:5432/panda-market
- JWT_ACCESS_TOKEN_SECRET=your-secret-key
- JWT_REFRESH_TOKEN_SECRET=your-refresh-secret-key
volumes:
- ./public:/app/public

volumes:
panda-market-db:
Binary file added images/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions infra/ec2/ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
apps: [
{
name: 'spirnt-mission-server', // 프로세스 이름
script: './src/server.ts', // 실행 파일 경로
interpreter: 'bun', // 사용할 런타임
watch: false, // 파일 변경 시 자동 재시작 여부
env: {
// 환경 변수 설정
NODE_ENV: 'production',
PORT: 3000,
},
},
],
};
24 changes: 24 additions & 0 deletions infra/ec2/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
server {
listen 80;
listen [::]:80;


server_name _;

location / {
# 80번 포트로 들어온 요청을 내부의 3000번 포트(Bun/Express)로 전달
proxy_pass http://localhost:3000;

# 리버스 프록시를 위한 필수 헤더 설정
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

# 실제 클라이언트 IP를 백엔드 서버에 전달
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;
}
}
Binary file added infra/ec2/secure-group-inbound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added infra/ec2/secure-group-outbound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions infra/ec2/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 패키지 목록 업데이트 및 unzip 설치
sudo apt update
sudo apt install unzip -y

# Bun 런타임 설치
curl -fsSL https://bun.sh/install | bash

# 환경 변수 즉시 적용
source ~/.bashrc

# PM2 전역 설치
npm install pm2 -g

# 프로젝트 폴더로 이동 (사용자 환경에 맞게 수정)
cd ~/7-sprint-mission/src

# Bun을 사용하여 서버 실행
pm2 start server.ts --interpreter bun --name "spirnt-mission-server"

# 실행 상태 및 실시간 로그 확인
pm2 list
pm2 logs mission-server

# 서버 재부팅 시 PM2 자동 시작 설정 (출력되는 sudo 명령어를 반드시 실행해야 함)
pm2 startup

# 현재 실행 중인 프로세스 목록을 '부팅 시 실행 목록'에 저장
pm2 save
Binary file added infra/rds/secure-group-inbound.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added infra/rds/secure-group-outbound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added infra/s3/policy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading