Skip to content

Commit

Permalink
[BE#152] preproduction cd (#156)
Browse files Browse the repository at this point in the history
* feat: pre-production workflow 작성

* chore: 포트 환경변수로 변환
  • Loading branch information
victolee0 authored Nov 22, 2023
1 parent 8a7be13 commit 87650ef
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/be-pre-production-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: BE Pre Production Workflow

on:
push:
branches: preproduction
paths: "BE/**"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: connect to NCP
use: appleboy/ssh-action@master
with:
host: ${{ secrets.NCP_HOST }}
username: ${{ secrets.NCP_USERNAME }}
password: ${{ secrets.NCP_PASSWORD }}

script: |
cd iOS06-FlipMate-preproduction/BE
git pull origin preproduction
npm install
if ! pm2 list | grep -q "flipmate-preproduction"; then
pm2 start npm --name "flipmate-preproduction" -- run start
else
pm2 restart flipmate-preproduction
fi
5 changes: 3 additions & 2 deletions BE/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ async function bootstrap() {
const configService = new ConfigService();

let httpsOptions = null;
if (configService.get<boolean>('SSL')) {
const ssl = configService.get<string>('SSL');
if (ssl == 'true') {
httpsOptions = {
key: readFileSync(configService.get<string>('HTTPS_KEY_PATH')),
cert: readFileSync(configService.get<string>('HTTPS_CERT_PATH')),
Expand All @@ -29,6 +30,6 @@ async function bootstrap() {

app.useGlobalPipes(new ValidationPipe());

await app.listen(3000);
await app.listen(configService.get<number>('PORT'));
}
bootstrap();

0 comments on commit 87650ef

Please sign in to comment.