You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
3.3 KiB
YAML
133 lines
3.3 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15
|
|
container_name: stock-oracle-postgres
|
|
environment:
|
|
POSTGRES_DB: stock_oracle
|
|
POSTGRES_USER: stock_oracle_user
|
|
POSTGRES_PASSWORD: stock_oracle_password
|
|
TZ: Asia/Seoul
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
ports:
|
|
- "15433:5432"
|
|
networks:
|
|
- stock-oracle-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U stock_oracle_user -d stock_oracle"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Redis Cache
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: stock-oracle-redis
|
|
command: redis-server --appendonly yes --requirepass redis_password
|
|
volumes:
|
|
- redis_data:/data
|
|
ports:
|
|
- "16380:6379"
|
|
networks:
|
|
- stock-oracle-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "-a", "redis_password", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Stock Oracle API
|
|
api:
|
|
image: stock-oracle-api:latest
|
|
container_name: stock-oracle-api
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
environment:
|
|
# Database Configuration
|
|
DATABASE_URL: postgresql+asyncpg://stock_oracle_user:stock_oracle_password@postgres:5432/stock_oracle
|
|
|
|
# Redis Configuration
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
REDIS_PASSWORD: redis_password
|
|
|
|
# API Configuration
|
|
API_TITLE: Stock Oracle API
|
|
API_VERSION: 1.0.0
|
|
DEBUG: false
|
|
|
|
# External API Keys (환경변수로 설정)
|
|
SEC_EMAIL: ${SEC_EMAIL:-your-email@example.com}
|
|
ALPHA_VANTAGE_API_KEY: ${ALPHA_VANTAGE_API_KEY:-}
|
|
|
|
# Timezone
|
|
TZ: Asia/Seoul
|
|
|
|
ports:
|
|
- "18001:8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- stock-oracle-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/docs"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
volumes:
|
|
# 로그 볼륨 마운트
|
|
- api_logs:/app/logs
|
|
# yfinance_plus 소스 마운트 (업데이트용)
|
|
- yfinance_plus_src:/app/yfinance_plus
|
|
|
|
# Nginx Reverse Proxy (선택사항)
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: stock-oracle-nginx
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./nginx/ssl:/etc/nginx/ssl:ro
|
|
- nginx_logs:/var/log/nginx
|
|
depends_on:
|
|
- api
|
|
networks:
|
|
- stock-oracle-network
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
name: stock-oracle-postgres-data
|
|
redis_data:
|
|
name: stock-oracle-redis-data
|
|
api_logs:
|
|
name: stock-oracle-api-logs
|
|
yfinance_plus_src:
|
|
name: stock-oracle-yfinance-plus
|
|
nginx_logs:
|
|
name: stock-oracle-nginx-logs
|
|
|
|
networks:
|
|
stock-oracle-network:
|
|
name: stock-oracle-network
|
|
driver: bridge
|
|
|
|
# Portainer Labels for better management
|
|
x-portainer-labels: &portainer-labels
|
|
- "io.portainer.accesscontrol.teams=stock-oracle-team"
|
|
- "io.portainer.accesscontrol.users=admin"
|
|
- "project=stock-oracle"
|
|
- "environment=production" |