-
Notifications
You must be signed in to change notification settings - Fork 0
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
[CI/CD] 배포 환경 세팅 및 개발 환경세팅 추가 #2
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dff8c4e
feat: 서버 설정 파일 추가
virtue14 dc970a0
ci/cd: 배포 workflow 작성
virtue14 35ed129
feat: nginx 구성 파일 추가
virtue14 023353b
chore: 파비콘 추가
virtue14 8cf2581
chore: index.html 제목 업데이트
virtue14 bd8c3ae
feat: 서버 파일 추가
virtue14 735492f
build: 서버 및 빌드 설정에 대한 vite.config.js 업데이트
virtue14 d739850
docs: PR 템플릿 수정
virtue14 cd83420
ci/cd: 코드리뷰 추가
virtue14 7222e65
ci/cd: PR 리뷰 및 댓글 확인 기능 추가
virtue14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
files: | ||
"/etc/nginx/conf.d/vueapp.conf": | ||
mode: "000755" | ||
owner: root | ||
group: root | ||
content: | | ||
server { | ||
listen 80; | ||
server_name _; | ||
|
||
location / { | ||
root /var/app/current/dist; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
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,23 @@ | ||
name: 코드리뷰 | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: ChatGPT 코드리뷰 | ||
uses: anc95/ChatGPT-CodeReview@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
LANGUAGE: Korean | ||
PROMPT: 다음 코드 차이점에 혼동이나 불규칙이 있는지 확인해주세요(코드리뷰) |
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 |
---|---|---|
@@ -1,90 +1,89 @@ | ||
#name: MarketNawaFE | ||
# | ||
#on: | ||
# push: | ||
# branches: | ||
# - main | ||
# - develop | ||
# | ||
#jobs: | ||
# deploy: | ||
# runs-on: ubuntu-latest | ||
# | ||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v2 | ||
# | ||
# - name: Setup Node.js | ||
# uses: actions/setup-node@v2 | ||
# with: | ||
# node-version: '20.x' | ||
# | ||
# - name: Install dependencies | ||
# run: npm ci | ||
# | ||
# - name: Build project | ||
# run: npm run build | ||
# | ||
# - name: Install AWS CLI | ||
# run: | | ||
# curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | ||
# unzip awscliv2.zip | ||
# sudo ./aws/install --update | ||
# | ||
# - name: Configure AWS credentials | ||
# uses: aws-actions/configure-aws-credentials@v1 | ||
# with: | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# aws-region: ap-northeast-2 | ||
# | ||
# - name: Generate deployment package | ||
# run: | | ||
# mkdir -p .ebextensions | ||
# cat <<EOF > .ebextensions/00-makeFiles.config | ||
# files: | ||
# "/etc/nginx/conf.d/vueapp.conf": | ||
# mode: "000755" | ||
# owner: root | ||
# group: root | ||
# content: | | ||
# server { | ||
# listen 80; | ||
# server_name _; | ||
# | ||
# location / { | ||
# proxy_pass http://127.0.0.1:8080; | ||
# proxy_http_version 1.1; | ||
# proxy_set_header Upgrade \$http_upgrade; | ||
# proxy_set_header Connection 'upgrade'; | ||
# proxy_set_header Host \$host; | ||
# proxy_cache_bypass \$http_upgrade; | ||
# } | ||
# | ||
# error_page 500 502 503 504 /50x.html; | ||
# location = /50x.html { | ||
# root /usr/share/nginx/html; | ||
# } | ||
# } | ||
# EOF | ||
# cat <<EOF > Procfile | ||
# web: node server.js | ||
# EOF | ||
# mkdir -p deploy | ||
# cp -r dist deploy/ | ||
# cp package.json deploy/ | ||
# cp server.js deploy/ | ||
# cp Procfile deploy/ | ||
# cp -r .ebextensions deploy/ | ||
# cd deploy && zip -r deploy.zip . | ||
# | ||
# - name: Beanstalk Deploy | ||
# uses: einaregilsson/beanstalk-deploy@v22 | ||
# with: | ||
# aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# application_name: MarketNawaFE | ||
# environment_name: MarketNawaFE-env | ||
# version_label: github-action-${{ github.sha }} | ||
# region: ap-northeast-2 | ||
# deployment_package: deploy/deploy.zip | ||
name: MarketNawaFE | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20.x' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build project | ||
run: npm run build | ||
|
||
- name: Install AWS CLI | ||
run: | | ||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | ||
unzip awscliv2.zip | ||
sudo ./aws/install --update | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ap-northeast-2 | ||
|
||
- name: Generate deployment package | ||
run: | | ||
mkdir -p .ebextensions | ||
cat <<EOF > .ebextensions/00-makeFiles.config | ||
files: | ||
"/etc/nginx/conf.d/vueapp.conf": | ||
mode: "000755" | ||
owner: root | ||
group: root | ||
content: | | ||
server { | ||
listen 80; | ||
server_name _; | ||
|
||
location / { | ||
proxy_pass http://127.0.0.1:8080; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade \$http_upgrade; | ||
proxy_set_header Connection 'upgrade'; | ||
proxy_set_header Host \$host; | ||
proxy_cache_bypass \$http_upgrade; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
EOF | ||
cat <<EOF > Procfile | ||
web: node server.js | ||
EOF | ||
mkdir -p deploy | ||
cp -r dist deploy/ | ||
cp package.json deploy/ | ||
cp server.js deploy/ | ||
cp Procfile deploy/ | ||
cp -r .ebextensions deploy/ | ||
cd deploy && zip -r deploy.zip . | ||
|
||
- name: Beanstalk Deploy | ||
uses: einaregilsson/beanstalk-deploy@v22 | ||
with: | ||
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
application_name: MarketNawaFE | ||
environment_name: MarketNawaFE-env | ||
version_label: github-action-${{ github.sha }} | ||
region: ap-northeast-2 | ||
deployment_package: deploy/deploy.zip |
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,37 @@ | ||
name: PR 리뷰 및 댓글 확인 | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
pull_request_review: | ||
types: [submitted] | ||
pull_request_review_comment: | ||
types: [created] | ||
|
||
jobs: | ||
check-reviews-and-comments: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 리포지토리 체크아웃 | ||
uses: actions/checkout@v2 | ||
|
||
- name: 풀 리퀘스트 리뷰 및 댓글 가져오기 | ||
id: get_reviews_and_comments | ||
run: | | ||
REVIEWS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews" | jq -r '.[].user.login' | tr '\n' ' ') | ||
COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | jq -r '.[].user.login' | tr '\n' ' ') | ||
ALL_USERS="$REVIEWS $COMMENTS" | ||
echo "ALL_USERS=\"$ALL_USERS\"" >> $GITHUB_ENV | ||
|
||
- name: 고유 사용자 확인 | ||
run: | | ||
echo "ALL_USERS=$ALL_USERS" | ||
UNIQUE_USERS=$(echo "$ALL_USERS" | tr ' ' '\n' | sort | uniq | wc -l) | ||
echo "Unique Users Count: $UNIQUE_USERS" | ||
if [ "$UNIQUE_USERS" -lt 2 ]; then | ||
echo "고유 리뷰어 및 댓글 작성자가 충분하지 않습니다. 머지 전에 최소 2명의 고유 리뷰어 또는 댓글 작성자가 있어야 합니다." | ||
exit 1 | ||
fi | ||
env: | ||
ALL_USERS: ${{ env.ALL_USERS }} | ||
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,30 @@ | ||
mkdir -p .platform | ||
cat <<EOF > .platform/nginx.config | ||
files: | ||
"/etc/nginx/conf.d/vueapp.conf": | ||
mode: "000644" | ||
owner: root | ||
group: root | ||
content: | | ||
server { | ||
listen 80; | ||
server_name _; | ||
|
||
access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/error.log; | ||
|
||
location / { | ||
root /var/app/current/dist; | ||
index index.html; | ||
try_files \$uri \$uri/ /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
container_commands: | ||
01_reload_nginx: | ||
command: "nginx -s reload" | ||
EOF |
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
Binary file not shown.
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,14 @@ | ||
const express = require('express'); | ||
const path = require('path'); | ||
const app = express(); | ||
const PORT = process.env.PORT || 8080; | ||
|
||
app.use(express.static(path.join(__dirname, 'dist'))); | ||
|
||
app.get('*', (req, res) => { | ||
res.sendFile(path.join(__dirname, 'dist', 'index.html')); | ||
}); | ||
|
||
app.listen(PORT, () => { | ||
console.log(`Server is running on port ${PORT}`); | ||
}); |
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 |
---|---|---|
@@ -1,16 +1,27 @@ | ||
import { fileURLToPath, URL } from 'node:url' | ||
import { fileURLToPath, URL } from 'node:url'; | ||
import { defineConfig, loadEnv } from 'vite'; | ||
import vue from '@vitejs/plugin-vue'; | ||
|
||
import { defineConfig } from 'vite' | ||
import vue from '@vitejs/plugin-vue' | ||
export default defineConfig(({ mode }) => { | ||
const env = loadEnv(mode, process.cwd()); | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [ | ||
vue(), | ||
], | ||
resolve: { | ||
alias: { | ||
'@': fileURLToPath(new URL('./src', import.meta.url)) | ||
return { | ||
plugins: [vue()], | ||
resolve: { | ||
alias: { | ||
'@': fileURLToPath(new URL('./src', import.meta.url)) | ||
} | ||
}, | ||
server: { | ||
port: 5173, | ||
}, | ||
build: { | ||
outDir: 'dist', | ||
}, | ||
define: { | ||
'process.env': { | ||
VITE_APP_BACKEND_URL: env.VITE_APP_BACKEND_URL | ||
} | ||
} | ||
} | ||
}) | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주어진 코드는 PR 리뷰 및 댓글을 확인하여 충분한 리뷰어와 댓글 작성자가 있는지 검사하는 GitHub Actions workflow입니다. 코드에 혼동이나 불규칙은 보이지 않습니다. 다만 주의할 점은
curl
과 같은 외부 명령어를 사용할 때 인증 토큰이나 중요 정보가 노출되지 않도록 안전하게 관리해야 합니다.