Skip to content

Commit

Permalink
chore: docker-compse 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
clean2001 committed Oct 30, 2024
1 parent f7bedb1 commit 464580d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 20 deletions.
6 changes: 3 additions & 3 deletions layer-api/infra/production/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if [ -z $IS_GREEN ];then # blue라면
echo "1. get green image"

echo "2. green container up"
sudo docker-compose up -d green # green 컨테이너 실행
sudo docker-compose -f docker-compose-green.yaml up -d

while [ 1 = 1 ]; do
echo "3. green health check..."
Expand All @@ -28,14 +28,14 @@ if [ -z $IS_GREEN ];then # blue라면
sudo nginx -s rel

echo "5. blue container down"
sudo docker-compose stop blue
sudo docker-compose down blue
else
echo "1. get green image"
cd ./layer-api/infra/production


echo "2. blue container up"
sudo sdocker-compose up -d blue # green 컨테이너 실행
sudo docker-compose -f docker-compose-blue.yaml up -d


while [ 1 = 1 ]; do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
blue:
image: docker.io/clean01/layer-server_layer-api:latest
container_name: layer-api
container_name: blue
ports:
- "8080:8080"
environment:
Expand All @@ -14,24 +14,9 @@ services:
networks:
- app-network

green:
image: docker.io/clean01/layer-server_layer-api:latest
container_name: layer-api
ports:
- "8081:8080"
environment:
- TZ=Asia/Seoul
- SPRING_PROFILES_ACTIVE=prod
volumes:
- ./application-secret.properties:/config/application-secret.properties
- ./log:/log
- ./tokens:/config/tokens
networks:
- app-network

batch-job:
image: docker.io/clean01/layer-server_layer-batch:latest
container_name: layer-batch
container_name: layer-batch_blue
environment:
- TZ=Asia/Seoul
volumes:
Expand Down
47 changes: 47 additions & 0 deletions layer-api/infra/production/docker-compose-green.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
services:
blue:
image: docker.io/clean01/layer-server_layer-api:latest
container_name: blue
ports:
- "8080:8080"
environment:
- TZ=Asia/Seoul
- SPRING_PROFILES_ACTIVE=prod
volumes:
- ./application-secret.properties:/config/application-secret.properties
- ./log:/log
- ./tokens:/config/tokens
networks:
- app-network

batch-job:
image: docker.io/clean01/layer-server_layer-batch:latest
container_name: layer-batch_blue
environment:
- TZ=Asia/Seoul
volumes:
- ./application-secret.properties:/config/application-secret.properties
- ./log:/log
- ./tokens:/config/tokens
networks:
- app-network
depends_on:
- blue
- green
restart: always

nginx:
image: nginx:latest
container_name: nginx
depends_on:
- blue
- green
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
networks:
- app-network

networks:
app-network:

0 comments on commit 464580d

Please sign in to comment.