Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9873017
feat: cd 스크립트 작성
Apr 21, 2025
2381b08
chore: cd스크립트 workflows폴더로 이동
Apr 21, 2025
606365e
chore: 버전 수정
Apr 21, 2025
614e9b1
chore: serverless 버전 3.38.0으로 고정 및 credential 과정 삭제
Apr 21, 2025
e25cc0f
chore: prisma deploy과정에 Prisma CLI 설치 추가
Apr 21, 2025
b9c9507
chore: 프리즈마 스키마 파일 위치 설정
Apr 21, 2025
5d4a482
chore: 경로 추가
Apr 21, 2025
a0031ee
chore: 환경 변수 이름 수정
Apr 21, 2025
8e0d176
fix: serverless 배포 명령어 수정. 플러그인 충돌 해결
Apr 21, 2025
da966ff
chore: 플러그인 주석
Apr 21, 2025
5765bba
chore: 서버리스 버전 수정
Apr 21, 2025
779cf35
chore: 노드 버전 수정
Apr 21, 2025
64f00f5
chore: 플러그인 충돌로 인해 주석처리
hye-on Apr 22, 2025
fc05bf8
chore: AWS 자격 증명 설정
hye-on Apr 22, 2025
b8ec979
chore: serverless secret key 추가
hye-on Apr 22, 2025
b148bb2
chore: 서버리스 버전 수정
hye-on Apr 22, 2025
82f12be
chore: 대시보드 비활성화
hye-on Apr 22, 2025
efebd5a
chore: 대시보드 모드 비활성화
hye-on Apr 22, 2025
48a7c56
chore: --no-console 제거
hye-on Apr 22, 2025
326c88a
chore: pakage할때 제외 pnpm제외
hye-on Apr 22, 2025
ae23e73
chore: resolve conflicts
Ho-s May 8, 2025
7b3d526
chore: remove @generated from code config
Ho-s May 8, 2025
6eac5c7
fix: build type error
Ho-s May 8, 2025
5d03cff
feat: bcrypt -> bcryptjs로 변경
Ho-s May 8, 2025
fc88f8f
feat: 필요한 환경변수 재설정
Ho-s May 8, 2025
6ac725f
feat: aws-lambda 를 serverless 배포에서 제외
Ho-s May 8, 2025
4a02140
chore: only import type
Ho-s May 8, 2025
30dee76
feat: 민감한 정보 masking
Ho-s May 9, 2025
9b5cb8b
feat: use dotenv plugin
Ho-s May 9, 2025
31c51ed
feat: build / deploy workflow 나눔
Ho-s May 9, 2025
fdd457c
feat: install serverless in local
Ho-s May 9, 2025
290f9e0
chore: remove no use
Ho-s May 9, 2025
d90b977
chore: 필요없는 환경변수 제거
hye-on May 9, 2025
d9dd5d3
chore: 주석 삭제
hye-on May 9, 2025
8b0a23f
chore: remove this branch from workflow triggers
Ho-s May 9, 2025
e828bff
chore: remove useless
Ho-s May 12, 2025
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
8 changes: 0 additions & 8 deletions .example.env
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# DB
DB_URL="postgresql://postgres:1q2w3e4r@localhost:5432/postgres?schema=public"
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=1q2w3e4r
DB_NAME=postgres
DB_SCHEMA=public

PORT=8000

# JWT
ACCESS_TOKEN_SECRET=
REFRESH_TOKEN_SECRET=
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy serverless application
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd 과정을 여러 개로 나누는 걸 처음 봤는데, 유연하게 사용할 수 있는 게 큰 장점인 것 같아요 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

장단이 있는 것 같습니다.

책임 분리 측면에서는 장점을 가집니다.
기존에 @hye-on 님이 해주신 방식의 경우에는 중복 로직을 제거할 수 있다는 장점을 가졌었죠!

상황에 따라 선택하면 좋아보입니다!


on:
push:
branches:
- main
- feat/cd

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run Prisma migrations
run: npx prisma migrate deploy 2>&1 | grep -v 'Datasource "db":' | grep -v 'PostgreSQL database'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

덕분에 쉘 명령어 다시 공부했네요ㅋㅋㅋㅋ 불필요한 정보 마스킹하는 것 잘 배워갑니다!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고마워 지피티야!

env:
DB_URL: ${{ secrets.DB_URL }}

- name: Create .env file
run: |
echo "ACCESS_TOKEN_SECRET=${{ secrets.ACCESS_TOKEN_SECRET }}" >> .env
echo "REFRESH_TOKEN_SECRET=${{ secrets.REFRESH_TOKEN_SECRET }}" >> .env
echo "DB_URL=${{ secrets.DB_URL }}" >> .env

- name: Run build
run: yarn build

- name: Configure serverless credentials
run: npx serverless config credentials --provider aws --key ${{ secrets.AWS_ACCESS_KEY_ID }} --secret ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Deploy serverless app
run: npx serverless deploy 2>&1 | grep -v 'endpoint:'
29 changes: 29 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Run build & test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


on:
pull_request:
branches:
- main
- feat/cd

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Lint code
run: yarn lint

- name: Build project
run: yarn build
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,3 @@ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
postgres-data/

graphql-schema.gql

@generated
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
graphql-schema.gql
@generated
graphql-schema.gql
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"dependencies": {
"@fastify/aws-lambda": "5.1.4",
"@nestjs/cli": "^11.0.6",
"@nestjs/common": "^11.0.1",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^11.0.1",
Expand All @@ -35,8 +36,7 @@
"@nestjs/platform-express": "^11.0.1",
"@nestjs/platform-fastify": "11.0.12",
"@prisma/client": "^6.5.0",
"aws-lambda": "^1.0.7",
"bcrypt": "^5.1.1",
"bcryptjs": "^3.0.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref 확인했습니다

"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"fastify": "5.2.1",
Expand All @@ -52,7 +52,6 @@
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.18.0",
"@nestjs/cli": "^11.0.0",
"@nestjs/schematics": "^11.0.0",
"@nestjs/testing": "^11.0.1",
"@swc/cli": "^0.6.0",
Expand All @@ -71,6 +70,7 @@
"globals": "^16.0.0",
"jest": "^29.7.0",
"prettier": "^3.4.2",
"serverless": "3.38.0",
"serverless-dotenv-plugin": "^6.0.0",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
Expand Down Expand Up @@ -98,4 +98,4 @@
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
}
4 changes: 1 addition & 3 deletions serverless.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
org: hospace
app: mashup-node

service: nest-graphql-mercurius-fastify

plugins:
Expand Down Expand Up @@ -30,3 +27,4 @@ package:
- 'node_modules/.prisma/client/libquery_engine-rhel-*'
- '!node_modules/prisma/libquery_engine-*'
- '!node_modules/@prisma/engines/**'
- '!node_modules/aws-lambda'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

18 changes: 18 additions & 0 deletions src/@generated/post/aggregate-post.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Field } from '@nestjs/graphql';
import { ObjectType } from '@nestjs/graphql';
import { PostCountAggregate } from './post-count-aggregate.output';
import { PostMinAggregate } from './post-min-aggregate.output';
import { PostMaxAggregate } from './post-max-aggregate.output';

@ObjectType()
export class AggregatePost {

@Field(() => PostCountAggregate, {nullable:true})
_count?: PostCountAggregate;

@Field(() => PostMinAggregate, {nullable:true})
_min?: PostMinAggregate;

@Field(() => PostMaxAggregate, {nullable:true})
_max?: PostMaxAggregate;
}
15 changes: 15 additions & 0 deletions src/@generated/post/create-many-post.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { PostCreateManyInput } from './post-create-many.input';
import { Type } from 'class-transformer';

@ArgsType()
export class CreateManyPostArgs {

@Field(() => [PostCreateManyInput], {nullable:false})
@Type(() => PostCreateManyInput)
data!: Array<PostCreateManyInput>;

@Field(() => Boolean, {nullable:true})
skipDuplicates?: boolean;
}
12 changes: 12 additions & 0 deletions src/@generated/post/create-one-post.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { PostCreateInput } from './post-create.input';
import { Type } from 'class-transformer';

@ArgsType()
export class CreateOnePostArgs {

@Field(() => PostCreateInput, {nullable:false})
@Type(() => PostCreateInput)
data!: PostCreateInput;
}
16 changes: 16 additions & 0 deletions src/@generated/post/delete-many-post.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { PostWhereInput } from './post-where.input';
import { Type } from 'class-transformer';
import { Int } from '@nestjs/graphql';

@ArgsType()
export class DeleteManyPostArgs {

@Field(() => PostWhereInput, {nullable:true})
@Type(() => PostWhereInput)
where?: PostWhereInput;

@Field(() => Int, {nullable:true})
limit?: number;
}
13 changes: 13 additions & 0 deletions src/@generated/post/delete-one-post.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { Prisma } from '@prisma/client';
import { PostWhereUniqueInput } from './post-where-unique.input';
import { Type } from 'class-transformer';

@ArgsType()
export class DeleteOnePostArgs {

@Field(() => PostWhereUniqueInput, {nullable:false})
@Type(() => PostWhereUniqueInput)
where!: Prisma.AtLeast<PostWhereUniqueInput, 'id'>;
}
32 changes: 32 additions & 0 deletions src/@generated/post/find-first-post-or-throw.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { PostWhereInput } from './post-where.input';
import { Type } from 'class-transformer';
import { PostOrderByWithRelationInput } from './post-order-by-with-relation.input';
import { Prisma } from '@prisma/client';
import { PostWhereUniqueInput } from './post-where-unique.input';
import { Int } from '@nestjs/graphql';
import { PostScalarFieldEnum } from './post-scalar-field.enum';

@ArgsType()
export class FindFirstPostOrThrowArgs {

@Field(() => PostWhereInput, {nullable:true})
@Type(() => PostWhereInput)
where?: PostWhereInput;

@Field(() => [PostOrderByWithRelationInput], {nullable:true})
orderBy?: Array<PostOrderByWithRelationInput>;

@Field(() => PostWhereUniqueInput, {nullable:true})
cursor?: Prisma.AtLeast<PostWhereUniqueInput, 'id'>;

@Field(() => Int, {nullable:true})
take?: number;

@Field(() => Int, {nullable:true})
skip?: number;

@Field(() => [PostScalarFieldEnum], {nullable:true})
distinct?: Array<`${PostScalarFieldEnum}`>;
}
32 changes: 32 additions & 0 deletions src/@generated/post/find-first-post.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { PostWhereInput } from './post-where.input';
import { Type } from 'class-transformer';
import { PostOrderByWithRelationInput } from './post-order-by-with-relation.input';
import { Prisma } from '@prisma/client';
import { PostWhereUniqueInput } from './post-where-unique.input';
import { Int } from '@nestjs/graphql';
import { PostScalarFieldEnum } from './post-scalar-field.enum';

@ArgsType()
export class FindFirstPostArgs {

@Field(() => PostWhereInput, {nullable:true})
@Type(() => PostWhereInput)
where?: PostWhereInput;

@Field(() => [PostOrderByWithRelationInput], {nullable:true})
orderBy?: Array<PostOrderByWithRelationInput>;

@Field(() => PostWhereUniqueInput, {nullable:true})
cursor?: Prisma.AtLeast<PostWhereUniqueInput, 'id'>;

@Field(() => Int, {nullable:true})
take?: number;

@Field(() => Int, {nullable:true})
skip?: number;

@Field(() => [PostScalarFieldEnum], {nullable:true})
distinct?: Array<`${PostScalarFieldEnum}`>;
}
32 changes: 32 additions & 0 deletions src/@generated/post/find-many-post.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { PostWhereInput } from './post-where.input';
import { Type } from 'class-transformer';
import { PostOrderByWithRelationInput } from './post-order-by-with-relation.input';
import { Prisma } from '@prisma/client';
import { PostWhereUniqueInput } from './post-where-unique.input';
import { Int } from '@nestjs/graphql';
import { PostScalarFieldEnum } from './post-scalar-field.enum';

@ArgsType()
export class FindManyPostArgs {

@Field(() => PostWhereInput, {nullable:true})
@Type(() => PostWhereInput)
where?: PostWhereInput;

@Field(() => [PostOrderByWithRelationInput], {nullable:true})
orderBy?: Array<PostOrderByWithRelationInput>;

@Field(() => PostWhereUniqueInput, {nullable:true})
cursor?: Prisma.AtLeast<PostWhereUniqueInput, 'id'>;

@Field(() => Int, {nullable:true})
take?: number;

@Field(() => Int, {nullable:true})
skip?: number;

@Field(() => [PostScalarFieldEnum], {nullable:true})
distinct?: Array<`${PostScalarFieldEnum}`>;
}
13 changes: 13 additions & 0 deletions src/@generated/post/find-unique-post-or-throw.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { Prisma } from '@prisma/client';
import { PostWhereUniqueInput } from './post-where-unique.input';
import { Type } from 'class-transformer';

@ArgsType()
export class FindUniquePostOrThrowArgs {

@Field(() => PostWhereUniqueInput, {nullable:false})
@Type(() => PostWhereUniqueInput)
where!: Prisma.AtLeast<PostWhereUniqueInput, 'id'>;
}
13 changes: 13 additions & 0 deletions src/@generated/post/find-unique-post.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Field } from '@nestjs/graphql';
import { ArgsType } from '@nestjs/graphql';
import { Prisma } from '@prisma/client';
import { PostWhereUniqueInput } from './post-where-unique.input';
import { Type } from 'class-transformer';

@ArgsType()
export class FindUniquePostArgs {

@Field(() => PostWhereUniqueInput, {nullable:false})
@Type(() => PostWhereUniqueInput)
where!: Prisma.AtLeast<PostWhereUniqueInput, 'id'>;
}
Loading
Loading