docker compose 수정

This commit is contained in:
2026-07-31 13:08:06 +09:00
parent 56b73ff160
commit 500f840e93
+73 -79
View File
@@ -1,91 +1,85 @@
version: '3.8'
services: services:
postgres: # --- Reverse Proxy (Nginx) ---
image: postgres:15-alpine nginx:
environment: image: nginx:alpine
POSTGRES_DB: ${POSTGRES_DB:-linkforty} container_name: linkforty-nginx
POSTGRES_USER: ${POSTGRES_USER:-linkforty} restart: always
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
volumes:
- postgres_data:/var/lib/postgresql/data
ports: ports:
- "${POSTGRES_PORT:-5432}:5432" - "80:80"
healthcheck: - "443:443"
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-linkforty}"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:7-alpine
command: redis-server --appendonly yes
ports:
- "${REDIS_PORT:-6379}:6379"
volumes: volumes:
- redis_data:/data - ./nginx/conf.d:/etc/nginx/conf.d
healthcheck: - ./certbot/conf:/etc/letsencrypt
test: ["CMD", "redis-cli", "ping"] - ./certbot/www:/var/www/certbot
interval: 5s - ./nginx/well-known:/etc/nginx/well-known:ro
timeout: 5s
retries: 5
restart: unless-stopped
linkforty:
# Use published image (recommended for production)
image: linkforty/core:latest
# OR build from source (for development)
# Uncomment the lines below and comment out the 'image:' line above
# build:
# context: .
# dockerfile: Dockerfile
depends_on: depends_on:
postgres: - linkforty-prod
condition: service_healthy - linkforty-sandbox
redis:
condition: service_healthy # ==========================================
# 1. 운영 (Prod) 환경
# ==========================================
postgres-prod:
image: postgres:15-alpine
container_name: linkforty-db-prod
restart: always
environment: environment:
# Database configuration POSTGRES_USER: linkforty
DATABASE_URL: postgresql://${POSTGRES_USER:-linkforty}:${POSTGRES_PASSWORD:-changeme}@postgres:5432/${POSTGRES_DB:-linkforty}?sslmode=disable POSTGRES_PASSWORD: secret_password_prod
POSTGRES_DB: linkforty_prod
volumes:
- pgdata_prod:/var/lib/postgresql/data
# Redis configuration redis-prod:
REDIS_URL: redis://redis:6379 image: redis:7-alpine
container_name: linkforty-redis-prod
restart: always
# Server configuration linkforty-prod:
NODE_ENV: ${NODE_ENV:-production} image: linkforty-custom:latest
PORT: ${PORT:-3000} container_name: linkforty-core-prod
HOST: ${HOST:-0.0.0.0} restart: always
environment:
- DATABASE_URL=postgresql://linkforty:secret_password_prod@postgres-prod:5432/linkforty_prod?sslmode=disable
- REDIS_URL=redis://redis-prod:6379
- PORT=3000
depends_on:
- postgres-prod
- redis-prod
# Optional: JWT secret for authentication # ==========================================
# JWT_SECRET: ${JWT_SECRET} # 2. 개발 (Sandbox) 환경
# ==========================================
postgres-sandbox:
image: postgres:15-alpine
container_name: linkforty-db-sandbox
restart: always
environment:
POSTGRES_USER: linkforty
POSTGRES_PASSWORD: secret_password_sandbox
POSTGRES_DB: linkforty_sandbox
volumes:
- pgdata_sandbox:/var/lib/postgresql/data
# Optional: Email configuration redis-sandbox:
# SMTP_HOST: ${SMTP_HOST} image: redis:7-alpine
# SMTP_PORT: ${SMTP_PORT} container_name: linkforty-redis-sandbox
# SMTP_USER: ${SMTP_USER} restart: always
# SMTP_PASS: ${SMTP_PASS}
# EMAIL_FROM: ${EMAIL_FROM}
ports: linkforty-sandbox:
- "${LINKFORTY_PORT:-3000}:3000" image: linkforty-custom:latest
restart: unless-stopped container_name: linkforty-core-sandbox
restart: always
# Health check (optional, uncomment if needed) environment:
# healthcheck: - DATABASE_URL=postgresql://linkforty:secret_password_sandbox@postgres-sandbox:5432/linkforty_sandbox?sslmode=disable
# test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/health"] - REDIS_URL=redis://redis-sandbox:6379
# interval: 30s - PORT=3001
# timeout: 10s depends_on:
# retries: 3 - postgres-sandbox
# start_period: 40s - redis-sandbox
volumes: volumes:
postgres_data: pgdata_prod:
driver: local pgdata_sandbox:
redis_data:
driver: local
# Optional: Add network configuration for isolation
# networks:
# linkforty:
# driver: bridge