services:
  pgsql-boidas:
    image: postgres:16.6
    container_name: pgsql-boidas
    environment:
      POSTGRES_DB: boidas
      POSTGRES_USER: boidas
      POSTGRES_PASSWORD: boidas
      PGDATA: /var/lib/postgresql/data/pgdata
    volumes:
      - ./vols/pgdata:/var/lib/postgresql/data/pgdata
  boidas-service:
    image: "${DOCKER_REGISTRY_IP:PORT}/boidas:${BOIDAS-SERVICE_VERSION}"
    container_name: boidas-service
    restart: always
    depends_on:
      - pgsql-boidas
    environment:
      TZ: Europe/Madrid
      DB_HOST: pgsql-boidas
      DB_USER: boidas
      DB_PASS: boidas
      DB_NAME: boidas
      WORKERS: 1
      ENABLE_SSL: "TRUE"
      MIGRATIONS: "yes"
      VALIDAS_URL: ${VALIDAS_URL:-https://api.eu.veri-das.com/validas/v1}
      API_KEY: ${API_KEY:-apikey_here}
      BASE_URL: 'https://localhost:8443'
      EMAIL_HOST_NAME: 'smtp.mycompany.com'
      EMAIL_HOST_PORT: '587'
      EMAIL_HOST_USER: "noreply@reply.com"
      EMAIL_HOST_PASSWORD: "pass_here"
      DEFAULT_FROM_EMAIL: "info-noreply@veridas.com"
    volumes:
      - ./vols/media:/opt/boidas_backend/media
      - ./vols/logs:/var/log/boidas
  nginx:
    image: "${DOCKER_REGISTRY_IP:PORT}/boidas:${BOIDAS-SERVICE_VERSION}"
    environment:
      SERVER_NAME: localhost
      NGINX_UPSTREAM: boidas-service
      PORT: 8850
    command: /opt/boidas_backend/run_nginx.sh
    depends_on:
      - boidas-service
    ports:
      - 8443:8443
    volumes:
      - ./vols/certs:/etc/boidas/security/certs/
