Skip to content

Commit

Permalink
Merge pull request #147 from modern-agile-team/develop
Browse files Browse the repository at this point in the history
배포
  • Loading branch information
Contingency1 authored Sep 6, 2024
2 parents dffddb2 + 166f014 commit 7b5fb48
Show file tree
Hide file tree
Showing 270 changed files with 31,804 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Versioning and metadata
.git
.gitignore
.dockerignore
.github

# Build dependencies
dist
node_modules
coverage

# Environment (contains sensitive data)
.env
*.env*
nginx.conf

# Files not required for production
.editorconfig
Dockerfile
README.md
.eslintrc.js
nodemon.json
.prettierrc

# Prisma
prisma/seed.ts
prisma/seeding

# Test files
test
*.spec.ts
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @cyoure @jinwoo0207 @Contingency1 @hobiJeong
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Issue template
about: This is an Issue template
title: ''
labels: ''
assignees: ''

---

## 개요
- 상품 게시판 작업을 위한 상품 공통 컴포넌트 작업 및 API 연동 진행

## 작업 목록
- [ ] 메인 페이지 UI 구현
- [ ] 메인 페이지 API 연동

## 참고
- 작업하면서 참고한 레퍼런스 문서 등 추가
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## 관련 이슈

#(번호)

## 개요

> 기능에 대해 간결하게 설명
## 작업 상세 내용

- [ ] 내용1
- [ ] 내용2
- [ ] 내용3

## 참고 자료(선택)

## 하고싶은 말
30 changes: 30 additions & 0 deletions .github/workflows/dev-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CD Pipeline Dev

on:
workflow_run:
workflows: ["Docker Image CI"]
types:
- completed

jobs:
build:
runs-on: dev

steps:
- name: Delete Old docker container
run: docker rm -f ma7-back-1 || true

- name: Delete Old docker image
run: docker rmi cogeu/secret || true

- name: Login Dockerhub
env:
DOCKER_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD

- name: Pull Docker image
run: docker pull cogeu/secret:latest

- name: Run Docker Container
run: docker compose -f /home/ubuntu/MA7/docker-compose.yml up -d
26 changes: 26 additions & 0 deletions .github/workflows/dev-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Docker Image CI

on:
push:
branches: ["develop"]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Login Dockerhub
env:
DOCKER_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD

- name: Build the Docker image
run: docker build -t no-tag .

- name: taging
run: docker tag no-tag:latest cogeu/secret:latest

- name: Push to Dockerhub
run: docker push cogeu/secret:latest
28 changes: 28 additions & 0 deletions .github/workflows/main-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CD Pipeline Main

on:
push:
branches: ["main"]

jobs:
build:
runs-on: main

steps:
- name: Delete Old docker container
run: docker rm -f ma7-back-1 || true

- name: Delete Old docker image
run: docker rmi cogeu/secret || true

- name: Login Dockerhub
env:
DOCKER_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD

- name: Pull Docker image
run: docker pull cogeu/secret:latest

- name: Run Docker Container
run: docker compose -f /home/ubuntu/MA7/docker-compose.yml up -d
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# compiled output
/dist
/node_modules
/build

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# dotenv environment variable files
.env*
.env.development.local
.env.test.local
.env.production.local
.env.local

# temp directory
.temp
.tmp

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"singleQuote": false,
"trailingComma": "all",
"bracketSpacing": true,
"semi": true,
"arrowParens": "always",
"endOfLine": "lf",
"proseWrap": "preserve"
}
89 changes: 87 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,87 @@
# ModernWorld-back
모던애자일 7기 모던월드 back 레포
# Modern Agile 7 term, Main Project

## Project : Modern World

### 7기 메인프로젝트 백 저장소

---

### <span style='background-color:#ffdce0'> BACK - END </span>

#### 김준우 | Jun-woo, Kim

<a href="https://github.com/cyoure">
<img alt="Static Badge" src="https://img.shields.io/badge/Profile-%23181717?style=for-the-badge&logo=github">
</a>

#### 안진우 | Jin-woo, Ahn

<a href="https://github.com/jinwoo0207">
<img alt="Static Badge" src="https://img.shields.io/badge/Profile-%23181717?style=for-the-badge&logo=github">
</a>

#### 조영은 | Young-eun, Jo

<a href="https://github.com/Contingency1">
<img alt="Static Badge" src="https://img.shields.io/badge/Profile-%23181717?style=for-the-badge&logo=github">
</a>

### <span style='background-color:#ffdce0'> FRONT - END </span>

#### 김은우 | Eun-woo, Kim

<a href="https://github.com/dmsdnWkd1234">
<img alt="Static Badge" src="https://img.shields.io/badge/Profile-%23181717?style=for-the-badge&logo=github">
</a>

#### 김진 | Jin, Kim

<a href="https://github.com/chamjin">
<img alt="Static Badge" src="https://img.shields.io/badge/Profile-%23181717?style=for-the-badge&logo=github">
</a>

---

## Branch Strategy

**이슈 생성 시 `Assignees`, `Labels`, `Project` 꼭 할당**

### Default Branch

| Name | Description |
| ---- | ------------------------------ |
| main | repository default branch |
| dev | development environment branch |

### Branch Example

- feature/#issueNo/title

예시

- feature/#10/create_user_board

## Commit Convention

### Commit Example

**{type}/#{issue-number}: 작업한 사항(띄어쓰기 허용)**

예시

- setting/#3: project set up

### Commit Type

| Type | Description |
| -------- | ------------------------------------ |
| bugfix | 버그 수정 |
| db | 데이터베이스 관련 작업 |
| delete | 코드 삭제 |
| doc | 문서 작업 |
| feature | 새로운 기능 추가 |
| modify | 코드 수정(기능상의 수정이 있는 경우) |
| refactor | 코드 수정(기능상의 수정이 없는 경우) |
| test | 테스트코드 관련 작업 |
| deploy | 배포 관련 작업 |
| setting | 세팅 관련 작업 |
48 changes: 48 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: "3"
services:
back:
image: cogeu/secret
volumes:
- /home/ubuntu/MA7/logs:/logs
expose:
- 3000 # 컨테이너 포트만 열어줌 호스트는 X = 컨테이너 끼리만 접근 가능
env_file:
- ./.env

redis:
image: redis:7.2.5
volumes:
- /home/ubuntu/MA7/redis:/usr/local/etc/redis
env_file:
- ./.env
command: sh -c "redis-server /usr/local/etc/redis/redis.conf"
expose:
- 6379 # 컨테이너 내부 포트만 열어줌 호스트는 X
restart: always

nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- /home/ubuntu/MA7/certbot/www:/var/www/certbot
- /home/ubuntu/MA7/certbot/conf:/etc/letsencrypt
- /home/ubuntu/MA7/nginx/nginx.conf:/etc/nginx/nginx.conf:ro # 해당 경로에 conf 파일 잘 넣어 둘 것. ro는 read only
- /home/ubuntu/MA7/nginx/log:/var/log/nginx
restart: always

certbot:
depends_on:
- nginx
image: certbot/certbot:latest
volumes:
- /home/ubuntu/MA7/certbot/www:/var/www/certbot
- /home/ubuntu/MA7/certbot/conf:/etc/letsencrypt
- /home/ubuntu/MA7/certbot/log:/var/log/letsencrypt

# 실제 서비스용 인증 발급
entrypoint: "/bin/sh -c 'trap exit TERM; if [ ! -e /etc/letsencrypt/live/도메인.com/fullchain.pem ]; then certbot certonly --webroot --webroot-path=/var/www/certbot -d 도메인.com --email [email protected] --agree-tos --no-eff-email; fi; while :; do certbot renew; sleep 12h & wait $${!}; done;'"

# 테스트용 인증 발급
# entrypoint: "/bin/sh -c 'trap exit TERM; if [ ! -e /etc/letsencrypt/live/도메인.com/fullchain.pem ]; then certbot certonly --staging --webroot --webroot-path=/var/www/certbot -d 도메인.com --email [email protected] --agree-tos --no-eff-email; fi; while :; do certbot renew --staging; sleep 12h & wait $${!}; done;'"
Loading

0 comments on commit 7b5fb48

Please sign in to comment.