Skip to content

✨ feat: connectionLimit 증가 (#75) #45

✨ feat: connectionLimit 증가 (#75)

✨ feat: connectionLimit 증가 (#75) #45

Workflow file for this run

name: auto deploy
on:
push:
branches:
- feature/75-server-scale-out-nginx
jobs:
push_to_registry:
name: Push to ncp container registry
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to NCP Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- name: build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/backend:latest
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/prv-backend:latest
cache-to: type=inline
secrets: |
GIT_AUTH_TOKEN=${{ secrets.GIT_TOKEN }}
- name: Build and push backend-flame
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile.clinic-flame
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/backend-flame:latest
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/prv-backend-flame:latest
cache-to: type=inline
secrets: |
GIT_AUTH_TOKEN=${{ secrets.GIT_TOKEN }}
pull_from_registry:
name: Connect server ssh and pull from container registry
needs: push_to_registry
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy docker-compose file to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.DEV_USERNAME }}
password: ${{ secrets.DEV_PASSWORD }}
port: ${{ secrets.DEV_PORT }}
source: "docker-compose.yml"
target: "~/"
- name: connect ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.DEV_USERNAME }}
password: ${{ secrets.DEV_PASSWORD }}
port: ${{ secrets.DEV_PORT }}
script: |
echo "DB_TYPE=${{ secrets.DB_TYPE }}" > .env
echo "DB_HOST=${{ secrets.DB_HOST }}" >> .env
echo "DB_PORT=${{ secrets.DB_PORT }}" >> .env
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> .env
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env
echo "DB_DATABASE=${{ secrets.DB_DATABASE }}" >> .env
echo "DB_SYNCHRONIZE=${{ secrets.DB_SYNCHRONIZE }}" >> .env
echo "JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}" >> .env
echo "MAIL_HOST=${{ secrets.MAIL_HOST }}" >> .env
echo "MAIL_PORT=${{ secrets.MAIL_PORT }}" >> .env
echo "MAIL_USER=${{ secrets.MAIL_USER }}" >> .env
echo "MAIL_PWD=${{ secrets.MAIL_PWD }}" >> .env
echo "API_BASE_URL=${{ secrets.API_BASE_URL }}" >> .env
echo "SERVER_PORT=${{ secrets.SERVER_PORT }}" >> .env
echo "NCP_CONTAINER_REGISTRY=${{ secrets.NCP_CONTAINER_REGISTRY }}" >> .env
echo "BACKEND_OUTBOUND_PORT=${{ secrets.BACKEND_OUTBOUND_PORT }}" >> .env
echo "BACKEND_INBOUND_PORT=${{ secrets.BACKEND_INBOUND_PORT }}" >> .env
echo "MYSQL_OUTBOUND_PORT=${{ secrets.MYSQL_OUTBOUND_PORT }}" >> .env
echo "MYSQL_INBOUND_PORT=${{ secrets.MYSQL_INBOUND_PORT }}" >> .env
echo "MYSQL_ROOT_PASSWORD=${{ secrets.MYSQL_ROOT_PASSWORD }}" >> .env
echo "JWT_ACCESS_TOKEN_EXPIRATION=${{ secrets.JWT_ACCESS_TOKEN_EXPIRATION }}" >> .env
echo "JWT_REFRESH_TOKEN_EXPIRATION=${{ secrets.JWT_REFRESH_TOKEN_EXPIRATION }}" >> .env
echo "N_ACCESS_KEY=${{ secrets.N_ACCESS_KEY }}" >> .env
echo "N_SECRET_KEY=${{ secrets.N_SECRET_KEY }}" >> .env
echo "N_ENDPOINT=${{ secrets.N_ENDPOINT }}" >> .env
echo "N_REGION=${{ secrets.N_REGION }}" >> .env
echo "N_BUCKET_NAME=${{ secrets.N_BUCKET_NAME }}" >> .env
echo "N_BUCKET_URL=${{ secrets.N_BUCKET_URL }}" >> .env
docker-compose down
docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/backend:latest
docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/backend-flame:latest
docker-compose up -d --scale backend=3 mysql-prod nginx
docker image prune -f