Skip to content

Commit

Permalink
chore: update directory name (#568)
Browse files Browse the repository at this point in the history
* chore: update directory name

* chore: update env name

* chore: update prod script

* chore: service-url.inc 파일명 변경

* chore: trigger setting for test

* test: prod deploy

* chore: test용 trigger 삭제
  • Loading branch information
jun02160 authored Jan 1, 2025
1 parent aa87e2f commit 1b6705f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/cd-to-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
username: ${{ secrets.RELEASE_SERVER_USER }}
key: ${{ secrets.DEV_RELEASE_SERVER_KEY }}
source: "./docker-compose.yml"
target: "/home/ec2-user/app/"
target: "/home/ec2-user/playground/"

- name: 'Send deploy script to EC2 Instance'
uses: appleboy/scp-action@master
Expand All @@ -94,7 +94,7 @@ jobs:
username: ${{ secrets.RELEASE_SERVER_USER }}
key: ${{ secrets.DEV_RELEASE_SERVER_KEY }}
source: "./scripts/"
target: "/home/ec2-user/app/"
target: "/home/ec2-user/playground/"

- name: 'Get current time'
uses: 1466587594/get-current-time@v2
Expand All @@ -113,6 +113,6 @@ jobs:
script: |
cd ~
sudo docker pull $ECR_REPO
sudo chmod +x ./app/scripts/*.sh
./app/scripts/deploy.sh
sudo chmod +x ./playground/scripts/*.sh
./playground/scripts/deploy.sh
docker image prune -f
8 changes: 4 additions & 4 deletions .github/workflows/cd-to-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
username: ${{ secrets.RELEASE_SERVER_USER }}
key: ${{ secrets.PROD_RELEASE_SERVER_KEY }}
source: "./docker-compose.yml"
target: "/home/ec2-user/app/"
target: "/home/ec2-user/playground/"

- name: 'Send deploy script to EC2 Instance'
uses: appleboy/scp-action@master
Expand All @@ -93,7 +93,7 @@ jobs:
username: ${{ secrets.RELEASE_SERVER_USER }}
key: ${{ secrets.PROD_RELEASE_SERVER_KEY }}
source: "./scripts/"
target: "/home/ec2-user/app/"
target: "/home/ec2-user/playground/"

- name: 'Get current time'
uses: 1466587594/get-current-time@v2
Expand All @@ -112,6 +112,6 @@ jobs:
script: |
cd ~
sudo docker pull $ECR_REPO
sudo chmod +x ./app/scripts/*.sh
./app/scripts/deploy.sh
sudo chmod +x ./playground/scripts/*.sh
./playground/scripts/deploy.sh
docker image prune -f
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.8'
services:
playground-blue:
image: ${ECR_REPO}
image: ${PLAYGROUND_ECR_REPO}
expose:
- 8080
ports:
Expand All @@ -11,7 +11,7 @@ services:
- SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE}

playground-green:
image: ${ECR_REPO}
image: ${PLAYGROUND_ECR_REPO}
expose:
- 8080
ports:
Expand Down
8 changes: 4 additions & 4 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
cd /home/ec2-user/app

# Source the external scripts to load their functions
source /home/ec2-user/app/scripts/health_check.sh
source /home/ec2-user/app/scripts/deploy_container.sh
source /home/ec2-user/app/scripts/nginx_reload.sh
source /home/ec2-user/app/scripts/stop_container.sh
source /home/ec2-user/playground/scripts/health_check.sh
source /home/ec2-user/playground/scripts/deploy_container.sh
source /home/ec2-user/playground/scripts/nginx_reload.sh
source /home/ec2-user/playground/scripts/stop_container.sh

ALL_PORTS=("8080","8081")

Expand Down
4 changes: 2 additions & 2 deletions scripts/nginx_reload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ reload_nginx() {

echo "▶️ Nginx Reload (Port switching applied) ..."

echo "set \$service_url http://127.0.0.1:${PORT};" | sudo tee /etc/nginx/conf.d/service-url.inc
echo "set \$service_url http://127.0.0.1:${PORT};" | sudo tee /etc/nginx/conf.d/playground-url.inc
sudo nginx -s reload
echo "Current running Port after switching: $(sudo cat /etc/nginx/conf.d/service-url.inc)"
echo "Current running Port after switching: $(sudo cat /etc/nginx/conf.d/playground-url.inc)"
}

0 comments on commit 1b6705f

Please sign in to comment.