Skip to content

Commit

Permalink
[feat] docker network 설정으로 redis와 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
JeonHaeseung committed Jul 9, 2024
1 parent 5ad18e3 commit d4b53dc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,23 @@ jobs:
host: ${{ secrets.HOST_DEV }}
username: ${{ secrets.USER_DEV }}
key: ${{ secrets.KEY_DEV }}
script: mkdir -p ./dev
script: mkdir -p ./ness

## 소스 코드 복사 붙여넣기
- name: copy source via ssh key
uses: burnett01/[email protected]
with:
switches: -avzr --delete
path: ./config
remote_path: ./dev
remote_path: ./ness
remote_host: ${{ secrets.HOST_DEV }}
remote_user: ${{ secrets.USER_DEV }}
remote_key: ${{ secrets.KEY_DEV }}

## EC2에 배포(CD)
## 아래 두 개는 이미 되어 있는 상태
## docker network create ness_network
## docker network connect ness_network redis-server
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
Expand All @@ -104,4 +107,5 @@ jobs:
sudo docker rm $(sudo docker ps -a --filter="name=backend-server" -q)
sudo docker rmi $(sudo docker images -q)
docker pull jeonhaeseung/ness-server-dev:dev
docker run -d --name backend-server -p 80:8080 --restart unless-stopped jeonhaeseung/ness-server-dev:dev
docker run -d --name backend-server -p 80:8080 --restart unless-stopped jeonhaeseung/ness-server-dev:dev
docker network connect ness_network backend-server
10 changes: 7 additions & 3 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,23 @@ jobs:
host: ${{ secrets.HOST_PROD }}
username: ${{ secrets.USER_PROD }}
key: ${{ secrets.KEY_PROD }}
script: mkdir -p ./prod
script: mkdir -p ./ness

## 소스 코드 복사 붙여넣기
- name: copy source via ssh key
uses: burnett01/[email protected]
with:
switches: -avzr --delete
path: ./config
remote_path: ./prod
remote_path: ./ness
remote_host: ${{ secrets.HOST_PROD }}
remote_user: ${{ secrets.USER_PROD }}
remote_key: ${{ secrets.KEY_PROD }}

## EC2에 배포(CD)
## 아래 두 개는 이미 되어 있는 상태
## docker network create ness_network
## docker network connect ness_network redis-server
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
Expand All @@ -109,4 +112,5 @@ jobs:
sudo docker rm $(sudo docker ps -a --filter="name=backend-server" -q)
sudo docker rmi $(sudo docker images -q)
docker pull jeonhaeseung/ness-server-prod:main
docker run -d --name backend-server -p 80:8080 --restart unless-stopped jeonhaeseung/ness-server-prod:main
docker run -d --name backend-server -p 80:8080 --restart unless-stopped jeonhaeseung/ness-server-prod:main
docker network connect ness_network backend-server
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,4 @@ out/

### Secrets ###
application-dev.yml
application-prod.yml

## etc ###
docker-compose.yml
application-prod.yml
5 changes: 1 addition & 4 deletions config/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ fi

if ! type docker-compose > /dev/null
then
echo "docker does not exist"
echo "Start installing docker"
sudo dnf install -y libxcrypt-compat
echo "docker-compose does not exist"
echo "Start installing docker-compose"
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi

0 comments on commit d4b53dc

Please sign in to comment.