Skip to content

Commit

Permalink
chore : docker-compose.yml 수정한다
Browse files Browse the repository at this point in the history
  • Loading branch information
packdev937 committed May 7, 2024
1 parent a7ca3db commit 319fdc9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ jobs:
port: 22
script: |
sudo docker login -u ${{ secrets.DOCKER_ID }} -p ${{ secrets.DOCKER_PASSWORD }}
sudo docker-compose down
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/server
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/batch
sudo chmod +x deploy.sh
sudo chmod +x docker-compose.yml
sudo nohup docker-compose up &
sudo ./deploy.sh
sudo docker image prune -f
25 changes: 13 additions & 12 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ else
fi

#RUNNING_CONTAINER=$(docker ps | grep blue)
#NGINX_CONF="/home/ec2-user/data/nginx/app.conf"
NGINX_CONF="/home/ec2-user/data/nginx/app.conf"
RUNNING_NGINX=$(docker ps | grep nginx)
BATCH_CONTAINER="batch"
TARGET_SERVICE = "server"

#if [ -z "$RUNNING_CONTAINER" ]; then
# TARGET_SERVICE="blue-api"
Expand All @@ -44,25 +45,25 @@ BATCH_CONTAINER="batch"
# OTHER_PORT="8082"
#fi


#echo "$TARGET_SERVICE Deploy..."
#docker-compose -f /home/ec2-user/docker-compose.yml up -d $TARGET_SERVICE $BATCH_CONTAINER
docker-compose -f /home/ec2-user/docker-compose.yml up -d $TARGET_SERVICE $BATCH_CONTAINER

# Wait for the target service to be healthy before proceeding
sleep 10

#if [ -z "$RUNNING_NGINX" ]; then
# echo "Starting Nginx... Changing port to $TARGET_PORT"
# docker-compose -f /home/ec2-user/docker-compose.yml up -d nginx
#fi
if [ -z "$RUNNING_NGINX" ]; then
echo "Starting Nginx... Changing port to $TARGET_PORT"
docker-compose -f /home/ec2-user/docker-compose.yml up -d nginx
fi

#
## Update the nginx config and reload
# Update the nginx config and reload
#sed -i "s/$OTHER_SERVICE/$TARGET_SERVICE/" $NGINX_CONF
#sed -i "s/$OTHER_PORT/$TARGET_PORT/" $NGINX_CONF
#docker-compose -f /home/ec2-user/docker-compose.yml restart nginx
#
## Stop the other service
#docker-compose -f /home/ec2-user/docker-compose.yml stop $OTHER_SERVICE
docker-compose -f /home/ec2-user/docker-compose.yml restart nginx

# Stop the other service
docker-compose -f /home/ec2-user/docker-compose.yml stop $OTHER_SERVICE

# docker-compose down & up
#nohup docker-compose -f /home/ec2-user/docker-compose.yml down > /dev/null 2>&1 &
Expand Down

0 comments on commit 319fdc9

Please sign in to comment.