/home/suroeste/public_html/payments.transportessuroeste.com
Edit: /home/suroeste/public_html/payments.transportessuroeste.com/docker-compose.yml (6366B)
# ============================================================================
# TRANSPORTES SUROESTE - Docker Compose (Base)
# ============================================================================
# Usage:
# Development: docker compose up -d (uses override automatically)
# Production: docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# ============================================================================
services:
# ==========================================================================
# PHP-FPM Application
# ==========================================================================
php:
build:
context: .
dockerfile: docker/php/Dockerfile
container_name: ts-php
restart: unless-stopped
user: "www-data"
working_dir: /var/www/html
volumes:
- app-logs:/var/www/html/logs
environment:
APP_ENV: ${APP_ENV:-production}
APP_URL: ${APP_URL:-https://api.transportessuroeste.com}
DB_HOST: mysql
DB_PORT: 3306
DB_NAME: ${DB_NAME:-transportes_suroeste_payments}
DB_USER: ${DB_USER:-ts_app}
DB_PASS: ${DB_PASS:?DB_PASS is required}
EPAYCO_PUBLIC_KEY: ${EPAYCO_PUBLIC_KEY:?EPAYCO_PUBLIC_KEY is required}
EPAYCO_PRIVATE_KEY: ${EPAYCO_PRIVATE_KEY:?EPAYCO_PRIVATE_KEY is required}
EPAYCO_P_KEY: ${EPAYCO_P_KEY:?EPAYCO_P_KEY is required}
EPAYCO_TEST_MODE: ${EPAYCO_TEST_MODE:-false}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:?ENCRYPTION_KEY is required}
JWT_SECRET: ${JWT_SECRET:?JWT_SECRET is required}
RATE_LIMIT_REQUESTS: ${RATE_LIMIT_REQUESTS:-100}
RATE_LIMIT_WINDOW: ${RATE_LIMIT_WINDOW:-60}
RATE_LIMIT_BAN_TIME: ${RATE_LIMIT_BAN_TIME:-3600}
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
REDIS_DATABASE: ${REDIS_DATABASE:-0}
networks:
- backend
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
healthcheck:
test: ["CMD-SHELL", "php-fpm-healthcheck || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
# ==========================================================================
# Nginx Reverse Proxy
# ==========================================================================
nginx:
image: nginx:1.25-alpine
container_name: ts-nginx
restart: unless-stopped
ports:
- "${NGINX_PORT:-80}:80"
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/sites/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./public:/var/www/html/public:ro
networks:
- frontend
- backend
depends_on:
php:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.5'
memory: 128M
reservations:
cpus: '0.1'
memory: 32M
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/api/v1/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
# ==========================================================================
# MySQL Database
# ==========================================================================
mysql:
image: mysql:8.0
container_name: ts-mysql
restart: unless-stopped
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?MYSQL_ROOT_PASSWORD is required}
MYSQL_DATABASE: ${DB_NAME:-transportes_suroeste_payments}
MYSQL_USER: ${DB_USER:-ts_app}
MYSQL_PASSWORD: ${DB_PASS:?DB_PASS is required}
volumes:
- mysql-data:/var/lib/mysql
- ./docker/mysql/my.cnf:/etc/mysql/conf.d/custom.cnf:ro
- ./sql/database.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
networks:
- backend
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.25'
memory: 256M
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}"]
interval: 15s
timeout: 5s
retries: 5
start_period: 30s
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
# ==========================================================================
# Redis - Rate limiting and sessions
# ==========================================================================
redis:
image: redis:7-alpine
container_name: ts-redis
restart: unless-stopped
command: >
redis-server
--maxmemory 64mb
--maxmemory-policy allkeys-lru
--save ""
--appendonly no
networks:
- backend
deploy:
resources:
limits:
cpus: '0.25'
memory: 96M
reservations:
cpus: '0.1'
memory: 32M
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 15s
timeout: 3s
retries: 3
start_period: 5s
logging:
driver: json-file
options:
max-size: "5m"
max-file: "2"
# ============================================================================
# Networks
# ============================================================================
networks:
frontend:
driver: bridge
name: ts-frontend
backend:
driver: bridge
name: ts-backend
internal: true
# ============================================================================
# Volumes
# ============================================================================
volumes:
mysql-data:
driver: local
name: ts-mysql-data
app-logs:
driver: local
name: ts-app-logs