version: "3.8"

services:
  mongodb:
    image: mongo:4.2.14
    container_name: mongodb
    restart: unless-stopped
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: frx8us2w
      MONGO_INITDB_DATABASE: turnosxpress
    volumes:
      - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
    ports:
      - 192.168.1.61:27017:27017
    networks:
      - internal

  bot-admin-api:
    image: bot-admin-api
    container_name: bot-admin-api
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 3005:3005
    networks:
      - internal

  turnosxpress:
    image: turnosxpress
    container_name: turnosxpress
    restart: unless-stopped
    ports:
      - 3000:3000
      - 3021:3021
      - 3001:3001
    extra_hosts:
      - "api.tx.local:192.168.1.61"
    volumes:
      - /home/horacio/tx-data/uploads:/app/server/build/uploads
    networks:
      - internal

  file-server:
    image: file-server
    container_name: file-server
    restart: unless-stopped
    ports:
      - 4000:4000
    networks:
      - internal

  backup:
    image: backupper
    container_name: backupper
    restart: unless-stopped
    depends_on:
      - mongodb
    volumes:
      - /home/horacio/tx-data/uploads:/data-uploads        # comparte los datos de la app
      - /root/hdr/tx-data/backups:/backup              # guarda los .tar.gz y dumps
      - /root/hdr/tx-data/rclone:/root/.config/rclone  # config de rclone
    networks:
      - internal

  notifications:
    image: notification-sender
    container_name: notifications
    restart: unless-stopped
    depends_on:
      - mongodb
    volumes:
      - /root/hdr/tx-data/notification-logs:/app/logs  # carpeta externa para logs
    environment:
      NODE_NO_WARNINGS: 1
      DOTENV_DISABLE_TELEMETRY: 1
    networks:
      - internal

networks:
  internal:
    name: txlocal_internal
    driver: bridge