-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
719 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,10 @@ jobs: | |
IMAGE_NAME: record-camon | ||
RECORD_PORT: ${{ secrets.RECORD_PORT }} | ||
NCLOUD_ACCESS_KEY: ${{ secrets.NCLOUD_ACCESS_KEY }} | ||
NCLOUD_SECRET_KEY=: ${{ secrets.NCLOUD_SECRET_KEY }} | ||
NCLOUD_BUCKET_NAME=: ${{ secrets.NCLOUD_BUCKET_NAME }} | ||
NCLOUD_SECRET_KEY: ${{ secrets.NCLOUD_SECRET_KEY }} | ||
NCLOUD_BUCKET_NAME: ${{ secrets.NCLOUD_BUCKET_NAME }} | ||
API_SERVER_URL: ${{ secrets.API_SERVER_URL }} | ||
CDN_URL: ${{ secrets.CDN_URL }} | ||
|
||
steps: | ||
- name: Checkout code | ||
|
@@ -33,8 +35,10 @@ jobs: | |
docker build -f ./apps/record/Dockerfile -t ${{ secrets.NCLOUD_REGISTRY_URL }}/$IMAGE_NAME:latest \ | ||
--build-arg RECORD_PORT=$RECORD_PORT \ | ||
--build-arg NCLOUD_ACCESS_KEY=$NCLOUD_ACCESS_KEY \ | ||
--build-arg NCLOUD_SECRET_KEY=$NCLOUD_ACCESS_KEY \ | ||
--build-arg NCLOUD_SECRET_KEY=$NCLOUD_SECRET_KEY \ | ||
--build-arg NCLOUD_BUCKET_NAME=$NCLOUD_BUCKET_NAME \ | ||
--build-arg API_SERVER_URL=$API_SERVER_URL \ | ||
--build-arg CDN_URL=$CDN_URL \ | ||
. | ||
- name: Push to Ncloud Container Registry | ||
|
@@ -44,6 +48,16 @@ jobs: | |
deploy-and-run: | ||
runs-on: ubuntu-latest | ||
needs: build-and-push | ||
env: | ||
IMAGE_NAME: record-camon | ||
RECORD_PORT: ${{ secrets.RECORD_PORT }} | ||
NCLOUD_ACCESS_KEY: ${{ secrets.NCLOUD_ACCESS_KEY }} | ||
NCLOUD_SECRET_KEY: ${{ secrets.NCLOUD_SECRET_KEY }} | ||
NCLOUD_BUCKET_NAME: ${{ secrets.NCLOUD_BUCKET_NAME }} | ||
NCLOUD_REGISTRY_URL: ${{ secrets.NCLOUD_REGISTRY_URL }} | ||
API_SERVER_URL: ${{ secrets.API_SERVER_URL }} | ||
CDN_URL: ${{ secrets.CDN_URL }} | ||
|
||
steps: | ||
- name: Checkout for docker-compose | ||
uses: actions/checkout@v2 | ||
|
@@ -64,19 +78,30 @@ jobs: | |
username: ${{ secrets.SERVER_USER }} | ||
key: ${{ secrets.SSH_SERVER_KEY }} | ||
port: 22 | ||
envs: RECORD_PORT,NCLOUD_ACCESS_KEY,NCLOUD_SECRET_KEY,NCLOUD_BUCKET_NAME | ||
envs: RECORD_PORT,NCLOUD_ACCESS_KEY,NCLOUD_SECRET_KEY,NCLOUD_BUCKET_NAME,NCLOUD_REGISTRY_URL,API_SERVER_URL,CDN_URL | ||
script: | | ||
cd /home/${{ secrets.SERVER_USER }}/camon | ||
sudo docker login -u ${{secrets.NCLOUD_ACCESS_KEY}} -p ${{ secrets.NCLOUD_SECRET_KEY }} ${{ secrets.NCLOUD_REGISTRY_URL }} | ||
echo "RECORD_PORT=$RECORD_PORT" > .env | ||
echo "NCLOUD_ACCESS_KEY=$NCLOUD_ACCESS_KEY" >> .env | ||
echo "NCLOUD_SECRET_KEY=$NCLOUD_SECRET_KEY" >> .env | ||
echo "NCLOUD_BUCKET_NAME=$NCLOUD_BUCKET_NAME" >> .env | ||
echo "NCLOUD_REGISTRY_URL=$NCLOUD_REGISTRY_URL" >> .env | ||
echo "API_SERVER_URL=$API_SERVER_URL" >> .env | ||
echo "CDN_URL=$CDN_URL" >> .env | ||
sudo docker login -u $NCLOUD_ACCESS_KEY -p $NCLOUD_SECRET_KEY $NCLOUD_REGISTRY_URL | ||
sudo docker stop record-camon || true | ||
sudo docker rm record-camon || true | ||
sudo docker rmi ${{ secrets.NCLOUD_REGISTRY_URL }}/record-camon:latest || true | ||
sudo docker pull ${{ secrets.NCLOUD_REGISTRY_URL }}/$IMAGE_NAME:latest | ||
sudo docker rmi $NCLOUD_REGISTRY_URL/record-camon:latest || true | ||
sudo docker pull $NCLOUD_REGISTRY_URL/record-camon:latest | ||
sudo docker tag $NCLOUD_REGISTRY_URL/record-camon:latest record-camon | ||
|
||
sudo docker-compose up -d record | ||
|
||
sudo docker image prune -f | ||
- name: Check container status | ||
uses: appleboy/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ GG_CALLBACK_URL= | |
|
||
|
||
#JWT | ||
JWT_SECRET= | ||
JWT_SECRET= | ||
CALLBACK_URI= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export class CreateRecordDto { | ||
title: string; | ||
roomId: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Record } from '../record.entity'; | ||
|
||
class RecordDto { | ||
@ApiProperty() | ||
recordId: number; | ||
|
||
@ApiProperty() | ||
video: string; | ||
|
||
@ApiProperty() | ||
title: string; | ||
|
||
@ApiProperty() | ||
date: string; | ||
|
||
static from(record: Record) { | ||
const dto = new RecordDto(); | ||
dto.recordId = record.id; | ||
dto.video = record.video; | ||
dto.title = record.title; | ||
dto.date = this.formatDate(new Date(record.attendance.startTime)); | ||
return dto; | ||
} | ||
|
||
static fromList(records: Record[]) { | ||
return records.map(record => this.from(record)); | ||
} | ||
|
||
private static formatDate(date: Date): string { | ||
return date | ||
.toLocaleDateString('ko-KR', { | ||
year: 'numeric', | ||
month: '2-digit', | ||
day: '2-digit', | ||
}) | ||
.replace(/\. /g, '.') | ||
.slice(0, -1); | ||
} | ||
} | ||
|
||
export class RecordsResponseDto { | ||
@ApiProperty({ | ||
type: RecordDto, | ||
isArray: true, | ||
}) | ||
records: RecordDto[]; | ||
|
||
static from(records: Record[]) { | ||
const dto = new RecordsResponseDto(); | ||
dto.records = RecordDto.fromList(records); | ||
|
||
return dto; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export class UpdateRecordDto { | ||
video: string; | ||
roomId: string; | ||
} |
Oops, something went wrong.