networks:
  nw-letto:
    external: true

# Der Name bestimmt das Projekt und sollte bei jeder yml-Datei unterschiedlich sein - er kann mit -p bei docker-compose überschrieben werden
name: letto-edit

services:
  # edit-service
  edit:
    image: lettohub/letto-service-edit:stable
    restart: always
    networks:
      - nw-letto
    deploy:
      resources:
        limits:
          memory: "${EDIT_MEMORY_LIMIT:-1G}"
    logging:
      driver: "json-file"
      options:
        max-size: "2m"
        max-file: "3"
    hostname: letto-edit
    container_name: letto-edit
    volumes:
      - ${VOLUME_IMAGES:-/opt/letto/docker/storage/images}:/opt/letto/images
      - ${VOLUME_PLUGINS:-/opt/letto/docker/storage/plugins}:/opt/letto/plugins
      - ${VOLUME_PROJEKTE:-/opt/letto/docker/storage/projekte}:/opt/letto/projekte
      - ${VOLUME_KENNLINIEN:-/opt/letto/docker/storage/kennlinien}:/opt/letto/kennlinien
      - ${VOLUME_PUBLIC:-/opt/letto/docker/public}:/opt/letto/public
      - ${VOLUME_LOG:-/opt/letto/docker/storage/log}/edit:/log
    environment:
      - TZ=${TIMEZONE:-Europe/Berlin}
      - LC_ALL=${LOCALE:-de_DE.UTF-8}
      - jwt_secret=${JWT_SECRET:-YWJj}
      - server_secret=${SERVER_SECRET:-YWJj}
      - letto_user_user_password=${SERVICE_USER_PASSWORD}
      - letto_user_gast_password=${SERVICE_GAST_PASSWORD}
      - letto_user_admin_password=${SERVICE_ADMIN_PASSWORD}
      - letto_setup_uri=${LETTO_SETUP_URI:-http://letto-setup.nw-letto:8096}
      - letto_servername=${SERVER_NAME}
      - letto_question_uri=${LETTO_QUESTION_URI:-http://letto-question.nw-letto:8102}
      - 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_saveQuestionAsync=${SAVE_QUESTION_ASYNC:-false}
      - saveQuestionAsync=${SAVE_QUESTION_ASYNC:-false}
      - servername=${SERVER_NAME}
      - UNHEALTHY_RETRIES=${EDIT_UNHEALTHY_RETRIES:-${UNHEALTHY_RETRIES:-20}}

      - letto_pathImages=/opt/letto/images
      - letto_webPathImages=${SERVER_NAME}/images
      - letto_pathImagesPlugins=/opt/letto/plugins
      - letto_webPathImagesPlugins=${SERVER_NAME}/plugins
      - letto_pathProjekte=/opt/letto/projekte
      - letto_webPathProjekte=${SERVER_NAME}/projekte
      - REDIS_PASSWORD=${REDIS_PASSWORD:-${MYSQL_ROOT_PASSWORD}}
      - REDIS_DEFAULT_DATABASE=${EDIT_REDIS_DEFAULT_DATABASE:-4}
      - MONGO_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD:-${MYSQL_ROOT_PASSWORD}}
      - MONGO_DEFAULT_DATABASE=${EDIT_MONGO_DEFAULT_DATABASE:-edit}
      - logging_level_root=${LOG_LEVEL_EDIT:-${LOG_LEVEL:-ERROR}}
      - logRedisError=${LOG_REDIS_ERROR_EDIT:-${LOG_REDIS_ERROR:-false}}

      - JAVA_OPTS=${JAVA_OPTS_EDIT:--Xms50m -Xmx300m}
      - debug=${DEBUG_EDIT:-${DEBUG:-false}}
    ports:
    #  - "8103:8103"
      - "${DEBUG_PORT_EDIT:-5103}:5103"
