# Compose v2 - Notification service

x-common-env: &common-env
  env_file:
    - ../env/.env.runtime
    - ../env/.env.version

networks:
  sendico-net:
    external: true
    name: sendico-net

services:
  sendico_notification:
    <<: *common-env
    container_name: sendico-notification
    restart: unless-stopped
    image: ${REGISTRY_URL}/notification/service:${APP_V}
    pull_policy: always
    environment:
      AMPLI_ENVIRONMENT: ${AMPLI_ENVIRONMENT}
      API_PROTOCOL: ${API_PROTOCOL}
      SERVICE_HOST: ${SERVICE_HOST}
      API_ENDPOINT: ${API_ENDPOINT}
      API_ENDPOINT_SECRET: ${API_ENDPOINT_SECRET}
      WS_ENDPOINT: ${WS_ENDPOINT}
      NATS_HOST: ${NATS_HOST}
      NATS_PORT: ${NATS_PORT}
      NATS_USER: ${NATS_USER}
      NATS_PASSWORD: ${NATS_PASSWORD}
      NATS_URL: ${NATS_URL}
      MAIL_USER: ${MAIL_USER}
      MAIL_SECRET: ${MAIL_SECRET}
      TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
      TELEGRAM_CHAT_ID: ${TELEGRAM_CHAT_ID}
      TELEGRAM_THREAD_ID: ${TELEGRAM_THREAD_ID}
      MONGO_HOST: ${MONGO_HOST}
      MONGO_PORT: ${MONGO_PORT}
      MONGO_DATABASE: ${MONGO_DATABASE}
      MONGO_USER: ${MONGO_USER}
      MONGO_PASSWORD: ${MONGO_PASSWORD}
      MONGO_AUTH_SOURCE: ${MONGO_AUTH_SOURCE}
      MONGO_REPLICA_SET: ${MONGO_REPLICA_SET}
      MONGO_HOSTS_0: ${MONGO_HOSTS_0}
      MONGO_PORTS_0: ${MONGO_PORTS_0}
      MONGO_HOSTS_1: ${MONGO_HOSTS_1}
      MONGO_PORTS_1: ${MONGO_PORTS_1}
      MONGO_HOSTS_2: ${MONGO_HOSTS_2}
      MONGO_PORTS_2: ${MONGO_PORTS_2}
      PERMISSION_MODEL: ${PERMISSION_MODEL}
      PERMISSION_COLLECTION: ${PERMISSION_COLLECTION}
      PERMISSION_TIMEOUT: ${PERMISSION_TIMEOUT}
      PERMISSION_IS_FILTERED: ${PERMISSION_IS_FILTERED}
    ports:
      - "0.0.0.0:${NOTIFICATION_HTTP_PORT}:8081"
    healthcheck:
      test: ["CMD-SHELL","wget -qO- http://localhost:8081/health | grep -q '\"status\":\"ok\"'"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
    networks:
      - sendico-net
