78 lines
2.0 KiB
YAML
78 lines
2.0 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
db:
|
|
image: mysql:8.0
|
|
container_name: honey-mysql
|
|
restart: always
|
|
environment:
|
|
MYSQL_DATABASE: honey_db
|
|
MYSQL_USER: honey_user
|
|
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
|
volumes:
|
|
- honey_mysql_data:/var/lib/mysql
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- honey-network
|
|
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.inferno
|
|
container_name: honey-backend
|
|
restart: always
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
- SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/honey_db
|
|
- SPRING_DATASOURCE_USERNAME=honey_user
|
|
- SPRING_DATASOURCE_PASSWORD=${MYSQL_PASSWORD}
|
|
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
|
|
- FRONTEND_URL=${FRONTEND_URL}
|
|
# Logging configuration (external logback-spring.xml)
|
|
- LOGGING_CONFIG=/app/config/logback-spring.xml
|
|
- LOG_DIR=/app/logs
|
|
volumes:
|
|
# Mount secret file from tmpfs
|
|
- /run/secrets:/run/secrets:ro
|
|
# Mount logback config directory (editable on VPS without rebuilding)
|
|
# Note: File must exist on host before mounting. Run setup-logging.sh first.
|
|
- /opt/app/backend/config:/app/config:rw
|
|
# Mount logs directory (persistent storage)
|
|
- /opt/app/logs:/app/logs
|
|
networks:
|
|
- honey-network
|
|
# Don't expose port directly - nginx will handle it
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: honey-nginx
|
|
restart: always
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./nginx/conf.d:/etc/nginx/conf.d:ro
|
|
# SSL certificates (if using HTTPS)
|
|
# - ./nginx/ssl:/etc/nginx/ssl:ro
|
|
depends_on:
|
|
- app
|
|
networks:
|
|
- honey-network
|
|
|
|
volumes:
|
|
honey_mysql_data:
|
|
|
|
networks:
|
|
honey-network:
|
|
driver: bridge
|
|
|
|
|