services:
  mysql:
    image: mysql:8.0
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE:-groxza}
      MYSQL_USER: ${DB_USERNAME:-groxza}
      MYSQL_PASSWORD: ${DB_PASSWORD:-secret}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-secret}
    ports:
      - "${FORWARD_DB_PORT:-3306}:3306"
    volumes:
      - groxza-mysql:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      retries: 10
      timeout: 5s

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    ports:
      - "${FORWARD_REDIS_PORT:-6379}:6379"
    volumes:
      - groxza-redis:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      retries: 10
      timeout: 5s

volumes:
  groxza-mysql:
  groxza-redis:
