Skip to content

Commit

Permalink
test: loadbalancing test
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungGwan123 committed Dec 1, 2024
1 parent 411f717 commit 50eaaf1
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 118 deletions.
201 changes: 87 additions & 114 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
- dev
- dev-be
- load-test
- feature-be-#164
jobs:
build_and_deploy:
runs-on: ubuntu-latest
Expand All @@ -16,18 +16,16 @@ jobs:
- server: main
host: ${{ vars.SSH_HOST }}
type: full
# - 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
- 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

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -69,53 +67,41 @@ jobs:
target: /corinee
overwrite: true

# - name: Send files to loadbalancer
# if: matrix.type == 'api'
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.LOAD_SSH_HOST }}
# username: ${{ secrets.SSH_USERNAME }}
# password: ${{ secrets.LOAD_SSH_PASSWORD }}
# port: ${{ secrets.SSH_PORT }}
# source: "docker-compose.server.yml,.env"
# 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 == 'api'
uses: appleboy/scp-action@master
with:
host: ${{ secrets.LOAD_SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.LOAD_SSH_PASSWORD }}
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 == '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 == '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: 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: Deploy to main server
if: matrix.type == 'full'
Expand All @@ -133,62 +119,49 @@ jobs:
docker-compose up -d
docker image prune -f
# - name: Deploy to loadbalancer1
# if: matrix.type == 'api'
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.LOAD_SSH_HOST }}
# username: ${{ secrets.SSH_USERNAME }}
# password: ${{ secrets.LOAD_SSH_PASSWORD }}
# port: ${{ secrets.SSH_PORT }}
# script: |
# cd /corinee
# docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
# docker-compose -f docker-compose.server.yml down
# docker-compose -f docker-compose.server.yml up -d
# docker image prune -f
# - name: Deploy to loadbalancer2
# if: matrix.type == 'api2'
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.LOAD_SSH_HOST_2 }}
# username: ${{ secrets.SSH_USERNAME }}
# password: ${{ secrets.LOAD_SSH_PASSWORD_2 }}
# port: ${{ secrets.SSH_PORT }}
# script: |
# cd /corinee
# docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
# docker-compose -f docker-compose.server.yml down
# docker-compose -f docker-compose.server.yml up -d
# docker image prune -f
# - name: Deploy to loadbalancer3
# if: matrix.type == 'api3'
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.LOAD_SSH_HOST_3 }}
# username: ${{ secrets.SSH_USERNAME }}
# password: ${{ secrets.LOAD_SSH_PASSWORD_3 }}
# port: ${{ secrets.SSH_PORT }}
# script: |
# cd /corinee
# docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
# docker-compose -f docker-compose.server.yml down
# docker-compose -f docker-compose.server.yml up -d
# docker image prune -f
# - name: Deploy to loadbalancer4
# if: matrix.type == 'api4'
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.LOAD_SSH_HOST_4 }}
# username: ${{ secrets.SSH_USERNAME }}
# password: ${{ secrets.LOAD_SSH_PASSWORD_4 }}
# port: ${{ secrets.SSH_PORT }}
# script: |
# cd /corinee
# docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
# docker-compose -f docker-compose.server.yml down
# docker-compose -f docker-compose.server.yml up -d
# docker image prune -f
- name: Deploy to loadbalancer1
if: matrix.type == 'api'
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.LOAD_SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.LOAD_SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /corinee
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
docker-compose -f docker-compose.server.yml down
docker-compose -f docker-compose.server.yml up -d
docker image prune -f
- name: Deploy to loadbalancer2
if: matrix.type == 'api2'
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.LOAD_SSH_HOST_2 }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.LOAD_SSH_PASSWORD_2 }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /corinee
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
docker-compose -f docker-compose.server.yml down
docker-compose -f docker-compose.server.yml up -d
docker image prune -f
- name: Deploy to loadbalancer3
if: matrix.type == 'api3'
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.LOAD_SSH_HOST_3 }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.LOAD_SSH_PASSWORD_3 }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /corinee
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
docker-compose -f docker-compose.server.yml down
docker-compose -f docker-compose.server.yml up -d
docker image prune -f
- name: Generate Error Report
if: failure()
run: |
Expand Down
8 changes: 4 additions & 4 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ http {
upstream api_servers {
#least_conn;
server corinee_server_1:3000 weight=4 max_fails=3 fail_timeout=30s;
# server 223.130.134.167:3000 weight=8 max_fails=3 fail_timeout=30s;
# server 223.130.130.192:3000 weight=8 max_fails=3 fail_timeout=30s;
# server 211.188.59.137:3000 weight=8 max_fails=3 fail_timeout=30s;
# server 211.188.59.126:3000 weight=1 max_fails=3 fail_timeout=30s;
server 223.130.134.167:3000 weight=8 max_fails=3 fail_timeout=30s;
server 223.130.130.192:3000 weight=8 max_fails=3 fail_timeout=30s;
server 211.188.59.137:3000 weight=8 max_fails=3 fail_timeout=30s;

# server 124.28.132.80:7999 weight=80 max_fails=3 fail_timeout=30s;
keepalive 300;
keepalive_requests 1000;
Expand Down

0 comments on commit 50eaaf1

Please sign in to comment.