Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungGwan123 committed Nov 27, 2024
1 parent 24ac49d commit fa0449e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
48 changes: 47 additions & 1 deletion .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ jobs:
- server: loadbalancer
host: ${{ vars.LOAD_SSH_HOST }}
type: api
- server: loadbalancer2
host: ${{ vars.LOAD_SSH_HOST_2 }}
type: api2
- server: loadbalancer3
host: ${{ vars.LOAD_SSH_HOST_3 }}
type: api3
# - server: loadbalancer4
# host: ${{ vars.LOAD_SSH_HOST_4 }}
# type: api4
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -44,11 +53,12 @@ jobs:
echo "${{ secrets.DEPLOY_ENV }}" > .env
- name: Make loadbalancer environment
if: matrix.type == 'api'
if: matrix.type != 'full'
run: |
echo "${{ secrets.LOAD_DEPLOY_ENV }}" > .env
- name: Send files & deploy script
if: matrix.type == 'full'
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
Expand All @@ -71,6 +81,42 @@ jobs:
target: /corinee
overwrite: true

- name: Send files to loadbalancer
if: matrix.type == 'api2'
uses: appleboy/scp-action@master
with:
host: ${{ secrets.LOAD_SSH_HOST_2 }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.LOAD_SSH_PASSWORD_2 }}
port: ${{ secrets.SSH_PORT }}
source: "docker-compose.server.yml,.env"
target: /corinee
overwrite: true

- name: Send files to loadbalancer
if: matrix.type == 'api3'
uses: appleboy/scp-action@master
with:
host: ${{ secrets.LOAD_SSH_HOST_3 }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.LOAD_SSH_PASSWORD_3 }}
port: ${{ secrets.SSH_PORT }}
source: "docker-compose.server.yml,.env"
target: /corinee
overwrite: true

# - name: Send files to loadbalancer
# if: matrix.type == 'api4'
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.LOAD_SSH_HOST_4 }}
# username: ${{ secrets.SSH_USERNAME }}
# password: ${{ secrets.LOAD_SSH_PASSWORD_4 }}
# port: ${{ secrets.SSH_PORT }}
# source: "docker-compose.server.yml,.env"
# target: /corinee
# overwrite: true

- name: Deploy to servers
uses: appleboy/ssh-action@master
with:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
networks:
- app-network
healthcheck: # 헬스체크 추가
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
Expand Down
3 changes: 3 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ http {
least_conn;
server corinee_server_1:3000; # 메인 서버의 API (docker network 내부 이름 사용)
server 223.130.134.167:3000; # 두 번째 서버의 공인 IP
server 223.130.130.192:3000;
server 211.188.59.137:3000;
# server 211.188.59.126:3000;
}

server {
Expand Down

0 comments on commit fa0449e

Please sign in to comment.