networks:
  nw-letto:
    external: true
  nw-proxy:
    external: true

volumes:
  certs:
    name: certs
  certs-data:
    name: certs-data
#  lettomysql:
#    name: lettomysql

services:
  question1:
    image: lettohub/letto-service-question:stable
    restart: always
    networks:
      - nw-letto
    deploy:
      resources:
        limits:
          memory: "${QUESTION_MEMORY_LIMIT:-1G}"
    logging:
      driver: "json-file"
      options:
        max-size: "2m"
        max-file: "3"

    hostname: letto-question-${QUESTION_1_NAME}
    container_name: letto-question-${QUESTION_1_NAME}

    volumes:
      - ${VOLUME_IMAGES:-/opt/letto/docker/storage/images}:/opt/letto/images
      - ${VOLUME_PLUGINS:-/opt/letto/docker/storage/plugins}:/opt/letto/plugins
      - ${VOLUME_QUESTIONS:-/opt/letto/docker/storage/questions}:/opt/letto/questions
      - ${VOLUME_LOG:-/opt/letto/docker/storage/log}/question-${QUESTION_1_NAME}:/log
      - ${VOLUME_PROJEKTE:-/opt/letto/docker/storage/projekte}:/opt/letto/projekte

    environment:
      - letto_question_baseadress=${QUESTION_1_NAME:-question}
      - letto_question_open=${QUESTION_1_OPEN:-true}
      - letto_question_preRender=${QUESTION_1_PRERENDER:-false}
      - letto_question_cache=${QUESTION_1_CACHE:-true}

      - TZ=${TIMEZONE:-Europe/Berlin}
      - LC_ALL=${LOCALE:-de_DE.UTF-8}
      - letto_user_user_password=${SERVICE_USER_PASSWORD}
      - letto_user_gast_password=${SERVICE_GAST_PASSWORD}
      - letto_user_admin_password=${SERVICE_ADMIN_PASSWORD}
      - jwt_secret=${JWT_SECRET:-YWJj}
      - server_secret=${SERVER_SECRET:-YWJj}
      - UNHEALTHY_RETRIES=${QUESTION_UNHEALTHY_RETRIES:-${UNHEALTHY_RETRIES:-20}}

      - spring.mail.host=${spring_mail_host:-}
      - spring.mail.port=${spring_mail_port:-}
      - spring.mail.username=${spring_mail_username:-}
      - spring.mail.password=${spring_mail_password:-}
      - spring.mail.smtp.auth=${spring_mail_properties_mail_smtp_auth:-true}
      - spring.mail.properties.mail.smtp.starttls.enable=${spring_mail_properties_mail_smtp_starttls_enable:-true}
      - spring.mail.properties.mail.smtp.ssl.enable=${spring_mail_properties_mail_smtp_ssl_enable:-true}
      - spring.mail.properties.mail.debug=${spring_mail_properties_mail_debug:-false}
      - spring.mail.address.noreply=${spring_mail_address_noreply:-norelpy@schule.com}
      - spring.mail.address.reply=${spring_mail_address_reply:-relpy@schule.com}
      - mail.admin.adress=${EMAIL:-}
      - servername=${SERVER_NAME}

      - letto_setup_uri=${LETTO_SETUP_URI:-http://letto-setup.nw-letto:8096}
      - letto_login_uri=${LETTO_LOGIN_URI:-http://letto-login.nw-letto:8095}
      - letto_question_dataserviceUri=http://data1.nw-letto:8300

      - letto_pathImages=/opt/letto/images
      - letto_pathQuestions=/opt/letto/questions
      - letto_pathImagesPlugins=/opt/letto/plugins
      - letto_webPathImages=${SERVER_NAME}/images
      - letto_webPathImagesPlugins=${SERVER_NAME}/images/plugins
      - REDIS_PASSWORD=${REDIS_PASSWORD:-${MYSQL_ROOT_PASSWORD}}
      - REDIS_DEFAULT_DATABASE=${QUESTION_REDIS_DEFAULT_DATABASE:-2}
      - MONGO_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD:-${MYSQL_ROOT_PASSWORD}}
      - MONGO_DEFAULT_DATABASE=${QUESTION_MONGO_DEFAULT_DATABASE:-question}

      - JAVA_OPTS=${JAVA_OPTS_QUESTION:--Xms100m -Xmx500m}
      - debug=${DEBUG_QUESTION:-${DEBUG:-false}}

    #ports:
    #  - "${DEBUG_PORT_QUESTION:-5102}:15102"
