Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Nginx Blue/Green 무중단 배포 구현 #259

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/develop-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,24 @@ jobs:
docker tag app ${{ secrets.DOCKER_USERNAME }}/phote:latest
docker push ${{ secrets.DOCKER_USERNAME }}/phote:latest

- name: Send docker-compose.yml
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DEV_PRIVATE_KEY }}
port: ${{ secrets.DEV_PORT }}
source: "./docker-compose.yml"
target: "/home/ubuntu/"

- name: Deploy
uses: appleboy/[email protected]
env:
COMPOSE: "/home/ubuntu/compose/docker-compose-dev.yml"
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.DEV_PRIVATE_KEY }}
port: ${{ secrets.DEV_PORT }}
envs: COMPOSE
script: |
sudo docker-compose -f $COMPOSE down --rmi all
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/phote:latest
sudo docker-compose -f $COMPOSE up -d
sudo chmod 777 ./deploy.sh
sudo docker image prune -f
19 changes: 13 additions & 6 deletions .github/workflows/production-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,24 @@ jobs:
docker tag app ${{ secrets.DOCKER_USERNAME }}/prod-phote:latest
docker push ${{ secrets.DOCKER_USERNAME }}/prod-phote:latest

- name: Send docker-compose.yml
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PROD_PRIVATE_KEY }}
port: ${{ secrets.DEV_PORT }}
source: "./docker-compose.yml"
target: "/home/ubuntu/"

- name: Deploy
uses: appleboy/[email protected]
env:
COMPOSE: "/home/ubuntu/compose/docker-compose-dev.yml"
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PROD_PRIVATE_KEY }}
port: ${{ secrets.DEV_PORT }}
envs: COMPOSE
script: |
sudo docker compose -f $COMPOSE down --rmi all
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/prod-phote:latest
sudo docker compose -f $COMPOSE up -d
docker pull ${{ secrets.DOCKER_USERNAME }}/prod-phote:latest
sudo chmod 777 ./deploy.sh
docker image prune -f
19 changes: 7 additions & 12 deletions docker-compose-dev.yml → docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
services:
redis:
image: redis:latest
container_name: myredis
blue:
image: rinpark/phote:latest
restart: unless-stopped
volumes:
- /var/lib/docker/volumes/redis-volume/_data:/data
ports:
- "6379:6379"
container_name: myphote
environment:
- TZ=Asia/Seoul
hostname: redis
ports:
- "8082:8080"
networks:
- phote-network

jarimage:
depends_on:
- redis
green:
image: rinpark/phote:latest
restart: unless-stopped
container_name: myphote
environment:
- TZ=Asia/Seoul
ports:
- "8080:8080"
- "8081:8080"
networks:
- phote-network

Expand Down
Loading