From f3540af646e3fa448f7ceafb66e452823b686820 Mon Sep 17 00:00:00 2001 From: hou27 Date: Wed, 26 Oct 2022 21:58:41 +0900 Subject: [PATCH 01/29] =?UTF-8?q?docs:=20Release=20=EB=82=B4=EC=9A=A9=20?= =?UTF-8?q?=EA=B0=84=EB=8B=A8=ED=95=98=EA=B2=8C=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 54 +++++++++++++----------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index fd6f377..06a09a3 100644 --- a/README.md +++ b/README.md @@ -2,56 +2,28 @@ ## Description -> Quickchive 서비스의 Backend Repository입니다. +> [Quickchive](https://quickchive.swygbro.com/)
-

- Nest Logo -

-[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest +# v0.1.0 -

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License +## Added -## Installation +- 기본적인 유저 관리 기능 +- 구글, 카카오 로그인 +- content 추가, 수정, 삭제 기능 +- content 메모 및 읽을 기한 +- collection 추가, 수정, 삭제 기능 +- etc... -```bash -$ npm install -``` +## Changed -## Running the app +> first release -```bash -# development -$ npm run start +## Removed -# watch mode -$ npm run start:dev - -# production mode -$ npm run start:prod -``` - -## Test - -```bash -# unit tests -$ npm run test - -# e2e tests -$ npm run test:e2e - -# test coverage -$ npm run test:cov -``` - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). +> first release ## License From dbd01508feb6433f008764aa51527a3ac63fe01a Mon Sep 17 00:00:00 2001 From: hou27 Date: Mon, 14 Nov 2022 13:52:40 +0900 Subject: [PATCH 02/29] docs: 0.1.0 release note update - #128 --- README.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 06a09a3..f51c734 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,34 @@ ## Added -- 기본적인 유저 관리 기능 -- 구글, 카카오 로그인 -- content 추가, 수정, 삭제 기능 -- content 메모 및 읽을 기한 -- collection 추가, 수정, 삭제 기능 -- etc... +> MVP + +1. User + +- 로그인: OAuth(구글로그인, 카카오로그인), 이메일 로그인(자체 로그인 기능) +- 자동로그인 정책: 한달 동안 접속하지 않아도 로그인 유지 - refresh token 활용(만료 기간 한달) +- 회원가입(이메일 인증방식) + - 회원가입 시 받는 정보: 이메일(메일로 인증필수), 닉네임(2-8자 이내), 비밀번호(8자 이상 문자, 숫자) +- 닉네임 수정 +- 비밀번호 재설정 +- 로그아웃 +- 회원 탈퇴 + +2. Content + +- 저장: 콘텐츠 이름, \*URL, 메모, 카테고리, 즐겨찾기, 읽을 기한 +- 삭제 +- 수정: 콘텐츠 이름, 메모, 카테고리, 즐겨찾기, 읽을 기한 + +3. Collection + +- 저장: *콜렉션 이름, 콜렉션 설명, *URL, 카테고리, 즐겨찾기 +- 삭제 +- 수정: 콘텐츠 이름, URL(추가, 삭제, 순서 변경), 카테고리, 읽을 기한 + +4. 알림 + +- 읽을 기한 알림: 매일 08:00 KST에 읽을 기한 만료된 콘텐츠에 대한 메일 알림 전송 ## Changed @@ -28,3 +50,67 @@ ## License Nest is [MIT licensed](LICENSE). + +# API 구조 + +### User API + +| URL | method | Usage | Authorization Needed | +| --------------------------- | ------ | -------------------- | -------------------- | +| /api/users/edit | POST | 프로필 수정 | O | +| /api/users/reset-password | POST | 비밀번호 재생성 | X | +| /api/users/me | GET | 프로필 조회 | O | +| /api/users/load-contents | GET | 유저의 콘텐츠 조회 | O | +| /api/users/load-favorites | GET | 유저의 즐겨찾기 조회 | O | +| /api/users/load-collections | GET | 유저의 콜렉션 조회 | O | +| /api/users/load-categories | GET | 유저의 카테고리 조회 | O | + +### Auth API + +| URL | method | Usage | Authorization Needed | +| ------------------------------------------------- | ------ | -------------------------------- | -------------------- | +| /api/auth/register | POST | 회원가입 | X | +| /api/auth/login | POST | 이메일 로그인 | X | +| /api/auth/logout | POST | 로그아웃 | O | +| /api/auth/reissue | POST | 토큰 재발행 | X | +| /api/auth/send-verify-email/\ | GET | 유저 인증을 위한 메일 전송 | X | +| /api/auth/send-password-reset-email/\ | GET | 비밀번호 재설정을 위한 메일 전송 | X | +| /api/auth/verify-email | GET | 이메일 인증 | X | + +### OAuth API + +| URL | method | Usage | Authorization Needed | +| ----------------------- | ------ | ----------------------- | -------------------- | +| /api/oauth/kakao-auth | GET | 카카오 계정 로그인 요청 | X | +| /api/oauth/kakao-login | GET | 카카오 로그인 | X | +| /api/oauth/google-auth | GET | 구글 계정 로그인 요청 | X | +| /api/oauth/google-login | GET | 구글 로그인 | X | + +### Content API + +| URL | method | Usage | Authorization Needed | +| ---------------------------------------- | ------ | --------------------- | -------------------- | +| /api/contents/add | POST | 콘텐츠 추가 | O | +| /api/contents/addMultiple | POST | 다수의 콘텐츠 추가 | O | +| /api/contents/update | POST | 콘텐츠 정보 수정 | O | +| /api/contents/favorite/\ | PATCH | 즐겨찾기 등록 및 해제 | O | +| /api/contents/read/\ | PATCH | 읽었음 표시 | O | +| /api/contents/delete/\ | DELETE | 콘텐츠 삭제 | O | +| /api/contents/summarize/\ | GET | 콘텐츠 문서 요약 | O | + +### Category API + +| URL | method | Usage | Authorization Needed | +| -------------------------------------- | ------ | ------------- | -------------------- | +| /api/category/add | POST | 카테고리 추가 | O | +| /api/category/update | POST | 카테고리 수정 | O | +| /api/category/delete/\ | DELETE | 카테고리 삭제 | O | + +### Collection API + +| URL | method | Usage | Authorization Needed | +| --------------------------------------------- | ------ | --------------------- | -------------------- | +| /api/collections/add | POST | 콜렉션 추가 | O | +| /api/collections/update | POST | 콜렉션 수정 | O | +| /api/collections/favorite/\ | PATCH | 즐겨찾기 등록 및 해제 | O | +| /api/collections/delete | DELETE | 콜렉션 삭제 | O | From d78ca18d567d15da510f3f1adde33fcffc2bfef9 Mon Sep 17 00:00:00 2001 From: hou27 Date: Mon, 14 Nov 2022 17:58:04 +0900 Subject: [PATCH 03/29] =?UTF-8?q?refactor:=20oauth=20method=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20refactoring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OAuth 과정에서 불필요한 코드 개선하여 refactoring --- src/auth/auth.service.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index f163c92..9766fb2 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -480,7 +480,6 @@ export class OauthService { }); // control user - let createAccountResult = null; if (!userInDb) { const name = userInfo.properties.nickname; const password = CryptoJS.SHA256( @@ -491,8 +490,7 @@ export class OauthService { email, password, }); - createAccountResult = user; - if (createAccountResult) { + if (user) { return await this.oauthLogin(email); } } else if (userInDb) { @@ -516,7 +514,6 @@ export class OauthService { }); // control user - let createAccountResult = null; if (!userInDb) { const password = CryptoJS.SHA256( email + process.env.GOOGLE_CLIENT_ID, @@ -526,11 +523,11 @@ export class OauthService { email, password, }); - createAccountResult = user; + if (user) { + return await this.oauthLogin(email); + } } else if (userInDb) { return await this.oauthLogin(userInDb.email); - } else if (createAccountResult) { - return await this.oauthLogin(email); } else { throw new BadRequestException("Couldn't log in with Google"); } From e36349195108d2efbd4e9470ab5c9322bff21155 Mon Sep 17 00:00:00 2001 From: hou27 Date: Mon, 14 Nov 2022 18:03:34 +0900 Subject: [PATCH 04/29] =?UTF-8?q?chore:=20=EC=83=88=EB=A1=9C=EC=9A=B4=20?= =?UTF-8?q?=EB=B8=8C=EB=9E=9C=EC=B9=98=20=EC=A0=84=EB=9E=B5=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=9D=BC=20workflow=20file=20=EC=88=98=EC=A0=95=20-?= =?UTF-8?q?=20#128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이제 master 브랜치에 병합 시 자동 ci cd 동작하도록 변경함 --- .github/workflows/ci-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 4539908..c96bfd1 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -2,7 +2,7 @@ name: Docker Image CI && Deploy to EC2 on: push: - branches: ['develop'] + branches: ['master'] # pull_request: # branches: ['develop'] From abf1cad28df5bfc8a34fa89da1f112d3276501a3 Mon Sep 17 00:00:00 2001 From: hou27 Date: Mon, 14 Nov 2022 18:31:25 +0900 Subject: [PATCH 05/29] =?UTF-8?q?improve:=20content,=20collection=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20api=20=EC=8A=A4=ED=8E=99=20=ED=86=B5?= =?UTF-8?q?=EC=9D=BC=20-=20#128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 특정 resource를 식별하여 삭제하는 것이므로 path variable을 통해 삭제할 resource의 id를 전달받도록 통일 --- src/collections/collections.controller.ts | 5 ++--- src/contents/contents.controller.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/collections/collections.controller.ts b/src/collections/collections.controller.ts index fd64742..67fb57b 100644 --- a/src/collections/collections.controller.ts +++ b/src/collections/collections.controller.ts @@ -6,7 +6,6 @@ import { ParseIntPipe, Patch, Post, - Query, UseGuards, UseInterceptors, } from '@nestjs/common'; @@ -139,11 +138,11 @@ export class CollectionsController { @ApiNotFoundResponse({ description: '콜렉션 또는 유저가 존재하지 않는다.', }) - @Delete('delete') + @Delete('delete/:collectionId') @UseInterceptors(TransactionInterceptor) async deleteCollection( @AuthUser() user: User, - @Query('collectionId', ParseIntPipe) collectionId: number, + @Param('collectionId', new ParseIntPipe()) collectionId: number, @TransactionManager() queryRunnerManager: EntityManager, ): Promise { return await this.collectionsService.deleteCollection( diff --git a/src/contents/contents.controller.ts b/src/contents/contents.controller.ts index e5c5313..0090d30 100644 --- a/src/contents/contents.controller.ts +++ b/src/contents/contents.controller.ts @@ -177,7 +177,7 @@ export class ContentsController { } @ApiOperation({ - summary: '콘텐츠 정보 삭제', + summary: '콘텐츠 삭제', description: '콘텐츠을 삭제하는 메서드', }) @ApiOkResponse({ From 0733c45492a66f039341a37f4c4efe67c5490a95 Mon Sep 17 00:00:00 2001 From: hou27 Date: Tue, 15 Nov 2022 14:48:19 +0900 Subject: [PATCH 06/29] =?UTF-8?q?improve:=20error=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit catch 문에서 객체를 재생성해서 던지던 코드를 바로 catch한 error를 던지도록 수정함 --- src/auth/auth.service.ts | 19 ++++++++----------- src/collections/collections.service.ts | 10 +++++----- src/contents/contents.service.ts | 24 +++++++++++------------- src/mail/mail.service.ts | 3 +-- src/users/users.service.ts | 12 ++++++------ 5 files changed, 31 insertions(+), 37 deletions(-) diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 9766fb2..be82b9e 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -84,7 +84,7 @@ export class AuthService { refresh_token: refreshToken, }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -108,8 +108,7 @@ export class AuthService { throw new NotFoundException('User is not verified'); } } catch (e) { - console.log(e); - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -292,7 +291,7 @@ export class AuthService { throw new BadRequestException('Wrong Password'); } } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } } @@ -340,7 +339,7 @@ export class OauthService { return { access_token }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -365,7 +364,7 @@ export class OauthService { return { userInfo }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -414,7 +413,7 @@ export class OauthService { }); return { url: responseUrl }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -499,8 +498,7 @@ export class OauthService { throw new BadRequestException("Couldn't log in with Kakao"); } } catch (e) { - console.log(e); - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -532,8 +530,7 @@ export class OauthService { throw new BadRequestException("Couldn't log in with Google"); } } catch (e) { - console.log(e); - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } } diff --git a/src/collections/collections.service.ts b/src/collections/collections.service.ts index 7a1a349..146a558 100644 --- a/src/collections/collections.service.ts +++ b/src/collections/collections.service.ts @@ -104,7 +104,7 @@ export class CollectionsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -215,7 +215,7 @@ export class CollectionsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -239,7 +239,7 @@ export class CollectionsService { return { nestedContent: newNestedContent }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -272,7 +272,7 @@ export class CollectionsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -305,7 +305,7 @@ export class CollectionsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } } diff --git a/src/contents/contents.service.ts b/src/contents/contents.service.ts index 06369cf..674cc23 100644 --- a/src/contents/contents.service.ts +++ b/src/contents/contents.service.ts @@ -77,7 +77,6 @@ export class ContentsService { description, coverImg, } = await this.getLinkInfo(link); - console.log(linkTitle); title = title ? title : linkTitle; // Get or create category @@ -116,7 +115,7 @@ export class ContentsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -165,7 +164,7 @@ export class ContentsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -244,7 +243,7 @@ export class ContentsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -277,7 +276,7 @@ export class ContentsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -310,7 +309,7 @@ export class ContentsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -344,7 +343,7 @@ export class ContentsService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -454,7 +453,7 @@ export class ContentsService { return { summary }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -484,8 +483,7 @@ export class ContentsService { return { summary }; } catch (e) { - // console.log(e); - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } } @@ -525,7 +523,7 @@ export class CategoryService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -584,7 +582,7 @@ export class CategoryService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -628,7 +626,7 @@ export class CategoryService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } } diff --git a/src/mail/mail.service.ts b/src/mail/mail.service.ts index 1d2188a..fd55547 100644 --- a/src/mail/mail.service.ts +++ b/src/mail/mail.service.ts @@ -35,8 +35,7 @@ export class MailService { }, ); return true; - } catch (error) { - console.log(error); + } catch (e) { return false; } } diff --git a/src/users/users.service.ts b/src/users/users.service.ts index a909a31..3aaa270 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -57,7 +57,7 @@ export class UsersService { return; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -86,7 +86,7 @@ export class UsersService { throw new NotFoundException('Reset Code not found'); } } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -113,7 +113,7 @@ export class UsersService { contents, }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -145,7 +145,7 @@ export class UsersService { favorite_collections: favoriteCollections, }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -173,7 +173,7 @@ export class UsersService { collections, }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } @@ -192,7 +192,7 @@ export class UsersService { categories, }; } catch (e) { - throw new HttpException(e.message, e.status ? e.status : 500); + throw e; } } } From e1057c52509835e691ab7e9138a91bf5d626f70c Mon Sep 17 00:00:00 2001 From: hou27 Date: Tue, 15 Nov 2022 14:57:25 +0900 Subject: [PATCH 07/29] docs: Update 0.1.0 release note MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit collection delete api 스펙 변경사항 반영 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f51c734..1fae5c0 100644 --- a/README.md +++ b/README.md @@ -113,4 +113,4 @@ Nest is [MIT licensed](LICENSE). | /api/collections/add | POST | 콜렉션 추가 | O | | /api/collections/update | POST | 콜렉션 수정 | O | | /api/collections/favorite/\ | PATCH | 즐겨찾기 등록 및 해제 | O | -| /api/collections/delete | DELETE | 콜렉션 삭제 | O | +| /api/collections/delete/\ | DELETE | 콜렉션 삭제 | O | From c82db7540ceeec2c52d756ffacb2de35d88317fa Mon Sep 17 00:00:00 2001 From: hou27 Date: Tue, 15 Nov 2022 21:29:21 +0900 Subject: [PATCH 08/29] chore: Update package info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit package.json, package-lock.json 정보 업데이트 --- package-lock.json | 8 ++++---- package.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index fd4082f..f47ffee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "bookmark-demo", - "version": "0.0.1", + "name": "quickchive", + "version": "0.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "bookmark-demo", - "version": "0.0.1", + "name": "quickchive", + "version": "0.1.0", "license": "UNLICENSED", "dependencies": { "@nestjs/common": "^9.0.3", diff --git a/package.json b/package.json index ac2bf3c..9b327a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "bookmark-demo", - "version": "0.0.1", + "name": "quickchive", + "version": "0.1.0", "description": "", "author": "hou27", "private": true, From 1e4175ece0efd5eabbde5ee6ead6a9e0bb41ced1 Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 17 Nov 2022 22:57:11 +0900 Subject: [PATCH 09/29] =?UTF-8?q?chore:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EC=B6=94=EA=B0=80=20=EA=B5=AC=EC=B6=95?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EA=B5=AC=EC=84=B1=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docker-compose.yml에서 api server 분리 release branch에 test server를 위한 새로운 ci cd 구축 --- .github/workflows/ci-cd-for-test.yml | 42 ++++++++++++++++++++++++++++ Wiki/Docker-Compose.md | 42 ++++++++++++++++++++++++++++ Wiki/Server_Configuration.md | 9 ++++++ docker-compose.yml | 13 --------- 4 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/ci-cd-for-test.yml create mode 100644 Wiki/Server_Configuration.md diff --git a/.github/workflows/ci-cd-for-test.yml b/.github/workflows/ci-cd-for-test.yml new file mode 100644 index 0000000..2c45d3d --- /dev/null +++ b/.github/workflows/ci-cd-for-test.yml @@ -0,0 +1,42 @@ +name: Docker Image CI && Deploy to EC2 for Test Server + +on: + push: + branches: ['release/**'] + +jobs: + job1: + name: Docker Image CI + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Login to DockerHub + uses: docker/login-action@v2.0.0 + with: + username: ${{secrets.DOCKERHUB_USERNAME}} + password: ${{secrets.DOCKERHUB_TOKEN}} + + - name: Build and push Docker images + uses: docker/build-push-action@v3.1.1 + with: + context: . + tags: hou27/test_quickchive_backend:latest + # build on feature branches, push only on release/** branch + push: ${{ github.ref == 'refs/heads/release/**' }} + job2: + needs: job1 + name: Deploy to EC2 + runs-on: quickchive-server + + steps: + - name: executing remote ssh commands using password + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ubuntu + key: ${{ secrets.KEY_PAIR }} + script: | + sh /home/ubuntu/actions-runner/deploy_test_server.sh diff --git a/Wiki/Docker-Compose.md b/Wiki/Docker-Compose.md index 2c2fc16..1bad631 100644 --- a/Wiki/Docker-Compose.md +++ b/Wiki/Docker-Compose.md @@ -43,3 +43,45 @@ networks: ``` > api + redis + postgresql + +
+ +### 배포 서버와 테스트 서버를 하나의 ec2 내에 구축한 후의 docker-compose 파일 + +- api server를 제외한 나머지 둘만 올리도록 함. + +```yaml +version: '2' + +services: + redis: # Name of container + image: redis:latest + restart: always + ports: + - 6379:6379 + networks: + - shared-network + postgres: # Name of container + image: postgres:alpine + restart: always + env_file: + - .env.prod + environment: + POSTGRES_HOST_AUTH_METHOD: 'trust' + ports: + - 5432:5432 + networks: + - shared-network +networks: + shared-network: + driver: bridge +``` + +api server를 이 docker compose 파일로 올린 redis, postgreSQL 서버와 연결하기 위해선 +실행 시 network에 연결해주어야 한다. + +ex) + +```sh +docker run --name test-api-server -p 3000:4000 --network [docker compose 파일로 생성된 네트워크] --env-file .env.prod hou27/quickchive_backend +``` diff --git a/Wiki/Server_Configuration.md b/Wiki/Server_Configuration.md new file mode 100644 index 0000000..f9f1725 --- /dev/null +++ b/Wiki/Server_Configuration.md @@ -0,0 +1,9 @@ +# Server Configuration + +## 기존 서버 구성 + +![image](https://user-images.githubusercontent.com/65845941/202455511-9dac5228-037a-4405-aa2a-d2cadf354b94.png) + +## 변경 후 + +![image](https://user-images.githubusercontent.com/65845941/202456944-f6738edd-c5da-4546-9a33-44f1c941e2fb.png) diff --git a/docker-compose.yml b/docker-compose.yml index 454b5eb..9470968 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,19 +19,6 @@ services: - 5432:5432 networks: - shared-network - api: - image: hou27/quickchive_backend:latest - networks: - - shared-network - env_file: - - .env.prod - ports: - - 80:4000 - depends_on: - - redis - - postgres - environment: - TZ: 'Asia/Seoul' networks: shared-network: driver: bridge From cc5025cfe68cbe1d550dd6bf7c9433e66662b8bf Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 17 Nov 2022 23:12:55 +0900 Subject: [PATCH 10/29] chore: Update docker push option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit github action docker build and push의 push option을 true로 설정 --- .github/workflows/ci-cd-for-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd-for-test.yml b/.github/workflows/ci-cd-for-test.yml index 2c45d3d..6366565 100644 --- a/.github/workflows/ci-cd-for-test.yml +++ b/.github/workflows/ci-cd-for-test.yml @@ -24,8 +24,7 @@ jobs: with: context: . tags: hou27/test_quickchive_backend:latest - # build on feature branches, push only on release/** branch - push: ${{ github.ref == 'refs/heads/release/**' }} + push: true job2: needs: job1 name: Deploy to EC2 From a9b8afcc21f2195b4e4ba8bc934892ed1464cfc1 Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 17 Nov 2022 23:32:19 +0900 Subject: [PATCH 11/29] docs: Update wiki - #129 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 새로 세팅한 shell script와 github action용 workflow 파일에 관한 설명 업데이트 --- Wiki/CI_CD.md | 63 ++++++++++++++++++++++++++++++++++++++++-- Wiki/Docker-Compose.md | 2 +- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/Wiki/CI_CD.md b/Wiki/CI_CD.md index 669b6cd..f9777ba 100644 --- a/Wiki/CI_CD.md +++ b/Wiki/CI_CD.md @@ -59,16 +59,17 @@ steps: > ec2 인스턴스 내에 스크립트 파일 생성 > 이전 버전의 docker container와 docker image를 삭제한 후 docker hub에 job1을 통해 업로드한 image를 pull하여 -> 해당 이미지를 사용하여 다시 ec2 인스턴스에서 docker compose 컨테이너를 실성 및 실행한다. +> 해당 이미지를 사용하여 다시 ec2 인스턴스에서 docker 컨테이너를 생성 및 실행한다. ```sh # !/bin/bash docker ps -a | grep quickchive_backend:latest | awk '{print$1}' | xargs -t -I % docker rm -f % && docker image ls | grep quickchive | awk '{print$3}' | xargs -I % docker rmi % -cd ~ubuntu && docker-compose up -d +docker pull hou27/quickchive_backend +cd ~ubuntu && docker run -d --name api-server -p 80:4000 --network ubuntu_shared-network --env-file .env.prod hou27/quickchive_backend ``` - 기존 컨테이너 삭제, 이미지 삭제 후 - docker-compose up 실행 + docker container 실행 # 전체 github action workflow를 정의한 파일 @@ -118,3 +119,59 @@ jobs: script: | sh /home/ubuntu/actions-runner/deploy.sh ``` + +## ci-cd-for-test.yml + +```yaml +name: Docker Image CI && Deploy to EC2 for Test Server + +on: + push: + branches: ['release/**'] + +jobs: + job1: + name: Docker Image CI + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Login to DockerHub + uses: docker/login-action@v2.0.0 + with: + username: ${{secrets.DOCKERHUB_USERNAME}} + password: ${{secrets.DOCKERHUB_TOKEN}} + + - name: Build and push Docker images + uses: docker/build-push-action@v3.1.1 + with: + context: . + tags: hou27/test_quickchive_backend:latest + push: true + job2: + needs: job1 + name: Deploy to EC2 + runs-on: quickchive-server + + steps: + - name: executing remote ssh commands using password + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ubuntu + key: ${{ secrets.KEY_PAIR }} + script: | + sh /home/ubuntu/actions-runner/deploy_test_server.sh +``` + +> deploy.sh는 배포 서버용이었다면, +> deploy_test_server.sh는 테스트 서버용. + +```sh +# !/bin/bash +docker ps -a | grep test_quickchive_backend:latest | awk '{print$1}' | xargs -t -I % docker rm -f % && docker image ls | grep test_quickchive | awk '{print$3}' | xargs -I % docker rmi % +docker pull hou27/test_quickchive_backend +cd ~ubuntu && docker run -d --name test-api-server -p 3000:4000 --network ubuntu_shared-network --env-file .env.test hou27/test_quickchive_backend +``` diff --git a/Wiki/Docker-Compose.md b/Wiki/Docker-Compose.md index 1bad631..a19ad6b 100644 --- a/Wiki/Docker-Compose.md +++ b/Wiki/Docker-Compose.md @@ -83,5 +83,5 @@ api server를 이 docker compose 파일로 올린 redis, postgreSQL 서버와 ex) ```sh -docker run --name test-api-server -p 3000:4000 --network [docker compose 파일로 생성된 네트워크] --env-file .env.prod hou27/quickchive_backend +docker run -d --name test-api-server -p 3000:4000 --network [docker compose 파일로 생성된 네트워크] --env-file .env.prod hou27/quickchive_backend ``` From 2e741980d78d66d8d8ecc9f880404ae7eec2a9e8 Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 17 Nov 2022 23:47:56 +0900 Subject: [PATCH 12/29] docs: Update wiki - ci/cd - #129 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 약간의 버그를 수정한 버전의 shell script를 wiki 문서에 업데이트 --- Wiki/CI_CD.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Wiki/CI_CD.md b/Wiki/CI_CD.md index f9777ba..3dd01f8 100644 --- a/Wiki/CI_CD.md +++ b/Wiki/CI_CD.md @@ -63,7 +63,7 @@ steps: ```sh # !/bin/bash -docker ps -a | grep quickchive_backend:latest | awk '{print$1}' | xargs -t -I % docker rm -f % && docker image ls | grep quickchive | awk '{print$3}' | xargs -I % docker rmi % +docker ps -a | grep hou27/quickchive_backend | awk '{print$1}' | xargs -t -I % docker rm -f % && docker image ls | grep hou27/quickchive_backend | awk '{print$3}' | xargs -I % docker rmi % docker pull hou27/quickchive_backend cd ~ubuntu && docker run -d --name api-server -p 80:4000 --network ubuntu_shared-network --env-file .env.prod hou27/quickchive_backend ``` @@ -171,7 +171,7 @@ jobs: ```sh # !/bin/bash -docker ps -a | grep test_quickchive_backend:latest | awk '{print$1}' | xargs -t -I % docker rm -f % && docker image ls | grep test_quickchive | awk '{print$3}' | xargs -I % docker rmi % +docker ps -a | grep test-api-server | awk '{print$1}' | xargs -t -I % docker rm -f % && docker image ls | grep test_quickchive | awk '{print$3}' | xargs -I % docker rmi % docker pull hou27/test_quickchive_backend cd ~ubuntu && docker run -d --name test-api-server -p 3000:4000 --network ubuntu_shared-network --env-file .env.test hou27/test_quickchive_backend ``` From 1acabcbcd43bd107b33752b3f991beca6fbd7017 Mon Sep 17 00:00:00 2001 From: hou27 Date: Sat, 19 Nov 2022 10:38:39 +0900 Subject: [PATCH 13/29] docs: Update Server Configuration wiki - #129 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 전체 클라우드 구성도 추가 --- Wiki/Server_Configuration.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Wiki/Server_Configuration.md b/Wiki/Server_Configuration.md index f9f1725..468348f 100644 --- a/Wiki/Server_Configuration.md +++ b/Wiki/Server_Configuration.md @@ -7,3 +7,7 @@ ## 변경 후 ![image](https://user-images.githubusercontent.com/65845941/202456944-f6738edd-c5da-4546-9a33-44f1c941e2fb.png) + +# 활용된 기술 클라우드 전체 + +![image](https://user-images.githubusercontent.com/65845941/202827976-080feea6-de7b-472b-a2b3-28cbc895b006.png) From ce9ad779206a6fa62db2f14e5d49e9f0ebc26306 Mon Sep 17 00:00:00 2001 From: hou27 Date: Sat, 19 Nov 2022 19:56:24 +0900 Subject: [PATCH 14/29] =?UTF-8?q?chore:=20npm=20run=20start:prod=20script?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cross-env NODE_ENV=prod 제거 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b327a2..9a58d06 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "start": "cross-env NODE_ENV=prod nest start", "start:dev": "TZ=Asia/Seoul cross-env NODE_ENV=dev nest start --watch", "start:debug": "nest start --debug --watch", - "start:prod": "cross-env NODE_ENV=prod node dist/main", + "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "cross-env NODE_ENV=test jest --watch", From a2b8c557b12cc5e5223a72cde04fb972add381ff Mon Sep 17 00:00:00 2001 From: hou27 Date: Sat, 19 Nov 2022 20:25:47 +0900 Subject: [PATCH 15/29] docs: Update ci cd wiki MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NODE_ENV를 cross-env가 아닌 docker option을 통해 설정한 내용을 반영 --- Wiki/CI_CD.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Wiki/CI_CD.md b/Wiki/CI_CD.md index 3dd01f8..acee8af 100644 --- a/Wiki/CI_CD.md +++ b/Wiki/CI_CD.md @@ -65,7 +65,7 @@ steps: # !/bin/bash docker ps -a | grep hou27/quickchive_backend | awk '{print$1}' | xargs -t -I % docker rm -f % && docker image ls | grep hou27/quickchive_backend | awk '{print$3}' | xargs -I % docker rmi % docker pull hou27/quickchive_backend -cd ~ubuntu && docker run -d --name api-server -p 80:4000 --network ubuntu_shared-network --env-file .env.prod hou27/quickchive_backend +cd ~ubuntu && docker run -d --name api-server -p 80:4000 --network ubuntu_shared-network -e NODE_ENV=prod --env-file .env.prod hou27/quickchive_backend ``` - 기존 컨테이너 삭제, 이미지 삭제 후 @@ -173,5 +173,5 @@ jobs: # !/bin/bash docker ps -a | grep test-api-server | awk '{print$1}' | xargs -t -I % docker rm -f % && docker image ls | grep test_quickchive | awk '{print$3}' | xargs -I % docker rmi % docker pull hou27/test_quickchive_backend -cd ~ubuntu && docker run -d --name test-api-server -p 3000:4000 --network ubuntu_shared-network --env-file .env.test hou27/test_quickchive_backend +cd ~ubuntu && docker run -d --name test-api-server -p 3000:4000 --network ubuntu_shared-network -e NODE_ENV=test --env-file .env.test hou27/test_quickchive_backend ``` From 830181538252ac6a6b91ea1fff380f7afd2baed6 Mon Sep 17 00:00:00 2001 From: hou27 Date: Sat, 19 Nov 2022 21:19:02 +0900 Subject: [PATCH 16/29] =?UTF-8?q?feat:=20DB=20=EB=B6=84=EB=A6=AC=20-=20#12?= =?UTF-8?q?9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.module.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app.module.ts b/src/app.module.ts index aa4b2bd..e7b1f1e 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -55,6 +55,7 @@ import { SummaryModule } from './summary/summary.module'; port: +process.env.DB_PORT, username: process.env.POSTGRES_USER, password: process.env.POSTGRES_PASSWORD, + database: process.env.POSTGRES_DB_NAME, } : { host: process.env.DB_HOST, From f922b77fabf61b5bb80978489cea2ea3a7166ce8 Mon Sep 17 00:00:00 2001 From: hou27 Date: Sat, 19 Nov 2022 21:35:31 +0900 Subject: [PATCH 17/29] =?UTF-8?q?docs:=20env=20wiki=EC=97=90=20=EC=83=88?= =?UTF-8?q?=EB=A1=9C=20=EC=B6=94=EA=B0=80=EB=90=9C=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 테스트 서버와 DB 분리하면서 추가된 POSTGRES_DB_NAME 추가 --- Wiki/ENV.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Wiki/ENV.md b/Wiki/ENV.md index 1af44d5..cc325fd 100644 --- a/Wiki/ENV.md +++ b/Wiki/ENV.md @@ -14,6 +14,7 @@ DB_PORT= POSTGRES_DB= POSTGRES_USER= POSTGRES_PASSWORD= +POSTGRES_DB_NAME= KAKAO_REST_API_KEY= KAKAO_REDIRECT_URI_LOGIN= KAKAO_CLIENT_SECRET= From 6cac818bb40340016c9de7a048b0a9d6fe6ed1fa Mon Sep 17 00:00:00 2001 From: hou27 Date: Sat, 19 Nov 2022 21:45:13 +0900 Subject: [PATCH 18/29] feat: Update joi validation schema --- src/app.module.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app.module.ts b/src/app.module.ts index e7b1f1e..681bb8d 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -45,6 +45,17 @@ import { SummaryModule } from './summary/summary.module'; MAILGUN_DOMAIN_NAME: Joi.string().required(), MAILGUN_TEMPLATE_NAME_FOR_VERIFY_EMAIL: Joi.string().required(), MAILGUN_TEMPLATE_NAME_FOR_RESET_PASSWORD: Joi.string().required(), + MAILGUN_TEMPLATE_NAME_FOR_NOTIFICATION: Joi.string().required(), + KAKAO_REST_API_KEY: Joi.string().required(), + KAKAO_REDIRECT_URI_LOGIN: Joi.string().required(), + KAKAO_CLIENT_SECRET: Joi.string().required(), + KAKAO_JS_KEY: Joi.string().required(), + GOOGLE_CLIENT_ID: Joi.string().required(), + GOOGLE_SECRET: Joi.string().required(), + GOOGLE_REDIRECT_URI: Joi.string().required(), + NAVER_API_CLIENT_ID: Joi.string().required(), + NAVER_API_CLIENT_SECRET: Joi.string().required(), + NAVER_CLOVA_SUMMARY_REQUEST_URL: Joi.string().required(), }), }), TypeOrmModule.forRoot({ From 8e3ef9c351a36f8dee9bb4fb3c21fed27f52d791 Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 24 Nov 2022 12:20:11 +0900 Subject: [PATCH 19/29] docs: Update 0.1.0 release note MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 잘못 정리되어있던 부분 수정 및 서비스 버전 명시 --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1fae5c0..fd4312c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ # v0.1.0 -## Added +> releated with quickchive version 1.0 + +## 🚀 Added > MVP @@ -17,7 +19,7 @@ - 로그인: OAuth(구글로그인, 카카오로그인), 이메일 로그인(자체 로그인 기능) - 자동로그인 정책: 한달 동안 접속하지 않아도 로그인 유지 - refresh token 활용(만료 기간 한달) - 회원가입(이메일 인증방식) - - 회원가입 시 받는 정보: 이메일(메일로 인증필수), 닉네임(2-8자 이내), 비밀번호(8자 이상 문자, 숫자) + - 회원가입 시 받는 정보: 이메일(메일로 인증필수), 닉네임, 비밀번호(8자 이상 문자, 숫자) - 닉네임 수정 - 비밀번호 재설정 - 로그아웃 @@ -31,7 +33,7 @@ 3. Collection -- 저장: *콜렉션 이름, 콜렉션 설명, *URL, 카테고리, 즐겨찾기 +- 저장: \*콜렉션 이름, 콜렉션 설명, URL, 카테고리, 즐겨찾기 - 삭제 - 수정: 콘텐츠 이름, URL(추가, 삭제, 순서 변경), 카테고리, 읽을 기한 @@ -39,13 +41,13 @@ - 읽을 기한 알림: 매일 08:00 KST에 읽을 기한 만료된 콘텐츠에 대한 메일 알림 전송 -## Changed +## 📝 Changed -> first release +None -## Removed +## :no_entry_sign: Removed -> first release +None ## License From b889ea27e355ad463a00df9106b7a580ab2aae6e Mon Sep 17 00:00:00 2001 From: hou27 Date: Mon, 28 Nov 2022 13:25:24 +0900 Subject: [PATCH 20/29] =?UTF-8?q?docs:=20README=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20=EB=82=B4=EC=9A=A9=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20-=20#128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 새로운 기능, 변경된 기능, 없어진 기능 등은 릴리즈 노트에 작성하기로 하고 README에는 프로젝트 설명을 담기로 했다 --- README.md | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index fd4312c..5682354 100644 --- a/README.md +++ b/README.md @@ -10,49 +10,6 @@ > releated with quickchive version 1.0 -## 🚀 Added - -> MVP - -1. User - -- 로그인: OAuth(구글로그인, 카카오로그인), 이메일 로그인(자체 로그인 기능) -- 자동로그인 정책: 한달 동안 접속하지 않아도 로그인 유지 - refresh token 활용(만료 기간 한달) -- 회원가입(이메일 인증방식) - - 회원가입 시 받는 정보: 이메일(메일로 인증필수), 닉네임, 비밀번호(8자 이상 문자, 숫자) -- 닉네임 수정 -- 비밀번호 재설정 -- 로그아웃 -- 회원 탈퇴 - -2. Content - -- 저장: 콘텐츠 이름, \*URL, 메모, 카테고리, 즐겨찾기, 읽을 기한 -- 삭제 -- 수정: 콘텐츠 이름, 메모, 카테고리, 즐겨찾기, 읽을 기한 - -3. Collection - -- 저장: \*콜렉션 이름, 콜렉션 설명, URL, 카테고리, 즐겨찾기 -- 삭제 -- 수정: 콘텐츠 이름, URL(추가, 삭제, 순서 변경), 카테고리, 읽을 기한 - -4. 알림 - -- 읽을 기한 알림: 매일 08:00 KST에 읽을 기한 만료된 콘텐츠에 대한 메일 알림 전송 - -## 📝 Changed - -None - -## :no_entry_sign: Removed - -None - -## License - -Nest is [MIT licensed](LICENSE). - # API 구조 ### User API @@ -116,3 +73,7 @@ Nest is [MIT licensed](LICENSE). | /api/collections/update | POST | 콜렉션 수정 | O | | /api/collections/favorite/\ | PATCH | 즐겨찾기 등록 및 해제 | O | | /api/collections/delete/\ | DELETE | 콜렉션 삭제 | O | + +## License + +Nest is [MIT licensed](LICENSE). From 0bc12fb81c22e3d33667fd9ef7ba604fe1133e22 Mon Sep 17 00:00:00 2001 From: hou27 Date: Mon, 28 Nov 2022 13:40:46 +0900 Subject: [PATCH 21/29] =?UTF-8?q?docs:=20workflow=20status=20badge=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20-=20#128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TODO: 실배포 시 ![GitHub release (latest by date)](https://img.shields.io/github/v/release/quickchive/quickchive-backend?style=flat-square) ![deploy](https://github.com/Quickchive/quickchive-backend/actions/workflows/ci-cd.yml/badge.svg) 위 내용으로 대체할 것 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5682354..01bc948 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ ## Description -> [Quickchive](https://quickchive.swygbro.com/) +[Quickchive](https://quickchive.swygbro.com/)'s backend repository -
+![deploy](https://github.com/Quickchive/quickchive-backend/actions/workflows/ci-cd-for-test.yml/badge.svg) # v0.1.0 From 89da623f9e2b5ef4ea38809ea7e5c2466d5b6951 Mon Sep 17 00:00:00 2001 From: hou27 Date: Mon, 28 Nov 2022 13:47:39 +0900 Subject: [PATCH 22/29] =?UTF-8?q?docs:=20history=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=97=90=20=EB=A6=B4=EB=A6=AC=EC=A6=88=20=EB=82=B4=EC=97=AD?= =?UTF-8?q?=EC=9D=84=20=EA=B8=B0=EB=A1=9D=20-=20#128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 앞으로 history 문서에 릴리즈 내역을 정리하고자 한다. --- Wiki/HISTORY.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Wiki/HISTORY.md diff --git a/Wiki/HISTORY.md b/Wiki/HISTORY.md new file mode 100644 index 0000000..4f68c4b --- /dev/null +++ b/Wiki/HISTORY.md @@ -0,0 +1,42 @@ +# HISTORY + +# v0.1.0 + +## 🚀 Added + +> MVP + +1. User + +- 로그인: OAuth(구글로그인, 카카오로그인), 이메일 로그인(자체 로그인 기능) +- 자동로그인 정책: 한달 동안 접속하지 않아도 로그인 유지 - refresh token 활용(만료 기간 한달) +- 회원가입(이메일 인증방식) + - 회원가입 시 받는 정보: 이메일(메일로 인증필수), 닉네임, 비밀번호(8자 이상 문자, 숫자) +- 닉네임 수정 +- 비밀번호 재설정 +- 로그아웃 +- 회원 탈퇴 + +2. Content + +- 저장: 콘텐츠 이름, \*URL, 메모, 카테고리, 즐겨찾기, 읽을 기한 +- 삭제 +- 수정: 콘텐츠 이름, 메모, 카테고리, 즐겨찾기, 읽을 기한 + +3. Collection + +- 저장: \*콜렉션 이름, 콜렉션 설명, URL, 카테고리, 즐겨찾기 +- 삭제 +- 수정: 콘텐츠 이름, URL(추가, 삭제, 순서 변경), 카테고리, 읽을 기한 + +4. 알림 + +- 읽을 기한 알림: 매일 08:00 KST에 읽을 기한 만료된 콘텐츠에 대한 메일 알림 전송 + +## 📝 Changed + +None + +## :no_entry_sign: Removed + +None From 85364b69c56d2d57923efd5f254e8398afe5dbde Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 1 Dec 2022 17:11:32 +0900 Subject: [PATCH 23/29] =?UTF-8?q?chore:=20Dockerfile=EC=97=90=EC=84=9C=20t?= =?UTF-8?q?imezone=20=EC=84=A4=EC=A0=95=20=EC=8B=9C=EB=8F=84=20-=20#112?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 가벼운 base image를 사용 중이기 때문에 docker image 내부에 timezone file이 없다. 그래서 파일을 직접 넣어준 후, 세팅해주도록 작성했다. --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0bc64eb..dd7076a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,14 @@ FROM node:16.13.1-alpine3.15 AS builder ## make work directory and copy files WORKDIR /app COPY . . + +# Timezone setting + +## copy host's timezone file to container +COPY /usr/share/zoneinfo/Asia/Seoul /usr/share/zoneinfo/Asia/Seoul +## set timezone +RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime + ## project dependency install RUN rm -rf dist && npm install RUN npm run build From 745595860f1b9b75b6eca50331f12f84575ff55d Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 1 Dec 2022 17:19:40 +0900 Subject: [PATCH 24/29] =?UTF-8?q?chore:=20not=20found=20error=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0=20=EC=8B=9C=EB=8F=84=20-=20#112?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit host의 파일을 직접 가져와 준비해봄 --- Dockerfile | 2 +- asset/zoneinfo/Asia/Seoul | Bin 0 -> 645 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 asset/zoneinfo/Asia/Seoul diff --git a/Dockerfile b/Dockerfile index dd7076a..5e0897b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ COPY . . # Timezone setting ## copy host's timezone file to container -COPY /usr/share/zoneinfo/Asia/Seoul /usr/share/zoneinfo/Asia/Seoul +COPY ./asset/zoneinfo/Asia/Seoul /usr/share/zoneinfo/Asia/Seoul ## set timezone RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime diff --git a/asset/zoneinfo/Asia/Seoul b/asset/zoneinfo/Asia/Seoul new file mode 100644 index 0000000000000000000000000000000000000000..6781912af2491abe97c3cba9f9f6166ee0a80bcd GIT binary patch literal 645 zcmci9%_{_99Ki8s?20zEq&64jH)21*|8mE0uE)ub2a*|TY!O5Bb zz)8x%c&%w;c3P}QIZQ4*-^pRi$;EGa`abj2)XZnh>4mvo@oVbz35#jfi+$sktK^QK z3NMGclsmg^yOsUib@*xDoTt58cT?RRC%t>Ws2&RMUU8yZJuaSvPt7fsKNFLsrfd-O z*fJ=6SmorTET3Ij&u@M5<>=IUy-3N*`ktlwmu1^w&S_tocRE%FozC$Q$EbWa>U$k+3R`3(^lV#N{qu5e&9M0GZzD>H2JP}P`!K={%F1OY;%M%AbkSPCu$n1W1!=JUa(fK$-v NzriQ;KS>WHz5#9m3T6NR literal 0 HcmV?d00001 From f078ea3266d640139d1c676f7a1a4d9ee8dd830c Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 1 Dec 2022 17:29:44 +0900 Subject: [PATCH 25/29] =?UTF-8?q?chore:=20tzdata=20package=EB=A5=BC=20?= =?UTF-8?q?=EB=8B=A4=EC=9A=B4=EB=B0=9B=EC=95=84=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EB=B0=A9=EB=B2=95=20=EC=8B=9C=EB=8F=84=20?= =?UTF-8?q?-=20#112?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이전의 방법이 제대로 동작하지 않아 tzdata를 다운받는 방법을 시도해봄 --- Dockerfile | 6 ++---- asset/zoneinfo/Asia/Seoul | Bin 645 -> 0 bytes 2 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 asset/zoneinfo/Asia/Seoul diff --git a/Dockerfile b/Dockerfile index 5e0897b..70948ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,10 +6,8 @@ COPY . . # Timezone setting -## copy host's timezone file to container -COPY ./asset/zoneinfo/Asia/Seoul /usr/share/zoneinfo/Asia/Seoul -## set timezone -RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime +## install tzdata package for timezone setting +RUN apk add tzdata && ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime ## project dependency install RUN rm -rf dist && npm install diff --git a/asset/zoneinfo/Asia/Seoul b/asset/zoneinfo/Asia/Seoul deleted file mode 100644 index 6781912af2491abe97c3cba9f9f6166ee0a80bcd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 645 zcmci9%_{_99Ki8s?20zEq&64jH)21*|8mE0uE)ub2a*|TY!O5Bb zz)8x%c&%w;c3P}QIZQ4*-^pRi$;EGa`abj2)XZnh>4mvo@oVbz35#jfi+$sktK^QK z3NMGclsmg^yOsUib@*xDoTt58cT?RRC%t>Ws2&RMUU8yZJuaSvPt7fsKNFLsrfd-O z*fJ=6SmorTET3Ij&u@M5<>=IUy-3N*`ktlwmu1^w&S_tocRE%FozC$Q$EbWa>U$k+3R`3(^lV#N{qu5e&9M0GZzD>H2JP}P`!K={%F1OY;%M%AbkSPCu$n1W1!=JUa(fK$-v NzriQ;KS>WHz5#9m3T6NR From 0ae5a26a1c2b015539405f3884d5b38de69475d0 Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 1 Dec 2022 17:41:28 +0900 Subject: [PATCH 26/29] =?UTF-8?q?chore:=20builder=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89=EB=90=98=EB=8F=84=EB=A1=9D=20=EA=B8=B0?= =?UTF-8?q?=EC=9E=85=ED=95=9C=20=EB=AA=85=EB=A0=B9=EC=9D=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20-=20#112?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit builder에서 timezone을 세팅하도록 하는 바람에 최종 빌드된 이미지에 영향이 없었음 이를 수정함 --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 70948ed..833cf32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,11 +4,6 @@ FROM node:16.13.1-alpine3.15 AS builder WORKDIR /app COPY . . -# Timezone setting - -## install tzdata package for timezone setting -RUN apk add tzdata && ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime - ## project dependency install RUN rm -rf dist && npm install RUN npm run build @@ -17,5 +12,10 @@ FROM node:16.13.1-alpine3.15 WORKDIR /usr/src/app COPY --from=builder /app ./ +# Timezone setting + +## install tzdata package for timezone setting +RUN apk add tzdata && ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime + EXPOSE 4000 CMD npm run start:prod \ No newline at end of file From 14f2a82a0e3db78fbc4f536aeefa07b155c68cd3 Mon Sep 17 00:00:00 2001 From: hou27 Date: Thu, 1 Dec 2022 18:22:27 +0900 Subject: [PATCH 27/29] =?UTF-8?q?docs:=20README=20=EB=AC=B8=EC=84=9C?= =?UTF-8?q?=EC=97=90=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=84=A4?= =?UTF-8?q?=EB=AA=85=20=EC=B6=94=EA=B0=80=20-=20#128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 프로젝트 개요, 대상, 기획 배경과 release 버전 badge, 가장 최근 workflow 상태를 알려주는 badge를 추가함 --- README.md | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01bc948..fb6243d 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,48 @@ # Quickchive Backend -## Description +![GitHub release (latest by date)](https://img.shields.io/github/v/release/quickchive/quickchive-backend?style=flat-square) +![deploy](https://github.com/Quickchive/quickchive-backend/actions/workflows/ci-cd.yml/badge.svg) -[Quickchive](https://quickchive.swygbro.com/)'s backend repository +## Description -![deploy](https://github.com/Quickchive/quickchive-backend/actions/workflows/ci-cd-for-test.yml/badge.svg) +[Quickchive](https://quickchive.swygbro.com/) +[Quickchive Frontend](https://github.com/Quickchive/Quickchive-frontend) # v0.1.0 > releated with quickchive version 1.0 -# API 구조 +
+ +## :open_file_folder: 프로젝트 개요 + +- 읽어둬야 할 아티클 링크, 참석해야 하는 세미나 링크, 봐둬야 할 영상링크 등 자기개발을 위해 읽어두고 알아야 할 링크를 분류해서 저장할 수 있는 북마크 서비스입니다. + +
+ +## :people_holding_hands: 대상 + +- 여러가지 이유로 여러 곳에서 다시 볼 목적으로 콘텐츠를 수집하는 사람들 + +
+ +## :cloud: 기획 배경 + +### 마주한 문제 + +1. **저장해둔 북마크를 다시 읽지 않는 사람들**: 까먹거나, 귀찮아서, 여러 플랫폼에 좋아요/저장/스크랩형태로 읽을 거리를 여기저기 널려놨기 때문에 관리가 힘들어 다시 보지 않습니다. + +2. **기존 북마크 서비스를 사용하지 않는 사람들**: 기본 메모앱을 사용하거나, 스크린샷 혹은 카카오톡 나에게 보내기를 사용한다. 이로 인해 저장해둔 북마크를 다시 읽지 않는다는 1번 문제가 다시 발생합니다. + +3. **북마크해뒀던 아티클을 읽을 때 부담되는 사람들**: 읽을 거리가 많아서 부담된거나, 영어라서 부담되는 등의 이유로 읽지 않는 사람들도 있습니다. + +위와 같은 문제들 탓에 항상 읽어야지 하고 다짐만 하고, 저장한 아티클만 쌓여가는 분들을 위해 +보다 편리하고 빠르게 아티클들을 관리하고 볼 수 있도록 돕고자 기획하게 되었습니다. + +
+
+ +# :computer: API 구조 ### User API From 30d2974d61bebb3b87c363b1c7104bf468d26c96 Mon Sep 17 00:00:00 2001 From: hou27 Date: Fri, 2 Dec 2022 21:39:37 +0900 Subject: [PATCH 28/29] =?UTF-8?q?chore:=20=EC=8B=9C=EA=B0=84=20=EA=B0=92?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=EC=9B=90=EC=9D=B8=20=ED=99=95=EC=9D=B8?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20dockerfile=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20-=20#132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit timezone 설정 라인 주석 처리 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 833cf32..8e00d3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ COPY --from=builder /app ./ # Timezone setting ## install tzdata package for timezone setting -RUN apk add tzdata && ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime +# RUN apk add tzdata && ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime EXPOSE 4000 CMD npm run start:prod \ No newline at end of file From cf641d273f36a98a1b0a10de1d4704b757005fa1 Mon Sep 17 00:00:00 2001 From: hou27 Date: Fri, 2 Dec 2022 22:39:21 +0900 Subject: [PATCH 29/29] =?UTF-8?q?chore:=20=EB=8B=A4=EC=8B=9C=20timezone=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20-=20#132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- docker-compose.yml | 2 ++ src/users/users.service.ts | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8e00d3b..833cf32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ COPY --from=builder /app ./ # Timezone setting ## install tzdata package for timezone setting -# RUN apk add tzdata && ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime +RUN apk add tzdata && ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime EXPOSE 4000 CMD npm run start:prod \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 9470968..a21e5f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,8 @@ services: - .env.prod environment: POSTGRES_HOST_AUTH_METHOD: 'trust' + TZ: 'Asia/Seoul' # Timezone for OS + PGTZ: 'Asia/Seoul' # Timezone for postgres ports: - 5432:5432 networks: diff --git a/src/users/users.service.ts b/src/users/users.service.ts index 3aaa270..8d41130 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -109,6 +109,8 @@ export class UsersService { ); } + console.log(contents); + return { contents, };