# Copyright (c) Mainflux
# SPDX-License-Identifier: Apache-2.0

# This docker-compose file contains optional Postgres-reader service for Mainflux platform.
# Since this service is optional, this file is dependent of docker-compose.yml file
# from <project_root>/docker. In order to run this service, execute command:
# docker-compose -f docker/docker-compose.yml -f docker/addons/postgres-reader/docker-compose.yml up
# from project root.

version: "3.7"

networks:
  docker_mainflux-base-net:
    external: true

services:
  postgres-reader:
    image: mainflux/postgres-reader:latest
    container_name: mainflux-postgres-reader
    restart: on-failure
    environment:
      MF_POSTGRES_READER_LOG_LEVEL: ${MF_POSTGRES_READER_LOG_LEVEL}
      MF_POSTGRES_READER_PORT: ${MF_POSTGRES_READER_PORT}
      MF_POSTGRES_READER_CLIENT_TLS: ${MF_POSTGRES_READER_CLIENT_TLS}
      MF_POSTGRES_READER_CA_CERTS: ${MF_POSTGRES_READER_CA_CERTS}
      MF_POSTGRES_READER_DB_HOST: postgres
      MF_POSTGRES_READER_DB_PORT: ${MF_POSTGRES_READER_DB_PORT}
      MF_POSTGRES_READER_DB_USER: ${MF_POSTGRES_READER_DB_USER}
      MF_POSTGRES_READER_DB_PASS: ${MF_POSTGRES_READER_DB_PASS}
      MF_POSTGRES_READER_DB: ${MF_POSTGRES_READER_DB}
      MF_POSTGRES_READER_DB_SSL_MODE: ${MF_POSTGRES_READER_DB_SSL_MODE}
      MF_POSTGRES_READER_DB_SSL_CERT: ${MF_POSTGRES_READER_DB_SSL_CERT}
      MF_POSTGRES_READER_DB_SSL_KEY: ${MF_POSTGRES_READER_DB_SSL_KEY}
      MF_POSTGRES_READER_DB_SSL_ROOT_CERT: ${MF_POSTGRES_READER_DB_SSL_ROOT_CERT}
      MF_JAEGER_URL: ${MF_JAEGER_URL}
      MF_THINGS_AUTH_GRPC_URL: ${MF_THINGS_AUTH_GRPC_URL}
      MF_THINGS_AUTH_GRPC_TIMEOUT: ${MF_THINGS_AUTH_GRPC_TIMEOUT}
    ports:
      - ${MF_POSTGRES_READER_PORT}:${MF_POSTGRES_READER_PORT}
    networks:
      - docker_mainflux-base-net
