-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #330 from boostcampwm-2022/develop
Production Server Release v1.0.0
- Loading branch information
Showing
457 changed files
with
86,001 additions
and
1 deletion.
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,95 @@ | ||
name: Backend Dev CD | ||
run-name: ${{ github.actor }}๊ฐ ์คํํจ | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
paths: | ||
- 'backend/**' | ||
- '.github/workflows/backend-dev-cd.yml' | ||
- '.github/workflows/slack-notification.yml' | ||
|
||
jobs: | ||
Register-Docker-Image: | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: './backend' | ||
outputs: | ||
status: ${{ job.status }} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: backend environment setting | ||
run: | | ||
touch .env.development | ||
echo -e ${{ secrets.BACKEND_DEVELOPMENT_ENVIRONMENT }} > .env.development | ||
- name: docker registry login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ secrets.NCP_DOCKER_REGISTRY }} | ||
username: ${{ secrets.NCP_ACCESS_KEY }} | ||
password: ${{ secrets.NCP_SECRET_KEY }} | ||
|
||
- name: build and push | ||
id: docker_build | ||
uses: docker/[email protected] | ||
with: | ||
context: backend | ||
file: backend/Dockerfile | ||
tags: | | ||
${{ secrets.NCP_DOCKER_REGISTRY }}/moyeo-server:latest | ||
${{ secrets.NCP_DOCKER_REGISTRY }}/moyeo-server:${{ github.sha }} | ||
push: true | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
||
CD: | ||
needs: [Register-Docker-Image] | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: './backend' | ||
outputs: | ||
status: ${{ job.status }} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: copy docker compose & config file into dev server | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.BACKEND_DEV_REMOTE_IP }} | ||
username: ${{ secrets.BACKEND_DEV_REMOTE_SSH_ID }} | ||
password: ${{ secrets.BACKEND_DEV_REMOTE_ADMIN_KEY }} | ||
port: ${{ secrets.BACKEND_DEV_REMOTE_SSH_PORT }} | ||
source: 'backend/docker-compose.yml,backend/nginx/dev/nginx.conf,backend/scripts/dev-deploy.sh' | ||
target: 'moyeomoyeo' | ||
|
||
- name: deploy | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{secrets.BACKEND_DEV_REMOTE_IP}} | ||
username: ${{secrets.BACKEND_DEV_REMOTE_SSH_ID}} | ||
password: ${{secrets.BACKEND_DEV_REMOTE_ADMIN_KEY}} | ||
port: ${{secrets.BACKEND_DEV_REMOTE_SSH_PORT}} | ||
script: | | ||
cd moyeomoyeo | ||
sudo chmod +x ./backend/scripts/dev-deploy.sh | ||
./backend/scripts/dev-deploy.sh ${{ secrets.NCP_ACCESS_KEY }} ${{ secrets.NCP_SECRET_KEY }} ${{ secrets.NCP_DOCKER_REGISTRY }} ${{ secrets.BACKEND_DEVELOPMENT_ENVIRONMENT }} | ||
slack-notifications: | ||
needs: [Register-Docker-Image, CD] | ||
if: ${{ always() }} | ||
uses: ./.github/workflows/slack-notification.yml | ||
with: | ||
title: ๋ฐฑ์๋ ๊ฐ๋ฐ์ฉ CD | ||
status: '${{ needs.CD.outputs.status }}' | ||
commit_url: ${{ github.event.pull_request.html_url || github.event.head_commit.url }} | ||
secrets: | ||
webhook_url: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK_URL }} |
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,82 @@ | ||
name: Backend Dev CI | ||
run-name: ${{ github.actor }}๊ฐ ์คํํจ | ||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
paths: | ||
- 'backend/**' | ||
- '.github/workflows/backend-dev-ci.yml' | ||
- '.github/workflows/slack-notification.yml' | ||
jobs: | ||
CI: | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: './backend' | ||
outputs: | ||
status: ${{ job.status }} | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MYSQL_ROOT_PASSWORD: 'test' | ||
MYSQL_USER: 'test' | ||
MYSQL_PASSWORD: 'test' | ||
MYSQL_DATABASE: 'test' | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=3 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: nodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.18.1 | ||
|
||
- name: Cache dependencies | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: dependency install | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: npm ci | ||
|
||
- name: create environment variable file | ||
run: | | ||
touch .env.test | ||
echo -e ${{ secrets.BACKEND_CI_TEST_ENVIRONMENT }} > .env.test | ||
- name: lint test | ||
run: npm run lint | ||
|
||
- name: build | ||
run: npm run build | ||
|
||
- name: test | ||
run: npm run test | ||
|
||
- name: e2e test | ||
run: npm run test:e2e | ||
|
||
slack-notifications: | ||
needs: [CI] | ||
if: ${{ always() }} | ||
uses: ./.github/workflows/slack-notification.yml | ||
with: | ||
title: ๋ฐฑ์๋ ๊ฐ๋ฐ์ฉ CI | ||
status: '${{ needs.CI.outputs.status }}' | ||
commit_url: ${{ github.event.pull_request.html_url || github.event.head_commit.url }} | ||
secrets: | ||
webhook_url: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK_URL }} |
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,107 @@ | ||
name: Backend Production CD | ||
run-name: ${{ github.actor }}๊ฐ ์คํํจ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'backend/**' | ||
- '.github/workflows/backend-prod-cd.yml' | ||
- '.github/workflows/slack-notification.yml' | ||
|
||
jobs: | ||
Register-Docker-Image: | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: './backend' | ||
outputs: | ||
status: ${{ job.status }} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: take tag version and push tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create a GitHub release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
|
||
- name: backend environment setting | ||
run: | | ||
touch .env.production | ||
echo -e ${{ secrets.BACKEND_PRODUCTION_ENVIRONMENT }} > .env.production | ||
- name: docker registry login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ secrets.NCP_DOCKER_REGISTRY }} | ||
username: ${{ secrets.NCP_ACCESS_KEY }} | ||
password: ${{ secrets.NCP_SECRET_KEY }} | ||
|
||
- name: build and push | ||
id: docker_build | ||
uses: docker/[email protected] | ||
with: | ||
context: backend | ||
file: backend/Dockerfile | ||
tags: | | ||
${{ secrets.NCP_DOCKER_REGISTRY }}/moyeo-server-production:latest | ||
${{ secrets.NCP_DOCKER_REGISTRY }}/moyeo-server-production:${{ steps.tag_version.outputs.new_tag }} | ||
push: true | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
||
CD: | ||
needs: [Register-Docker-Image] | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: './backend' | ||
outputs: | ||
status: ${{ job.status }} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: copy docker compose & config file into production server | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.BACKEND_PROD_REMOTE_IP }} | ||
username: ${{ secrets.BACKEND_PROD_REMOTE_SSH_ID }} | ||
password: ${{ secrets.BACKEND_PROD_REMOTE_ADMIN_KEY }} | ||
port: ${{ secrets.BACKEND_PROD_REMOTE_SSH_PORT }} | ||
source: 'backend/docker-compose.prod.yml,backend/nginx/prod/nginx.conf,backend/scripts/prod-deploy.sh' | ||
target: 'moyeomoyeo' | ||
|
||
- name: deploy | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.BACKEND_PROD_REMOTE_IP }} | ||
username: ${{ secrets.BACKEND_PROD_REMOTE_SSH_ID }} | ||
password: ${{ secrets.BACKEND_PROD_REMOTE_ADMIN_KEY }} | ||
port: ${{ secrets.BACKEND_PROD_REMOTE_SSH_PORT }} | ||
script: | | ||
cd moyeomoyeo | ||
sudo chmod +x ./backend/scripts/prod-deploy.sh | ||
./backend/scripts/prod-deploy.sh ${{ secrets.NCP_ACCESS_KEY }} ${{ secrets.NCP_SECRET_KEY }} ${{ secrets.NCP_DOCKER_REGISTRY }} ${{ secrets.BACKEND_PRODUCTION_ENVIRONMENT }} | ||
slack-notifications: | ||
needs: [Register-Docker-Image, CD] | ||
if: ${{ always() }} | ||
uses: ./.github/workflows/slack-notification.yml | ||
with: | ||
title: ๋ฐฑ์๋ Production CD | ||
status: '${{ needs.CD.outputs.status }}' | ||
commit_url: ${{ github.event.pull_request.html_url || github.event.head_commit.url }} | ||
secrets: | ||
webhook_url: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK_URL }} |
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,82 @@ | ||
name: Backend Production CI | ||
run-name: ${{ github.actor }}๊ฐ ์คํํจ | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'backend/**' | ||
- '.github/workflows/backend-prod-ci.yml' | ||
- '.github/workflows/slack-notification.yml' | ||
jobs: | ||
CI: | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: './backend' | ||
outputs: | ||
status: ${{ job.status }} | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MYSQL_ROOT_PASSWORD: 'test' | ||
MYSQL_USER: 'test' | ||
MYSQL_PASSWORD: 'test' | ||
MYSQL_DATABASE: 'test' | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=3 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: nodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.18.1 | ||
|
||
- name: Cache dependencies | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-production | ||
|
||
- name: dependency install | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: npm ci | ||
|
||
- name: create environment variable file | ||
run: | | ||
touch .env.test | ||
echo -e ${{ secrets.BACKEND_CI_TEST_ENVIRONMENT }} > .env.test | ||
- name: lint test | ||
run: npm run lint | ||
|
||
- name: build | ||
run: npm run build | ||
|
||
- name: test | ||
run: npm run test | ||
|
||
- name: e2e test | ||
run: npm run test:e2e | ||
|
||
slack-notifications: | ||
needs: [CI] | ||
if: ${{ always() }} | ||
uses: ./.github/workflows/slack-notification.yml | ||
with: | ||
title: Backend Production CI | ||
status: '${{ needs.CI.outputs.status }}' | ||
commit_url: ${{ github.event.pull_request.html_url || github.event.head_commit.url }} | ||
secrets: | ||
webhook_url: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK_URL }} |
Oops, something went wrong.