From 67f5d815c97f278275a0f5edff900cf384ce0fd8 Mon Sep 17 00:00:00 2001 From: TtiPo Date: Sun, 19 Jul 2026 18:15:38 +0900 Subject: [PATCH] =?UTF-8?q?DB=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=EC=9D=84=20postgres=EC=97=90=EC=84=9C=20db=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - depends_on, DB_HOST 기본값도 db로 갱신 - deploy: 서비스 이름 변경으로 남는 orphan 컨테이너 정리를 위해 --remove-orphans 추가 Co-Authored-By: Claude Fable 5 --- .env.example | 2 +- .gitea/workflows/deploy.yml | 2 +- docker-compose.yml | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 35141536..d8e29e02 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,7 @@ # PostgreSQL DB_PORT=5432 -DB_HOST=postgres +DB_HOST=db DB_USER= DB_PASSWORD= DB_NAME=report_db diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 98303563..a83296c7 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -43,7 +43,7 @@ jobs: - name: Restart containers run: | cd "$DEPLOY_DIR" - docker compose up -d + docker compose up -d --remove-orphans # backend/frontend는 항상 새로 기동: DB 교체 시 스키마 재동기화, # nginx의 낡은 upstream IP 캐시 방지 docker compose up -d --no-deps --force-recreate backend frontend diff --git a/docker-compose.yml b/docker-compose.yml index b6b3c5ef..944c422c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ services: - postgres: + db: image: postgres:16-alpine container_name: report-db restart: always @@ -14,7 +14,7 @@ services: networks: - app-network healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-report_db}"] + test: [ "CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-report_db}" ] interval: 5s timeout: 5s retries: 20 @@ -27,7 +27,7 @@ services: expose: - "3000" environment: - - DB_HOST=${DB_HOST:-postgres} + - DB_HOST=${DB_HOST:-db} - DB_PORT=${DB_PORT:-5432} - DB_USER=${DB_USER:-postgres} - DB_PASSWORD=${DB_PASSWORD:?DB_PASSWORD가 .env에 설정되어야 합니다} @@ -38,7 +38,7 @@ services: - ADMIN_PASS=${ADMIN_PASS:?ADMIN_PASS가 .env에 설정되어야 합니다} - JEMINI_KEY=${JEMINI_KEY} depends_on: - postgres: + db: condition: service_healthy volumes: - ./backend/img:/app/img @@ -63,4 +63,4 @@ networks: driver: bridge # npm(Nginx Proxy Manager)이 컨테이너 이름으로 라우팅하는 공용 네트워크 proxy: - external: true \ No newline at end of file + external: true