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

feat: 모노 레포로 변경 #402

Merged
merged 6 commits into from
Jan 27, 2025
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Essential
MONGODB_URI=mongodb://localhost:27017/dimigoin-pull-service-v3
NEXT_PUBLIC_DIMIGOIN_KEY=(CREATE KEY AT https://auth.dimigo.net/developers/add)
JWT_SECRET=(WRITE RANDOM STRING HERE)
CRON_SECRET=(WRITE RANDOM STRING HERE)

# Default
NEXT_PUBLIC_DIMIGOIN_URI=https://auth.dimigo.net
OAUTH_JWT_PUBLIC=(YOUR PUBLIC KEY)
OAUTH_JWT_SECRET=(YOUR PRIVATE KEY)
NEXT_PUBLIC_GOOGLE_CLIENT_ID=(YOUR GOOGLE CLIENT ID)

# Optional
YOUTUBE_API_KEY=

# Only for Production
JWT_SECRET=
CRON_SECRET=
TEACHERS_CODE=
26 changes: 24 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
- '**'
name: build
jobs:
build:
name: build
dipull:
name: dipull
runs-on: ubuntu-latest

strategy:
Expand All @@ -22,5 +22,27 @@ jobs:
run: |
curl -fsSL https://bun.sh/install | bash
export PATH=$HOME/.bun/bin:$PATH # Bun 설치 후 경로 설정
cd dipull
bun install
bun run build
dipull-auth:
name: dipull-auth
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.13.1]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install bun and Build Test
run: |
curl -fsSL https://bun.sh/install | bash
export PATH=$HOME/.bun/bin:$PATH # Bun 설치 후 경로 설정
cd dipull-auth
bun install
bun run build
28 changes: 25 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
- '**'
name: lint
jobs:
lint:
name: lint
dipull:
name: dipull
runs-on: ubuntu-latest

strategy:
Expand All @@ -22,5 +22,27 @@ jobs:
run: |
curl -fsSL https://bun.sh/install | bash
export PATH=$HOME/.bun/bin:$PATH # Bun 설치 후 경로 설정
cd dipull
bun install
bun run lint
bun run lint
dipull-auth:
name: dipull-auth
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.13.1]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install bun and Lint Test
run: |
curl -fsSL https://bun.sh/install | bash
export PATH=$HOME/.bun/bin:$PATH # Bun 설치 후 경로 설정
cd dipull-auth
bun install
bun run lint
38 changes: 2 additions & 36 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.env

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
.envs
/data
91 changes: 20 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="./public/public/logo_text.svg" height="50px">
<img src="./dipull/public/public/logo_text.svg" height="50px">
<p align="center"><b><i>Dipull :: 한국디지털미디어고등학교 인트라넷의 새 이름</i></b></p>
</p>

Expand All @@ -18,40 +18,7 @@

## 1) 환경 설정

### ① Node.js
`node v20.13.1`으로 개발되었습니다.
> [`nvm`](https://github.com/nvm-sh/nvm) 사용을 권장합니다.

### ② Bun
[`bun`](https://bun.sh)을 사용합니다. `v1.1.9`

### ③ Database (MongoDB)

DB로는 `MongoDB`을 사용합니다. [`설치 가이드 (공식 홈페이지)`](https://www.mongodb.com/ko-kr/docs/manual/installation/)

> `Local`에 직접 설치하지 않고 `Docker`를 사용하여 설치하는 것을 권장합니다. [`설치 가이드 (Docker)`](https://hub.docker.com/_/mongo)
> ```bash
> # MongoDB Docker 이미지 다운로드
> docker pull mongo
> # MongoDB Docker 컨테이너 실행
> docker run -d -p 27017:27017 --name mongodb mongo
> ```
> ```bash
> # MongoDB Docker 컨테이너 중지
> docker stop mongodb
> ```
>
> ```bash
> # MongoDB Docker 컨테이너 시작
>docker start mongodb
> ```
>
> ```bash
> # MongoDB Docker 컨테이너 재시작
> docker restart mongodb
> ```

### ④ VScode 확장 프로그램
### 1️⃣ VScode 확장 프로그램
VScode 실행 후, Extensions 탭에서 아래의 확장 프로그램을 설치해주세요.

> Extensions 탭에서 검색창에 `@recommended`를 입력하면 아래의 확장 프로그램을 한번에 설치할 수 있습니다.
Expand All @@ -73,7 +40,7 @@ VScode 실행 후, Extensions 탭에서 아래의 확장 프로그램을 설치
}
```

### VScode 설정
### 2️⃣ VScode 설정

VScode 실행 후, `settings.json`을 열어 아래의 설정을 추가해주세요.

Expand All @@ -90,62 +57,43 @@ VScode 실행 후, `settings.json`을 열어 아래의 설정을 추가해주세
}

```

### ⑥ 패키지 설치

개발 시작 전 아래의 명령어를 입력하여 필요한 모듈을 설치해주세요.

```bash
bun install
```

### ⑦ 환경 변수 설정
### 3️⃣ 환경 변수 설정

`.env` 파일을 생성하고 [`.env.example`](./.env.example)의 내용을 추가해주세요.

#### 필수 항목
- `MONGODB_URI` 연결할 MongoDB의 URI
- `NEXT_PUBLIC_DIMIGOIN_KEY` [디미고인 API 키](https://auth.dimigo.net/developers/add)
- `JWT_SECRET` JWT 토큰 생성 시 사용할 시크릿 키
- `CRON_SECRET` Cron 작업 시 사용할 시크릿 키
#### 자체 발급 항목 (필수)
- `OAUTH_JWT_PUBLIC` JWT 토큰 인증 시 사용할 공개 키 (RS256)
- `OAUTH_JWT_SECRET` JWT 토큰 생성 시 사용할 비밀 키 (RS256)

#### 기본 값 유지
- `NEXT_PUBLIC_DIMIGOIN_URI` 디미고인 API URI
#### 해당 사이트에서 발급 필요 (필수)
- `NEXT_PUBLIC_GOOGLE_CLIENT_ID` 구글 로그인 클라이언트 ID (GCP에서 발급)

#### 해당 기능 사용 시
#### 해당 기능 사용 시 (선택)
- `YOUTUBE_API_KEY` 기상송 검색 시 사용할 Youtube API 키 (GCP 발급)
- `TEACHERS_CODE` 구글 Sheets API 사용 시 사용할 인증 코드


### ⑧ DB 초기화

```bash
bun db_init
```
위 명령어를 입력하여 DB를 초기화해주세요.



# 3. 개발

## 1) 개발 서버 실행
## 1) Develop 서버 실행

개발을 시작하기 전에 아래의 명령어를 입력하여 개발 서버를 실행해주세요.

```bash
bun dev
docker compose up
```

개발 서버가 실행되면 [http://localhost:3000](http://localhost:3000)에서 결과를 확인할 수 있습니다.
개발 서버가 실행되면 [http://localhost:3000](http://localhost:3000)에서 `Dipull`의 로컬 개발 서버를, [http://localhost:3001](http://localhost:3001)에서 `Dipull Auth`의 로컬 개발 서버를 확인할 수 있습니다.

`dipull/src/`과 `dipull-auth/src` 폴더 안의 소스코드를 수정하여 페이지를 수정할 수 있습니다.

`src/` 폴더 안의 소스코드를 수정하여 페이지를 수정할 수 있습니다. 파일을 수정할 때마다 페이지가 자동으로 업데이트됩니다.
파일을 수정할 때마다 페이지가 자동으로 업데이트됩니다.

## 2) 빌드
## 2) Production 서버 실행

아래의 명령어를 입력하여 프로젝트를 빌드할 수 있습니다.
아래의 명령어를 입력하여 프로젝트를 빌드 및 실행 할 수 있습니다.

```bash
bun build
docker compose -f docker-compose.prd.yml up
```

## 3) 배포
Expand All @@ -155,3 +103,4 @@ Github의 `Main` 브랜치에 `Merge`하면 `Vercel`을 통해 자동으로 배
여러분들은 권한이 없기 때문에 `Main` 브랜치에 `Push` 및 배포를 직접 할 수 없습니다.

또한 `Main` 브랜치에 직접 `Push`하지 않고 `Github Pull Request`를 통해 `Merge`를 요청해주세요.

8 changes: 8 additions & 0 deletions dipull-auth/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
MONGODB_URI=mongodb://localhost:27017/dimigoin-oauth
JWT_SECRET=(WRITE RANDOM STRING HERE)

OAUTH_JWT_PUBLIC=(YOUR PUBLIC KEY)
OAUTH_JWT_SECRET=(YOUR PRIVATE KEY)

NEXT_PUBLIC_DIMIGOIN_KEY=661f3ae926aa65d7d37f4dbd
NEXT_PUBLIC_GOOGLE_CLIENT_ID=(YOUR GOOGLE CLIENT ID)
59 changes: 59 additions & 0 deletions dipull-auth/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"extends": [
"next/core-web-vitals",
"eslint:recommended",
"plugin:react/recommended"
],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react",
"import",
"react-hooks"
],
"rules": {
"object-curly-spacing": ["error", "always"],
"react/prop-types": "off",
"react/display-name": "off",
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"react-native/no-inline-styles": "off",
"react-hooks/exhaustive-deps": "off",
"no-unused-vars": "off",
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always"
}
]
}
}
37 changes: 37 additions & 0 deletions dipull-auth/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.env

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
File renamed without changes.
File renamed without changes.
Loading
Loading